I have the following test scenario:
1) Start a distributed XA transaction (in JBoss by simply using a Mysql XA Driver in the same transaction as using another XA compatible connector)
2) Insert data into the database (from say a Servlet using JDBC)
3) Set a breakpoint in the class MysqlXAConnector (Mysql Driver 5.1.36), at the start of the method "commit(...)"
4) When the debugger stops at the breakpoint, before the "XA COMMIT xyz" command has been sent to Mysql, stop Mysqld (server). Using the debugger, allow the process continue.
I expected that the transaction would remain in an incomplete state until the transaction manager can run the recovery process, at which point the app server would call "recover" on the XA resource which would tell the driver to issue the "XA RECOVER" command to the database, which would return a list of incomplete transactions needing recovery. The database did after all vote to commit during the "PREPARE" stage.
But I have found several problems.
A) The driver (5.1.36) throws an XAException with the code XAException.XAER_RMFAIL (-7).
B) Mysql is not persisting the fact that a transaction has not been complete, and upon restarting Mysql, it always reports an empty list of Xids during recovery.
C) JBoss logs "...WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016037: Could not find new XAResource to use for recovering non-serializable XAResourceXAResourceRecord < resource:null, txid: <...eis_name=unknown eis name >, heuristic: TwoPhaseOutcome.FINISH_OK ...>"
Are these problems purely Mysql issues, or is there a problem with JBoss?
1) Is it correct that JBoss does not retry committing the prepared transaction after the connector returns XAER_RMFAIL? After all, the connector voted to commit during the prepare stage.
2) Is it correct that it is up to Mysql to persist knowledge of open connections, and return these during recovery, or should JBoss be tracking these itself and re-attempting commit/rollback if there is a failure after all resources successfully vote to commit / rollback after the prepare stage?
3) Why is JBoss logging "unknown eis name" for the incompleted transaction on the mysql resource?
Testing on a Thinkpad using Linux Fedora Core 20
MySQL Command line client: mysql Ver 14.14 Distrib 5.6.24, for Linux (x86_64) using EditLine wrapper
Server version: 5.6.24 MySQL Community Server (GPL)
Java 1.8 (Oracle)
JBoss Wildfly 8.2
<xa-datasource jndi-name="java:/jdbc/MyXaDS" pool-name="MyXaDSPool" enabled="true" use-ccm="false">
<driver name="mysql" module="com.mysql">
Thanks for any help :-)