manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1189602 - /incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Date Thu, 27 Oct 2011 04:15:32 GMT
Author: kwright
Date: Thu Oct 27 04:15:32 2011
New Revision: 1189602

URL: http://svn.apache.org/viewvc?rev=1189602&view=rev
Log:
More changes designed to get the indexes and the queries to line up for HSQLDB.

Modified:
    incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java

Modified: incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1189602&r1=1189601&r2=1189602&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
(original)
+++ incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Thu Oct 27 04:15:32 2011
@@ -1465,10 +1465,9 @@ public class JobManager implements IJobM
       .append(" FROM ").append(jobQueue.getTableName()).append(" t0 WHERE EXISTS(SELECT 'x'
FROM ").append(jobs.getTableName())
       .append(" t1 WHERE t0.").append(jobQueue.jobIDField).append("=t1.").append(jobs.idField).append("
AND t1.")
       .append(jobs.statusField).append(" IN(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)) AND ")
-      .append(jobQueue.prioritySetField).append("<? AND ").append(jobQueue.statusField).append("
IN(?,?) AND (")
-      .append(jobQueue.checkActionField).append(" IS NULL OR ")
-      .append(jobQueue.checkActionField).append("=?")
-      .append(") ").append(database.constructOffsetLimitClause(0,n));
+      .append(jobQueue.prioritySetField).append("<? AND ").append(jobQueue.statusField).append("
IN(?,?) AND ")
+      .append(jobQueue.checkActionField).append("=? ")
+      .append(database.constructOffsetLimitClause(0,n));
 
     // Analyze jobqueue tables unconditionally, since it's become much more sensitive in
8.3 than it used to be.
     jobQueue.unconditionallyAnalyzeTables();
@@ -5873,25 +5872,15 @@ public class JobManager implements IJobM
           list.clear();
           list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
 
           IResultSet confirmSet = database.performQuery("SELECT "+jobQueue.idField+" FROM
"+
             jobQueue.getTableName()+" WHERE "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
+            jobQueue.jobIDField+"=? AND "+jobQueue.statusField+" IN (?,?,?,?,?,?)  "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
 
           if (confirmSet.getRowCount() > 0)
             continue;
@@ -6025,19 +6014,13 @@ public class JobManager implements IJobM
           list.clear();
           list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
 
           IResultSet confirmSet = database.performQuery("SELECT "+jobQueue.idField+" FROM
"+
             jobQueue.getTableName()+" WHERE "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
+            jobQueue.jobIDField+"=? AND "+jobQueue.statusField+" IN (?,?,?,?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
 
           if (confirmSet.getRowCount() > 0)
             continue;
@@ -6136,13 +6119,11 @@ public class JobManager implements IJobM
           list.clear();
           list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_PURGATORY));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGCLEANED));
 
           IResultSet confirmSet = database.performQuery("SELECT "+jobQueue.idField+" FROM
"+
             jobQueue.getTableName()+" WHERE "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
+            jobQueue.jobIDField+"=? AND "+jobQueue.statusField+" IN (?,?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
 
           if (confirmSet.getRowCount() > 0)
             continue;
@@ -6152,13 +6133,11 @@ public class JobManager implements IJobM
           list.clear();
           list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
-          list.add(jobID);
           list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
 
           confirmSet = database.performQuery("SELECT "+jobQueue.idField+" FROM "+
             jobQueue.getTableName()+" WHERE "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) OR "+
-            "("+jobQueue.jobIDField+"=? AND "+jobQueue.statusField+"=?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
+            jobQueue.jobIDField+"=? AND "+jobQueue.statusField+" IN (?,?) "+database.constructOffsetLimitClause(0,1),list,null,null,1,null);
 
           if (confirmSet.getRowCount() > 0)
           {
@@ -6556,68 +6535,48 @@ public class JobManager implements IJobM
       .append(" END AS state,")
       .append("CASE")
       .append(" WHEN ")
-      .append("(").append("t0.").append(jobQueue.statusField).append("=? OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Inactive'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
-      .append(" AND (t0.").append(jobQueue.checkActionField).append(" IS NULL OR t0.").append(jobQueue.checkActionField).append("=?)")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append("t0.").append(jobQueue.checkActionField).append("=?")
+      .append(" AND t0.").append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Ready for processing'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
-      .append(" AND t0.").append(jobQueue.checkActionField).append("=?")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append("t0.").append(jobQueue.checkActionField).append("=?")
+      .append(" AND t0.").append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Ready for expiration'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
-      .append(" AND (t0.").append(jobQueue.checkActionField).append(" IS NULL OR t0.").append(jobQueue.checkActionField).append("=?)")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append("t0.").append(jobQueue.checkActionField).append("=?")
+      .append(" AND t0.").append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Waiting for processing'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
-      .append(" AND t0.").append(jobQueue.checkActionField).append("=?")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append("t0.").append(jobQueue.checkActionField).append("=?")
+      .append(" AND t0.").append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Waiting for expiration'")
       .append(" WHEN ")
       .append("t0.").append(jobQueue.checkTimeField).append(" IS NULL")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Waiting forever'")
-      .append(" WHEN ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
+      .append(" WHEN ").append("t0.").append(jobQueue.statusField).append(" IN (?,?,?)")
       .append(" THEN 'Deleting'")
       .append(" WHEN ")
-      .append("(t0.").append(jobQueue.checkActionField).append(" IS NULL OR t0.").append(jobQueue.checkActionField).append("=?)")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append("t0.").append(jobQueue.checkActionField).append("=?")
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?,?,?)")
       .append(" THEN 'Processing'")
       .append(" WHEN ")
       .append("t0.").append(jobQueue.checkActionField).append("=?")
-      .append(" AND (").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append("t0.").append(jobQueue.statusField).append("=?")
+      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?,?,?)")
       .append(")")
       .append(" THEN 'Expiring'")
       .append(" ELSE 'Unknown'")
       .append(" END AS status,")
       .append("t0.").append(jobQueue.checkTimeField).append(" AS scheduled,")
       .append("CASE")
-      .append(" WHEN ").append("(t0.").append(jobQueue.checkActionField).append(" IS NULL
OR t0.").append(jobQueue.checkActionField).append("=?) THEN 'Process'")
+      .append(" WHEN ").append("t0.").append(jobQueue.checkActionField).append("=? THEN 'Process'")
       .append(" WHEN ").append("t0.").append(jobQueue.checkActionField).append("=? THEN 'Expire'")
       .append(" ELSE 'Unknown'")
       .append(" END AS action,")
@@ -6703,88 +6662,66 @@ public class JobManager implements IJobM
     sb.append(" AS idbucket,")
       .append("CASE")
       .append(" WHEN ")
-      .append("(").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" AS inactive,")
       .append("CASE")
       .append(" WHEN ")
-      .append("(").append(jobQueue.checkActionField).append(" IS NULL OR ").append(jobQueue.checkActionField).append("=?)")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(jobQueue.checkActionField).append("=?")
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?,?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as processing,")
       .append("CASE")
       .append(" WHEN ")
       .append(jobQueue.checkActionField).append("=?")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?,?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as expiring,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
+      .append(jobQueue.statusField).append(" IN (?,?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as deleting,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
-      .append(" AND (").append(jobQueue.checkActionField).append(" IS NULL OR ").append(jobQueue.checkActionField).append("=?)")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(jobQueue.checkActionField).append("=?")
+      .append(" AND ").append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as processready,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
-      .append(" AND ").append(jobQueue.checkActionField).append("=?")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(jobQueue.checkActionField).append("=?")
+      .append(" AND ").append(jobQueue.checkTimeField).append("<=").append(currentTime.toString())
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as expireready,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
-      .append(" AND (").append(jobQueue.checkActionField).append(" IS NULL OR ").append(jobQueue.checkActionField).append("=?)")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(jobQueue.checkActionField).append("=?")
+      .append(" AND ").append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as processwaiting,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
-      .append(" AND ").append(jobQueue.checkActionField).append("=?")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(jobQueue.checkActionField).append("=?")
+      .append(" AND ").append(jobQueue.checkTimeField).append(">").append(currentTime.toString())
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as expirewaiting,")
       .append("CASE")
       .append(" WHEN ")
       .append(jobQueue.checkTimeField).append(" IS NULL")
-      .append(" AND (").append(jobQueue.statusField).append("=?")
-      .append(" OR ").append(jobQueue.statusField).append("=?")
-      .append(")")
+      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as waitingforever");
@@ -6910,7 +6847,7 @@ public class JobManager implements IJobM
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
-        sb.append("(").append(fieldPrefix).append(jobQueue.checkActionField).append(" IS
NULL OR ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?)")
+        sb.append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
           .append(" AND ").append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?,?,?)");
         break;
       case DOCSTATUS_EXPIRING:
@@ -6932,7 +6869,7 @@ public class JobManager implements IJobM
         list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
-        sb.append("(").append(fieldPrefix).append(jobQueue.checkActionField).append(" IS
NULL OR ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?)")
+        sb.append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
           .append(" AND ").append(fieldPrefix).append(jobQueue.checkTimeField).append("<=").append(nowTime.toString())
           .append(" AND ").append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)");
         break;
@@ -6948,7 +6885,7 @@ public class JobManager implements IJobM
         list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
-          sb.append("(").append(fieldPrefix).append(jobQueue.checkActionField).append(" IS
NULL OR ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?)")
+          sb.append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
           .append(" AND ").append(fieldPrefix).append(jobQueue.checkTimeField).append(">").append(nowTime.toString())
           .append(" AND ").append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)");
         break;



Mime
View raw message