Return-Path: X-Original-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 636D892B1 for ; Fri, 2 Dec 2011 11:53:29 +0000 (UTC) Received: (qmail 3508 invoked by uid 500); 2 Dec 2011 11:53:29 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 3467 invoked by uid 500); 2 Dec 2011 11:53:29 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 3460 invoked by uid 99); 2 Dec 2011 11:53:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2011 11:53:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Fri, 02 Dec 2011 11:53:26 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 631B1238899C; Fri, 2 Dec 2011 11:53:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1209427 - in /incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database: DBInterfacePostgreSQL.java Database.java Date: Fri, 02 Dec 2011 11:53:04 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111202115304.631B1238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Fri Dec 2 11:53:03 2011 New Revision: 1209427 URL: http://svn.apache.org/viewvc?rev=1209427&view=rev Log: Rejigger transaction logging, as part of CONNECTORS-299. Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1209427&r1=1209426&r2=1209427&view=diff ============================================================================== --- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java (original) +++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java Fri Dec 2 11:53:03 2011 @@ -1131,7 +1131,14 @@ public class DBInterfacePostgreSQL exten protected void startATransaction() throws ManifoldCFException { - executeViaThread(connection,"START TRANSACTION",null,false,0,null,null); + try + { + executeViaThread(connection,"START TRANSACTION",null,false,0,null,null); + } + catch (ManifoldCFException e) + { + throw reinterpretException(e); + } } /** Abstract method to commit a transaction */ @@ -1153,7 +1160,14 @@ public class DBInterfacePostgreSQL exten protected void rollbackCurrentTransaction() throws ManifoldCFException { - executeViaThread(connection,"ROLLBACK",null,false,0,null,null); + try + { + executeViaThread(connection,"ROLLBACK",null,false,0,null,null); + } + catch (ManifoldCFException e) + { + throw reinterpretException(e); + } } /** Abstract method for explaining a query */ Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java?rev=1209427&r1=1209426&r2=1209427&view=diff ============================================================================== --- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java (original) +++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java Fri Dec 2 11:53:03 2011 @@ -290,9 +290,11 @@ public abstract class Database public void performCommit() throws ManifoldCFException { - Logging.db.debug("Committing transaction!"); + if (doRollback) + return; if (delayedTransactionDepth == 0) { + Logging.db.debug("Committing transaction!"); commitCurrentTransaction(); commitDone = true; } @@ -302,7 +304,6 @@ public abstract class Database */ public void signalRollback() { - Logging.db.debug("Rolling transaction back!"); doRollback = true; } @@ -333,14 +334,26 @@ public abstract class Database { // Do a rollback in the database, and blow away cached queries (cached against the // database transaction key). - rollbackCurrentTransaction(); + if (!commitDone) + { + Logging.db.debug("Rolling transaction back!"); + rollbackCurrentTransaction(); + } + else + { + doRollback = false; + throw new ManifoldCFException("Cannot roll back an already committed transaction"); + } } else { // Do a commit into the database, and blow away cached queries (cached against the // database transaction key). if (!commitDone) + { + Logging.db.debug("Committing transaction!"); commitCurrentTransaction(); + } } } catch (ManifoldCFException e) @@ -372,8 +385,11 @@ public abstract class Database { cacheManager.commitTransaction(th.getTransactionID()); } + + // Clear the signaling variables. This keeps them local to the transaction. commitDone = false; doRollback = false; + th = parentTransaction; if (th == null) {