Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE286C5A3 for ; Wed, 25 Jul 2012 16:38:39 +0000 (UTC) Received: (qmail 34403 invoked by uid 500); 25 Jul 2012 16:38:39 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 34111 invoked by uid 500); 25 Jul 2012 16:38:39 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 34094 invoked by uid 99); 25 Jul 2012 16:38:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jul 2012 16:38:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jul 2012 16:38:38 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9873F23888CD; Wed, 25 Jul 2012 16:37:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120725163754.9873F23888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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();