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

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

Looking at the patch I think you describe the same situation in three different 
ways:
  1) global transaction in unit of work   [ not sure if unit of work is the 
correct description here]
  2) XA transaction if it was not disassociated from the connection  [ double 
negative ] 
  3) global/local transaction associated with the connetion [ local 
transactions are not associated]

I think this makes the code confusing for later readers who will not have the 
benefit of seeing all three together.
I think the correct terminology would be (I assume this is what the patch 
intends):
  - If the global transaction is associated with the XAResource and the 
physical connection is closed then rollback the
global transaction.

For the changes to EmbedXAConnection I think two changes are needed:
    - end the transaction with TMFAIL (resource manager will mark it as 
rollback-only)
    - do not print the XAException to System.err. The embedded driver must 
throw its exceptions to
      the calling program, in this case you need to wrap it in a SQLException

I didn't look at the network code, but can local transactions use the new 
abortCurrentTransaction method DRDAXAProtocol?
Using the term associated here with local connection is confusing, since 
associated is for XA global transactions..






> Uncommitted transactions executed throught XAResource will held locks after 
> the application terminates (or crashes during the transaction).
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2220
>                 URL: https://issues.apache.org/jira/browse/DERBY-2220
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 49, Sun's JDK1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>         Attachments: d2220_beta.diff, d2220_beta2.diff, d2220_try1.diff, 
> d2220_try1.stat, XATranTest.java, xxx.sql
>
>
> Using this piece of code derby will not release a table lock of 'dummy' table.
>             String query = "insert into dummy (field1) values ('" + 
> Integer.toString(value) + "')";
>             XAConnection xaConnection = 
> createXAConnection("jdbc:derby://localhost:1527/TestDB", "", "");
>             XAResource xaResource = xaConnection.getXAResource();
>             conn = xaConnection.getConnection();
>             
>             Xid xid = createXid(value);        
>             xaResource.setTransactionTimeout(10);
>             xaResource.start(xid, XAResource.TMNOFLAGS);
>             
>             Statement statement = conn.createStatement();
>             statement.execute(query);        
>             
>             // terminate the client application
>             // this will not release any locks
>             System.exit(0);

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

Reply via email to