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 "Julius Stroffek (JIRA)" <ji...@apache.org> on 2007/02/20 12:17:05 UTC

[jira] Created: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) does not work

The XAResource.end(xid, XAResource.TMFAIL) does not work
--------------------------------------------------------

                 Key: DERBY-2360
                 URL: https://issues.apache.org/jira/browse/DERBY-2360
             Project: Derby
          Issue Type: Bug
    Affects Versions: 10.3.0.0
         Environment: Solaris Nevada build 56, sun jdk 1.6
            Reporter: Julius Stroffek
         Assigned To: Julius Stroffek


If I execute this peace of code

        Xid xid = createXid(9,11);
        xaRes.start(xid, XAResource.TMNOFLAGS);
        Statement stm = conn.createStatement();
        stm.execute("create table NumberTable2 (i int)");
        stm.execute("insert into NumberTable2 values (1)");
        xaRes.end(xid, XAResource.TMFAIL);
        xaRes.rollback(xid);

I get the following exception

1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
        at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
        at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
        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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)

 
If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) does not work

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474679 ] 

Julius Stroffek commented on DERBY-2360:
----------------------------------------

Thanks Dan, for pointing this out. Still, I find weird to return a value using an exception in case where no error occurred.

The JTA specification is based on Distributed Transaction Processing: The XA Specification and we implement the JTA. If I would be implementing a transaction manager according the JTA I would not expect this to happen. This may cause that some transaction manager implementation will not work correctly with derby.

I'll check this in some transaction manager implementations.

> The XAResource.end(xid, XAResource.TMFAIL) does not work
> --------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12477028 ] 

Daniel John Debrunner commented on DERBY-2360:
----------------------------------------------

XAExceptions are how XA return codes are returned.

A valid state change on an xa_end is from active (S1) to rollback-only (S4), this is from table 6-4 in the XA spec [page 62 (75 in pdf)].

This state change can occur on any xa_end, *even one* that passes in TMSUCCESS.
With XAResource.end() being void, how else can a resource manager indicate to the transaction manager that an end(TMSUCCESS) has failed and changed the transaction state to S4 rollback only?

Transaction managers need to handle this, it's not Derby's problem that Geronimo  and JOTM are implemented incorrectly.

Now the text of the description of TMFAIL from the XA spec is interesting. (see quote above). It says for an xa_end(TMFAIL)

The transaction manager (app-server) *will* mark the global transaction as rollback only.

The resource manager (derby) *may also choose* to mark the transaction as rollback only.
If it (derby) does so then xa_end returns an RB errorcode.

Derby implents this last portion by choosing to mark the transaction as rollback only and thus according to the spec has to return
an RB error code and so does so through the only mechanism available, XAException.

> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12476609 ] 

Julius Stroffek commented on DERBY-2360:
----------------------------------------

The code in NetXAResource.end interprets the specification the same way as Geronimo and ObjectWeb. At the end of the method there is a code

        if (rc != XAResource.XA_OK) {
            throwXAException(rc, false);
        }else {
        	conn_.setXAState(Connection.XA_T0_NOT_ASSOCIATED);
        } 
 
which do not set the proper xa state on a connection if the exception is thrown when TMFAIL is specified.

I would say that the transaction state should not be returned to the client/transaction manager as an exception at all. The exceptions should be thrown only as a result of an error of ending the association itself.

The JTA spec says:
Error return values that are caused by the transaction manager's improper
handling of the XAResource object are mapped to Java exceptions via the
XAException class.

The JDK6 javadoc says (XAResource.end method):
Throws:
    XAException - An error has occurred. Possible XAException values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB*.

I think that many developers (including myself before considering Dan's comment and reading the DTP XA specification again) would interpret this as: "The exception is thrown so the error disassociating the transaction from the connection occured".

So there are two possible interpretations:
1.) Map the return values from DTP XA spec and throw them as exceptions.
        * Doing this is not explicitly stated in JTA spec.
        * One have to use a bit of creativity to make a link between JTA and DTP XA specs.
        * Very less developers would interpret JTA spec. and javadoc this way.

2.) Throw an exception only if an error occured.
        * Follows the java convention for using exceptions.
        * More accurate to JTA spec without reading DTP XA.
        * Probably more developers will interpret JTA spec. and javadoc this way.

I would prefer the option 2.)

Please, provide any comments.


> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julius Stroffek closed DERBY-2360.
----------------------------------


> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julius Stroffek updated DERBY-2360:
-----------------------------------

    Summary: The XAResource.end(xid, XAResource.TMFAIL) throws an exception  (was: The XAResource.end(xid, XAResource.TMFAIL) does not work)

> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) does not work

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474521 ] 

Daniel John Debrunner commented on DERBY-2360:
----------------------------------------------

I think this behaviour comes from "Distributed Transaction Processing: The XA Specification"

http://www.opengroup.org/onlinepubs/009680699/toc.pdf

