[jboss-svn-commits] JBL Code SVN: r24577 - in labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa: JDBCResources02Setups and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jan 7 09:03:54 EST 2009


Author: jhalliday
Date: 2009-01-07 09:03:54 -0500 (Wed, 07 Jan 2009)
New Revision: 24577

Modified:
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources01Setups/Setup02.java
   labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources02Setups/Setup02.java
Log:
Fix to force row level locking on sybase JDBC tests. JBTM-460


Modified: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources01Setups/Setup02.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources01Setups/Setup02.java	2009-01-07 13:12:11 UTC (rev 24576)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources01Setups/Setup02.java	2009-01-07 14:03:54 UTC (rev 24577)
@@ -45,6 +45,8 @@
 {
 	public static void main(String[] args)
 	{
+        boolean useSybaseLockingHack = false;
+
 		boolean passed = true;
 
 		try
@@ -59,6 +61,10 @@
 			{
 				String driver = JDBCProfileStore.driver(profileName, index);
 
+                if(driver.contains(".sybase.")) {
+                    useSybaseLockingHack = true;
+                }
+
 				Class.forName(driver);
 			}
 
@@ -110,6 +116,15 @@
 			statement.executeUpdate("CREATE UNIQUE INDEX " + databaseUser + "_IT_Ind " +
 					"ON " + databaseUser + "_InfoTable (Name) ");
 
+            // sybase uses coarse grained locking by default and XA tx branches appear to be loose coupled i.e. do not share locks.
+            // Unlike MSSQL, the presence of an index is not enough to cause the db to use row level locking. We need to configure
+            // it explicitly instead. Without this the tests that use more than one server i.e. db conn/branch may block.
+            if(useSybaseLockingHack) {
+                // force use of row level locking
+                System.err.println("configuring sybase row level locking: ALTER TABLE " + databaseUser + "_InfoTable lock datarows");
+                statement.executeUpdate("ALTER TABLE " + databaseUser + "_InfoTable lock datarows");
+            }
+
 			for (int index = 0; index < 10; index++)
 			{
 				String name = "Name_" + index;

Modified: labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources02Setups/Setup02.java
===================================================================
--- labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources02Setups/Setup02.java	2009-01-07 13:12:11 UTC (rev 24576)
+++ labs/jbosstm/trunk/qa/tests/src/org/jboss/jbossts/qa/JDBCResources02Setups/Setup02.java	2009-01-07 14:03:54 UTC (rev 24577)
@@ -45,6 +45,8 @@
 {
 	public static void main(String[] args)
 	{
+        boolean useSybaseLockingHack = false;
+
 		boolean passed = true;
 
 		try
@@ -59,6 +61,10 @@
 			{
 				String driver = JDBCProfileStore.driver(profileName, index);
 
+                if(driver.contains(".sybase.")) {
+                    useSybaseLockingHack = true;
+                }
+
 				Class.forName(driver);
 			}
 
@@ -109,7 +115,16 @@
 			statement.executeUpdate("CREATE UNIQUE INDEX " + databaseUser + "_IT_Ind " +
 					"ON " + databaseUser + "_InfoTable (Name) ");
 
-			for (int index = 0; index < 10; index++)
+            // sybase uses coarse grained locking by default and XA tx branches appear to be loose coupled i.e. do not share locks.
+            // Unlike MSSQL, the presence of an index is not enough to cause the db to use row level locking. We need to configure
+            // it explicitly instead. Without this the tests that use more than one server i.e. db conn/branch may block.
+            if(useSybaseLockingHack) {
+                // force use of row level locking
+                System.err.println("configuring sybase row level locking: ALTER TABLE " + databaseUser + "_InfoTable lock datarows");
+                statement.executeUpdate("ALTER TABLE " + databaseUser + "_InfoTable lock datarows");
+            }
+
+            for (int index = 0; index < 10; index++)
 			{
 				String name = "Name_" + index;
 				String value = "Value_" + index;




More information about the jboss-svn-commits mailing list