You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Kathey Marsden <km...@sbcglobal.net> on 2006/02/21 00:00:41 UTC
Should xa_forget() on a prepared transaction cause XAER_NOTA or XAER_PROTO?
In xaStateTran.sql we have this case:
-- get back into prepared state
xa_start xa_noflags 50;
insert into xastate values(2);
xa_end xa_success 50;
xa_prepare 50;
select * from global_xactTable where gxid is not null order by gxid;
-- the following should error XAER_NOTA
xa_forget 50;
But actually looking at the state transitions in the XA+
specification, it seems like xa_forget should only be valid for a
heuristically completed transaction, so I think should be XAER_PROTO
and not XAER_NOTA. Is that correct?
The user code I am looking at handles forget like this. They expect
XAER_PROTO in this case.
try {
xaRes.forget(xidList[i]);
System.out.print("XA-Transaction [" + (i+1) + "]
Forgotten. \n" );
} catch (XAException XAeForget) {
if ( XAeForget.errorCode ==
XAException.XAER_PROTO ) {
System.out.print("XA-Transaction [" + (i+1)
+ "] not heuristically completed yet - Rolling Back instead. \n" );
xaRes.rollback(xidList[i]);
System.out.print("XA-Transaction [" + (i+1)
+ "] Rolled Back. \n" );
}
if ( XAeForget.getMessage() != null ) {
System.out.println("XAException " +
XAeForget.getMessage() );
}