Bug #46817 Make internal XIDs print using readable characters
Submitted: 19 Aug 2009 22:57 Modified: 29 Aug 2009 7:59
Reporter: Mark Callaghan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version:5.0.44 OS:Any
Assigned to: CPU Architecture:Any
Tags: binlog, innodb, xid

[19 Aug 2009 22:57] Mark Callaghan
Description:
The internally generated XIDs used to keep the binlog and InnoDB in sync on crash recovery use characters that are not displayed by my terminal.

To display them I first piped the output through 'od', but then settled on:
mysql -e 'xa recover' | awk '{print $4}'

See
http://harrison-fisk.blogspot.com/2009/01/xa-and-persistent-innodb-locks.html

The XID is required to abort an old PREPARED transaction via 'xa recover'. This comes about from an obscure problem. This change would make that problem easier to fix.

How to repeat:
na

Suggested fix:
na
[27 Aug 2009 21:32] Harrison Fisk
The internal XID is formed from the prefix 'MySQLXid' + server_id + query_id.  Both of the latter ones are in the direct binary format, which then results in the problem being seen.

Switching to ascii forms of the server_id and query_id would greatly increase the size required in the binary log for storage of them.  query_id is an 8 byte int, so it would be 20 bytes in ascii and server_id would be 10 bytes.  So 20 vs. 38 bytes total.

I thought it might be possible to encode the XID someway in XA RECOVER (such as hex or escape characters), but I believe that might violate the XA specification and break transaction managers that use it.

In normal operation the internal XID's should never been seen, since they should always be rolled back and never show up in XA RECOVER.  I think this is a better way of fixing this issue and it is now reported in Bug #46944.

So I would vote setting this to not a bug and instead let Bug #46944 fix the issue instead.

What do you think Mark?
[28 Aug 2009 22:04] Mark Callaghan
ok