>From page 38 (51 in the pdf doc)
-----------------------------------------
TMFAIL
The portion of work has failed. A resource manager might choose to mark a
transaction branch as rollback-only at this point. In fact, a transaction manager
does so for the global transaction. If a resource manager chooses to do so also,
xa_end() returns one of the [XA_RB*] values. TMFAIL cannot be used in
conjunction with either TMSUSPEND or TMSUCCESS.
-------------------------------------------

So the resource manager deciding the transaction is rollback only has to return one of the XA_RB values.
In JTA the only way to return such values is to throw an XAException with the XA_RB* error code. 


> The XAResource.end(xid, XAResource.TMFAIL) does not work
> --------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474694 ] 

Julius Stroffek commented on DERBY-2360:
----------------------------------------

I checked the Apache Geronimo (http://geronimo.apache.org/) and the implementation code for javax.transaction.Transaction.delistResource looks as (in a class org.apache.geronimo.transaction.manager.TransactionImpl)

        try {
            xaRes.end(manager.getBranchId(), flag);
            if (flag == XAResource.TMSUSPEND) {
                suspendedXaResources.put(xaRes, manager);
            }
            return true;
        } catch (XAException e) {
            log.warn("Unable to delist XAResource " + xaRes + ", error code: " + e.errorCode, e);
            return false;
        }
 
So, If I will pass a TMFAIL in flags I will get an exception that the transaction manager is not able to delist the resource.

I also checked JOTM on ObjectWeb (http://jotm.objectweb.org/) and the corresponding code for javax.transaction.Transaction.delistResource which can be found in org.objectweb.jotm.TranasctionImpl.java is

        // Send the XA end to the XAResource
        try {
            xares.end (myjavaxxid, flag);
            // xares.end( (javax.transaction.xa.Xid) resXid, flag );
        } catch (XAException e) {
            String error =
                "Cannot send XA end:"
                    + e
                    + " (error code = "
                    + e.errorCode
                    + ") --"
                    + e.getMessage();
            TraceTm.jotm.error(error);
            if (TraceTm.jta.isDebugEnabled()) {
                TraceTm.jotm.debug("xares.end= " + xares);
            }
            throw new SystemException(error);
        }

which also propagates the exception thrown in XAResource.end with TMFAIL flag as an error to the application.

> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478380 ] 

Julius Stroffek commented on DERBY-2360:
----------------------------------------

Ok, Dan. Thanks.

So I have created DERBY-2406 to handle the wrong code in NetXAResource.end. If this will be resolved, I'll close this issue.

> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) does not work

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474458 ] 

Daniel John Debrunner commented on DERBY-2360:
----------------------------------------------

I think it's working as intended from looking at the engine code. The way the resource manager indicates to the transaction manager that the transaction is read-only is to throw an XAException with the error code indicating that only rollback is to be allowed.

> The XAResource.end(xid, XAResource.TMFAIL) does not work
> --------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julius Stroffek resolved DERBY-2360.
------------------------------------

    Resolution: Won't Fix

As comments above and in DERBY-2418 show the current behavior is an intent.

> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) throws an exception

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2360:
----------------------------------

    Component/s: JDBC

> The XAResource.end(xid, XAResource.TMFAIL) throws an exception
> --------------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.1.4
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>            Assignee: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2360) The XAResource.end(xid, XAResource.TMFAIL) does not work

Posted by "Julius Stroffek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474490 ] 

Julius Stroffek commented on DERBY-2360:
----------------------------------------

This makes sense, but I was not able to find this behavior in any specification. Is it mentioned somewhere in JTA spec, JDBC or Derby spec? I was not able to find this there. This behavior is not mentioned in jdk1.5 javadoc where I would expect it to be.

What is the reason to notify the transaction manager by throwing an exception in a case when the transaction manager knows that the resource is read-only (because it knows the flag it passed to the call)? I would expect this exception to be thrown only later in a call to commit function or in a similar case.

> The XAResource.end(xid, XAResource.TMFAIL) does not work
> --------------------------------------------------------
>
>                 Key: DERBY-2360
>                 URL: https://issues.apache.org/jira/browse/DERBY-2360
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 56, sun jdk 1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>
> If I execute this peace of code
>         Xid xid = createXid(9,11);
>         xaRes.start(xid, XAResource.TMNOFLAGS);
>         Statement stm = conn.createStatement();
>         stm.execute("create table NumberTable2 (i int)");
>         stm.execute("insert into NumberTable2 values (1)");
>         xaRes.end(xid, XAResource.TMFAIL);
>         xaRes.rollback(xid);
> I get the following exception
> 1) testXAConnection(org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest)javax.transaction.xa.XAException
>         at org.apache.derby.jdbc.EmbedXAResource.end(EmbedXAResource.java:208)
>         at org.apache.derbyTesting.functionTests.tests.jdbcapi.XATransactionTest.testXAConnection(XATransactionTest.java:94)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:76)
>         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 junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>  
> If I change TMFAIL to TMSUCCESS, everything works. The end with TMFAIL shoudl do the same as with TMSUCCESS except that I can only rollback the transaction.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.