Return-Path: X-Original-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 82C268387 for ; Tue, 30 Aug 2011 15:25:55 +0000 (UTC) Received: (qmail 38343 invoked by uid 500); 30 Aug 2011 15:25:55 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 38284 invoked by uid 500); 30 Aug 2011 15:25:54 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 38277 invoked by uid 99); 30 Aug 2011 15:25:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Aug 2011 15:25:54 +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; Tue, 30 Aug 2011 15:25:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 98BCA23889BB; Tue, 30 Aug 2011 15:25:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1163260 - in /incubator/lcf/trunk: CHANGES.txt framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java Date: Tue, 30 Aug 2011 15:25:32 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110830152532.98BCA23889BB@eris.apache.org> Author: kwright Date: Tue Aug 30 15:25:32 2011 New Revision: 1163260 URL: http://svn.apache.org/viewvc?rev=1163260&view=rev Log: Fix for CONNECTORS-244. Catch a deadlock condition that occurs on a query outside of a transaction on Derby (!). Modified: incubator/lcf/trunk/CHANGES.txt incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java Modified: incubator/lcf/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1163260&r1=1163259&r2=1163260&view=diff ============================================================================== --- incubator/lcf/trunk/CHANGES.txt (original) +++ incubator/lcf/trunk/CHANGES.txt Tue Aug 30 15:25:32 2011 @@ -3,6 +3,9 @@ $Id$ ======================= 0.3-dev ========================= +CONNECTORS-244: Add a fix to recover for another Derby deadlock situation. +(Karl Wright) + CONNECTORS-243: Include most response headers in the metadata for each web connector document. (Jan Høydahl, Karl Wright) Modified: incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java?rev=1163260&r1=1163259&r2=1163260&view=diff ============================================================================== --- incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java (original) +++ incubator/lcf/trunk/framework/agents/src/main/java/org/apache/manifoldcf/agents/incrementalingest/IncrementalIngester.java Tue Aug 30 15:25:32 2011 @@ -381,22 +381,49 @@ public class IncrementalIngester extends if (documentURI != null) documentURIHash = ManifoldCF.hash(documentURI); + String oldURI = null; + String oldURIHash = null; + String oldOutputVersion = null; + // See what uri was used before for this doc, if any ArrayList list = new ArrayList(); list.add(docKey); list.add(connection.getName()); - IResultSet set = performQuery("SELECT "+docURIField+","+uriHashField+","+lastOutputVersionField+" FROM "+getTableName()+ - " WHERE "+docKeyField+"=? AND "+outputConnNameField+"=?",list,null,null); - - String oldURI = null; - String oldURIHash = null; - String oldOutputVersion = null; - if (set.getRowCount() > 0) + + while (true) { - IResultRow row = set.getRow(0); - oldURI = (String)row.getValue(docURIField); - oldURIHash = (String)row.getValue(uriHashField); - oldOutputVersion = (String)row.getValue(lastOutputVersionField); + long sleepAmt = 0L; + try + { + IResultSet set = performQuery("SELECT "+docURIField+","+uriHashField+","+lastOutputVersionField+" FROM "+getTableName()+ + " WHERE "+docKeyField+"=? AND "+outputConnNameField+"=?",list,null,null); + + if (set.getRowCount() > 0) + { + IResultRow row = set.getRow(0); + oldURI = (String)row.getValue(docURIField); + oldURIHash = (String)row.getValue(uriHashField); + oldOutputVersion = (String)row.getValue(lastOutputVersionField); + } + + break; + } + catch (ManifoldCFException e) + { + // Look for deadlock and retry if so + if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT) + { + if (Logging.perf.isDebugEnabled()) + Logging.perf.debug("Aborted select looking for status: "+e.getMessage()); + sleepAmt = getSleepAmt(); + continue; + } + throw e; + } + finally + { + sleepFor(sleepAmt); + } } // If uri hashes collide, then we must be sure to eliminate only the *correct* records from the table, or we will leave