Issue Details (XML | Word | Printable)

Key: DERBY-2406
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Julius Stroffek
Reporter: Julius Stroffek
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

XAResource.end does not set the XA transaction state correctly when the XAException is thrown

Created: 06/Mar/07 10:47 AM   Updated: 08/Mar/07 01:20 PM
Return to search
Component/s: Network Client
Affects Version/s: 10.3.1.4
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works d2406.diff 2007-03-08 08:31 AM Julius Stroffek 0.8 kB

Urgency: Normal
Resolution Date: 08/Mar/07 01:20 PM


 Description  « Hide
As the comments in DERBY-2360 show when calling the XAResource.end the XAException may be thrown even when the transaction was successfully disassociated from the connection but the transaction was marked as rollback only. The code at the end of XAResource.end function does not handle this correctly. It either throws an XAException or sets the connection state to XA_T0_NOT_ASSOCIATED. The corresponding code from NetXAResource.end method is

        if (rc != XAResource.XA_OK) {
            throwXAException(rc, false);
        }else {
         conn_.setXAState(Connection.XA_T0_NOT_ASSOCIATED);
        }


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Julius Stroffek added a comment - 06/Mar/07 10:50 AM
I do not know the impact on derby functionality but the wrong XA connection state is used in the following functions:

org.apache.derby.client.net.NetConnection.allowLocalCommitRollback_()
org.apache.derby.client.net.NetXAConnection.readCommit()
org.apache.derby.client.net.NetConnection.willAutoCommitGenerateFlow()
org.apache.derby.client.net.NetXAConnection.writeCommit()
org.apache.derby.client.net.NetXAConnection.writeTransactionStart()

Julius Stroffek added a comment - 08/Mar/07 08:31 AM
The implementation in derby is alright. I missed the call to setXaStateForXAException. The patch provided adds only a comment to the place in a code which is mentioned in a description. I added the following comment:

            // The corresponding XA connection association state
            // is changed by setXaStateForXAException inside the call
            // to throwXAException according the error code of the XAException
            // to be thrown.

Hopefully, it may help someone in a future not to miss it as I did.

Feel free to ignore the patch if you find it unnecessary. If nobody applies the patch I'll close the issue in a few days.
 

Knut Anders Hatlen added a comment - 08/Mar/07 11:07 AM
Thanks Julo! The comment looks useful to me. Committed revision 516009.