You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/10/25 13:26:25 UTC

svn commit: r588202 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/conn/ testing/org/apache/derbyTesting/functionTests/master/

Author: kahatlen
Date: Thu Oct 25 04:26:24 2007
New Revision: 588202

URL: http://svn.apache.org/viewvc?rev=588202&view=rev
Log:
DERBY-3093: Intermittent transaction failure caused by internal duplicate savepoint name for triggers

Use LanguageConnectionContext.getUniqueSavepointName() to get a name
that is unique within the transaction instead of a globally unique
name. This removes a global synchronization point.

Contributed by James F. Adams.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_JSR169.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_XA.out

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java?rev=588202&r1=588201&r2=588202&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericStatementContext.java Thu Oct 25 04:26:24 2007
@@ -96,9 +96,6 @@
 	*/
 	private short			sqlAllowed = -1;
 
-    // Counter used to create unique savepoint names.
-    private static long nextNameId = Long.MIN_VALUE;
-
 	/*
 	   constructor
 		@param tc transaction
@@ -108,25 +105,14 @@
 		super(lcc.getContextManager(), org.apache.derby.iapi.reference.ContextId.LANG_STATEMENT);
 		this.lcc = lcc;
 
-        internalSavePointName = createInternalSavepointName();
-
 		if (SanityManager.DEBUG)
 		{
 			SanityManager.ASSERT((lcc != null),
 					"Failed to get language connection context");
 		}
 
+        internalSavePointName = lcc.getUniqueSavepointName();
 	}
-
-    /**
-     * Generate a unique name for this savepoint.
-     * This method should only be called from the constructor.
-     *
-     * @return the savepoint name.
-     */
-    private synchronized static String createInternalSavepointName() {
-        return "ISSP" + nextNameId++;
-    }
 
     /**
      * This is a TimerTask that is responsible for timing out statements,

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_JSR169.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_JSR169.out?rev=588202&r1=588201&r2=588202&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_JSR169.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_JSR169.out Thu Oct 25 04:26:24 2007
@@ -79,8 +79,8 @@
 Test41b - Rollback to a savepoint, then try to rollback savepoint created after that savepoint
 Expected Exception is SAVEPOINT, s2 does not  exist or is not active in the current transaction.
 Test42 - Rollback/commit the transaction, then try to use savepoint from that transaction
-Expected Exception is SAVEPOINT, SAVEPT5 does not  exist or is not active in the current transaction.
 Expected Exception is SAVEPOINT, SAVEPT6 does not  exist or is not active in the current transaction.
+Expected Exception is SAVEPOINT, SAVEPT7 does not  exist or is not active in the current transaction.
 Test43 - Release and reuse a savepoint name
 Expected Exception is A SAVEPOINT with the passed name already exists in the current transaction.
 Test 45 reuse savepoint name after rollback - should not work
@@ -91,11 +91,11 @@
 Expected Exception is ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.
 Expected Exception is ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.
 Test 47 multiple tests for getSavepointId()
-8
 9
 10
 11
 12
+13
 Test 48 No nested SQL savepoints allowed.
 Following SQL savepoint will fail because we are trying to nest it inside JDBC savepoint
 Expected Exception is The maximum number of savepoints has been reached. 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_XA.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_XA.out?rev=588202&r1=588201&r2=588202&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_XA.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/savepointJdbc30_XA.out Thu Oct 25 04:26:24 2007
@@ -78,8 +78,8 @@
 Test41b - Rollback to a savepoint, then try to rollback savepoint created after that savepoint
 Expected Exception is SAVEPOINT, s2 does not  exist or is not active in the current transaction.
 Test42 - Rollback/commit the transaction, then try to use savepoint from that transaction
-Expected Exception is SAVEPOINT, SAVEPT5 does not  exist or is not active in the current transaction.
 Expected Exception is SAVEPOINT, SAVEPT6 does not  exist or is not active in the current transaction.
+Expected Exception is SAVEPOINT, SAVEPT7 does not  exist or is not active in the current transaction.
 Test43 - Release and reuse a savepoint name
 Expected Exception is A SAVEPOINT with the passed name already exists in the current transaction.
 Test 45 reuse savepoint name after rollback - should not work
@@ -90,11 +90,11 @@
 Expected Exception is ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.
 Expected Exception is ResultSet not open. Operation 'next' not permitted. Verify that autocommit is OFF.
 Test 47 multiple tests for getSavepointId()
-8
 9
 10
 11
 12
+13
 Test 48 No nested SQL savepoints allowed.
 Following SQL savepoint will fail because we are trying to nest it inside JDBC savepoint
 Expected Exception is The maximum number of savepoints has been reached.