db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jayaram Subramanian (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-1016) javax.transaction.xa.forget (Xid) raises XAER_NOTA exception instead of XA_PROTO on a prepared transaction
Date Sun, 16 Oct 2011 03:56:11 GMT

    [ https://issues.apache.org/jira/browse/DERBY-1016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13128338#comment-13128338
] 

Jayaram Subramanian commented on DERBY-1016:
--------------------------------------------

Thanks Kathy,
As per the issue history, to make the xa_forget to throw the xaer_proto error, modified the
patched EmbedXAResource.java from 

throw new XAException(tranState.isPrepared ? XAException.XAER_PROTO: XAException.XAER_NOTA)

to 
throw     new XAException(XAException.XAER_PROTO)

After making the above change, tried running attached fixture testForgetExceptionDerby1016.
But  i get the exception  below. 

1) testForgetExceptionDerby1016(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)junit.framework.AssertionFailedError:

FAIL: Got unexpected exception null errorCode: -4  calling forget on a prepared transaction
expected:<-6> but was:<-4>
	at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testForgetExceptionDerby1016(XATransactionTest.java:447)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:116)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
	at junit.extensions.TestSetup.run(TestSetup.java:25)
	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

                
> javax.transaction.xa.forget (Xid) raises XAER_NOTA exception instead of XA_PROTO on a
prepared transaction
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1016
>                 URL: https://issues.apache.org/jira/browse/DERBY-1016
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.3.1, 10.2.1.6
>            Reporter: Kathey Marsden
>            Assignee: Jayaram Subramanian
>              Labels: derby_triage10_5_2
>         Attachments: DERBY-1016.patch, DERBY-1016.patch, DERBY-1016_Patch_1.diff, ReproDerby1016.java,
utilXid.java
>
>
> javax.transaction.xa.forget (Xid) raises XAER_NOTA exception instead of XA_PROTO on a
prepared transaction
> I posted a question to derby-dev about this and heard no response so am assuming it is
indeed a bug.
>  in  the  XA+ 
> specification, it seems like xa_forget should  only be valid for a
> heuristically completed transaction, so should  be  XAER_PROTO
> and not XAER_NOTA.
> 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;
> 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() );
>              

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message