Description:
Serg, I know you know this is a known issue, but this bug is here for tracking purposes.
The issue (as you know) is that global transactions rollback on connection failure after "XA PREPARE", which means that a TM can't recover the them, and thus a violation of the XA protocol.
How to repeat:
The following test in JDBC fails with no XIDs returned for recovery (the .close() closes the _physical_ connection in this case):
public void testRecover() throws Exception {
XAConnection xaConn = getXAConnection();
Connection c = xaConn.getConnection();
Xid xid = createXid();
XAResource xaRes = xaConn.getXAResource();
xaRes.start(xid, XAResource.TMNOFLAGS);
c.createStatement().executeQuery("SELECT 1");
xaRes.end(xid, XAResource.TMSUCCESS);
xaRes.prepare(xid);
xaConn.close();
// Now try and recover
XAResource recoverRes = getXAConnection().getXAResource();
Xid[] recoveredXids = recoverRes.recover(XAResource.TMNOFLAGS);
assertEquals(1, recoveredXids.length);
}
Description: Serg, I know you know this is a known issue, but this bug is here for tracking purposes. The issue (as you know) is that global transactions rollback on connection failure after "XA PREPARE", which means that a TM can't recover the them, and thus a violation of the XA protocol. How to repeat: The following test in JDBC fails with no XIDs returned for recovery (the .close() closes the _physical_ connection in this case): public void testRecover() throws Exception { XAConnection xaConn = getXAConnection(); Connection c = xaConn.getConnection(); Xid xid = createXid(); XAResource xaRes = xaConn.getXAResource(); xaRes.start(xid, XAResource.TMNOFLAGS); c.createStatement().executeQuery("SELECT 1"); xaRes.end(xid, XAResource.TMSUCCESS); xaRes.prepare(xid); xaConn.close(); // Now try and recover XAResource recoverRes = getXAConnection().getXAResource(); Xid[] recoveredXids = recoverRes.recover(XAResource.TMNOFLAGS); assertEquals(1, recoveredXids.length); }