Author: kmarsden
Date: Thu May 25 12:22:20 2006
New Revision: 409438
URL: http://svn.apache.org/viewvc?rev=409438&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
Committing patch 'derby-1325-10.1.diff' which ports this fix to 10.1 branch.
Contributed by Deepa Remesh
Modified:
db/derby/code/branches/10.1/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java?rev=409438&r1=409437&r2=409438&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/jdbc/EmbedXAConnection.java Thu
May 25 12:22:20 2006
@@ -205,6 +205,21 @@
if (!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 (currentConnectionHandle != null) {
+ currentConnectionHandle.getIsolationUptoDate();
+ }
+ } catch (SQLException sqle) {
+ throw wrapInXAException(sqle);
+ }
closeUnusedConnection(realConnection);
}
Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out?rev=409438&r1=409437&r2=409438&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
Thu May 25 12:22:20 2006
@@ -345,6 +345,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/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out?rev=409438&r1=409437&r2=409438&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
Thu May 25 12:22:20 2006
@@ -421,6 +421,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/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=409438&r1=409437&r2=409438&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Thu May 25 12:22:20 2006
@@ -359,7 +359,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", cs1);
-
+
+ // 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)", cs1);
+ xar.end(xid, XAResource.TMSUCCESS);
+ printState("local", cs1);
+ // DERBY-1325 end test
+
Xid xid2 = new cdsXid(1, (byte) 93, (byte) 103);
xar.start(xid2, XAResource.TMNOFLAGS);
printState("2nd global(new)", cs1);
|