db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1365661 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Date Wed, 25 Jul 2012 16:37:54 GMT
Author: kristwaa
Date: Wed Jul 25 16:37:54 2012
New Revision: 1365661

URL: http://svn.apache.org/viewvc?rev=1365661&view=rev
Log:
DERBY-4279: Statement cache deadlock 

Modified ResultColumnList.generateHolderMethod to only take a lock when
obtaining row template(s) if the data dictionary is in DDL_MODE. The lock that
used to be obtained was a CIS lock/latch.
The purpose of this change is to avoid the deadlocks that have been observed in
some scenarios when statements are being compiled or recompiled.

Patch contributed by Brett Wooldridge (brett dot wooldridge at gmail dot com).

Patch file: patch4279_2.txt

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=1365661&r1=1365660&r2=1365661&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Wed Jul 25 16:37:54 2012
@@ -1634,13 +1634,19 @@ public class ResultColumnList extends Qu
 				int savedItem;
 				RowLocation rl;
 				
-				cc = getLanguageConnectionContext().
-						getTransactionCompile().openConglomerate(
-							conglomerateId,
-                            false,
-							0,
-							TransactionController.MODE_RECORD,
-							TransactionController.ISOLATION_READ_COMMITTED);
+				LanguageConnectionContext lcc = getLanguageConnectionContext();
+				DataDictionary dd = lcc.getDataDictionary();
+				
+				int isolationLevel = (dd.getCacheMode() == DataDictionary.DDL_MODE) ? 
+						TransactionController.ISOLATION_READ_COMMITTED : TransactionController.ISOLATION_NOLOCK;
+
+				cc = lcc.getTransactionCompile().openConglomerate(
+						conglomerateId,
+                        false,
+						0,
+						TransactionController.MODE_RECORD,
+						isolationLevel);
+
 				try
 				{
 					rl = cc.newRowLocationTemplate();



Mime
View raw message