Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 12559 invoked from network); 19 Jul 2010 04:45:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Jul 2010 04:45:36 -0000 Received: (qmail 73665 invoked by uid 500); 19 Jul 2010 04:45:36 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 73599 invoked by uid 500); 19 Jul 2010 04:45:34 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 73592 invoked by uid 99); 19 Jul 2010 04:45:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jul 2010 04:45:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jul 2010 04:45:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9157E23889BB; Mon, 19 Jul 2010 04:44:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r965351 - in /db/derby/code/branches/10.6/java: engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Date: Mon, 19 Jul 2010 04:44:36 -0000 To: derby-commits@db.apache.org From: mikem@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100719044436.9157E23889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mikem Date: Mon Jul 19 04:44:36 2010 New Revision: 965351 URL: http://svn.apache.org/viewvc?rev=965351&view=rev Log: DERBY-4731 backport change #965317 from trunk to 10.6 branch. Previous change did not completely solve the problem. There is a problem with the initial fix, not sure why it only showed an error in the 10.3 backport. The temporary tables are stored in the transaction context, so using a nested transaction creates a new context and the work there is not reflected in the parent context. Thus the previous fix which used a nested transaction does not work. This patch delays the work on the XA global temporary tables until after the xa transaction has committed but before control returns to the client executing the commit. The delay solves the issue of attempting to do work in a prepared transaction. It drops all global temporary tables following an XA commit. This gives us consistent behavior between embedded and network server implementations. At the time of an xa end the system "Ends the work performed on behalf of a transaction branch. The resource manager disassociates the XA resource from the transaction branch specified and lets the transaction complete." Given this description of the behavior of XAResource it seems reasonable to document that global temporary tables are not supported across the XA commit boundary. In the worst case one might be connecting to an resource in completely another database and the temp table implementation is tied to the transaction context in a single connection to a existing server. Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?rev=965351&r1=965350&r2=965351&view=diff ============================================================================== --- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java (original) +++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java Mon Jul 19 04:44:36 2010 @@ -662,50 +662,69 @@ public class GenericLanguageConnectionCo TransactionController tran_for_drop = (in_xa_transaction ? null : getTransactionExecute()); - try + // in XA use nested user updatable transaction. Delay creating + // the transaction until loop below finds one it needs to + // process. + + for (int i=0; i