Search code examples
mysqlxa

mysql XA commit


While committing XA pending transactions on mysql restart I am getting the following the error. Please help me in resolving this error.

mysql> XA RECOVER CONVERT XID;
+----------+--------------+--------------+------------------------------------------------------------------------------------------------+
| formatID | gtrid_length | bqual_length | data                                                                                           |
+----------+--------------+--------------+------------------------------------------------------------------------------------------------+
|  4871251 |           26 |           20 | 0xA223010095EDCC9A6369736861322C7365727665722C503130306369736861322C7365727665722C503130302C00 |
|  4871251 |           26 |           20 | 0xA123010095EDCC9A6369736861322C7365727665722C503130306369736861322C7365727665722C503130302C00 |
|  4871251 |           26 |           20 | 0xA023010095EDCC9A6369736861322C7365727665722C503130306369736861322C7365727665722C503130302C01 |


mysql> XA COMMIT 0x7023010095EDCC9A6369736861322C7365727665722C503130,0x306369736861322C7365727665722C503130302C00,4871251;
ERROR 1397 (XAE04): XAER_NOTA: Unknown XID

[root@db1 ~]# mysql --version
mysql  Ver 14.14 Distrib 5.7.20, for Linux (x86_64) using  EditLine wrapper
[root@db1 ~]# uname -a
Linux db1 3.10.0-514.26.2.el7.x86_64 #1 SMP Fri Jun 30 05:26:04 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@db1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)

Solution

  • According to you data, the gtrid's length is 26, but the gtrid value in your commit (7023010095EDCC9A6369736861322C7365727665722C503130) has only 50 characters, so the actual length is only 25, not 26. Correspondingly, your bqual is longer. Your gtrid should be 7023010095EDCC9A6369736861322C7365727665722C50313030 and should adjust the bqual accordingly.