db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r409002 - in /db/derby/code/trunk/java: engine/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/
Date Tue, 23 May 2006 20:29:48 GMT
Author: kmarsden
Date: Tue May 23 13:29:47 2006
New Revision: 409002

URL: http://svn.apache.org/viewvc?rev=409002&view=rev
Log:
DERBY-1325 Isolation level of local connection does not get reset after exiting a global transaction
if the isolation level was changed using SQL

Attaching a patch 'derby-1325-v1.diff' which ensures correct isolation level gets used once
we switch back to local mode when SQL is used to set the isolation level.

Patch does the following:

* Adds call to get the isolation level up to date when joining/resuming a global transaction.
This will make sure the BrokeredConnection object has the correct isolation level to be used
when we switch back to local mode.

* Adds a test to jdbcapi/checkDataSource.java and modifies the master files.

With this patch, I ran derbyall with Sun jdk 1.4.2 on Windows XP. No failures. 


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java?rev=409002&r1=409001&r2=409002&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java Tue May 23
13:29:47 2006
@@ -631,6 +631,21 @@
                         if (!con.realConnection.transactionIsIdle())
                             throw new XAException(XAException.XAER_OUTSIDE);
                         
+                        // We need to get the isolation level up to date same 
+                        // way as it is done at start of a transaction. Before
+                        // joining the transaction, it is possible that the 
+                        // isolation level was updated using SQL. We need to 
+                        // get this state and store in the connection handle so 
+                        // that we can restore the isolation when we are in the 
+                        // local mode.
+                        try {
+	                    	if (con.currentConnectionHandle != null) {
+	                    		con.currentConnectionHandle.getIsolationUptoDate();
+	                    	}
+                    	} catch (SQLException sqle) {
+                            throw wrapInXAException(sqle);
+                        }
+                        
                         closeUnusedConnection(con.realConnection);
                     }
                     con.realConnection = tranState.conn;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out?rev=409002&r1=409001&r2=409002&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
Tue May 23 13:29:47 2006
@@ -359,6 +359,14 @@
   isolation level REPEATABLE_READ
   auto commit     true
   read only       false
+1st global(existing)
+  isolation level SERIALIZABLE
+  auto commit     false
+  read only       false
+local
+  isolation level REPEATABLE_READ
+  auto commit     true
+  read only       false
 2nd global(new)
   isolation level REPEATABLE_READ
   auto commit     false

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out?rev=409002&r1=409001&r2=409002&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
Tue May 23 13:29:47 2006
@@ -441,6 +441,16 @@
   isolation level REPEATABLE_READ
   auto commit     true
   read only       false
+1st global(existing)
+  holdability     false
+  isolation level SERIALIZABLE
+  auto commit     false
+  read only       false
+local
+  holdability     true
+  isolation level REPEATABLE_READ
+  auto commit     true
+  read only       false
 2nd global(new)
   holdability     false
   isolation level REPEATABLE_READ

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=409002&r1=409001&r2=409002&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Tue May 23 13:29:47 2006
@@ -730,7 +730,16 @@
 		System.out.println("Issue SQL to change isolation in local transaction");
 			s.executeUpdate("set current isolation = RS");
 			printState("SQL to change isolation in local", conn);
-
+			
+			// DERBY-1325 - Isolation level of local connection does not get reset after ending 
+			// a global transaction that was joined/resumed if the isolation level was changed 
+			// using SQL 
+			xar.start(xid, XAResource.TMJOIN);
+			printState("1st global(existing)", conn);
+			xar.end(xid, XAResource.TMSUCCESS);
+			printState("local", conn);
+			// DERBY-1325 end test 
+			
 			Xid xid2 = new cdsXid(1, (byte) 93, (byte) 103);
 			xar.start(xid2, XAResource.TMNOFLAGS);
 			printState("2nd global(new)", conn);



Mime
View raw message