manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1496050 - in /manifoldcf/trunk: CHANGES.txt framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
Date Mon, 24 Jun 2013 13:35:27 GMT
Author: kwright
Date: Mon Jun 24 13:35:26 2013
New Revision: 1496050

URL: http://svn.apache.org/r1496050
Log:
Fix for CONNECTORS-734.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1496050&r1=1496049&r2=1496050&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Jun 24 13:35:26 2013
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.3-dev =====================
 
+CONNECTORS-734: Catch deadlock error with EXPLAIN ANALYZE in
+postgresql, and ignore it.
+(Ahmet Arslan, Karl Wright)
+
 CONNECTORS-732: Fix crawler-ui's message for 'Waiting' job status.
 (Ahmet Arslan)
 

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1496050&r1=1496049&r2=1496050&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
Mon Jun 24 13:35:26 2013
@@ -1227,19 +1227,36 @@ public class DBInterfacePostgreSQL exten
   protected void explainQuery(String query, List params)
     throws ManifoldCFException
   {
-    String queryType = "EXPLAIN ";
-    if ("SELECT".equalsIgnoreCase(query.substring(0,6)))
-      queryType += "ANALYZE ";
-    IResultSet x = executeUncachedQuery(queryType+query,params,true,
-      -1,null,null);
-    for (int k = 0; k < x.getRowCount(); k++)
-    {
-      IResultRow row = x.getRow(k);
-      Iterator<String> iter = row.getColumns();
-      String colName = (String)iter.next();
-      Logging.db.warn(" Plan: "+row.getValue(colName).toString());
+    // We really can't retry at this level; it's not clear what the transaction nesting is
etc.
+    // So if the EXPLAIN fails due to deadlock, we just give up.
+    IResultSet x;
+    try
+    {
+      String queryType = "EXPLAIN ";
+      if ("SELECT".equalsIgnoreCase(query.substring(0,6)))
+        queryType += "ANALYZE ";
+      x = executeUncachedQuery(queryType+query,params,true,
+        -1,null,null);
+      for (int k = 0; k < x.getRowCount(); k++)
+      {
+        IResultRow row = x.getRow(k);
+        Iterator<String> iter = row.getColumns();
+        String colName = (String)iter.next();
+        Logging.db.warn(" Plan: "+row.getValue(colName).toString());
+      }
+      Logging.db.warn("");
     }
-    Logging.db.warn("");
+    catch (ManifoldCFException e)
+    {
+      if (e.getErrorCode() == e.DATABASE_TRANSACTION_ABORT)
+      {
+        if (Logging.perf.isDebugEnabled())
+          Logging.perf.debug("Aborted transaction generating EXPLAIN: "+e.getMessage());
+      }
+      else
+        throw e;
+    }
+
     if (query.indexOf("jobqueue") != -1)
     {
       // Dump jobqueue stats



Mime
View raw message