参考 https://dev.mysql.com/doc/refman/8.0/en/xa-statements.html

    问题:
    XA事务失败后,插入数据报错

    1. mysql> select * from account;
    2. +-------+------+
    3. | money | name |
    4. +-------+------+
    5. | 1000 | bb |
    6. +-------+------+
    7. 1 row in set (0.00 sec)
    8. mysql>
    9. mysql> insert into account select 100,'cc';
    10. ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

    解决

    mysql> XA RECOVER CONVERT XID;
    +----------+--------------+--------------+--------+
    | formatID | gtrid_length | bqual_length | data   |
    +----------+--------------+--------------+--------+
    |      100 |            1 |            1 | 0x1112 |
    +----------+--------------+--------------+--------+
    1 row in set (0.00 sec)
    
    mysql> xa rollback 0x11,0x12,100;
    Query OK, 0 rows affected (0.01 sec)