incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1190232 - in /incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs: JobManager.java JobQueue.java
Date Fri, 28 Oct 2011 10:21:52 GMT
Author: kwright
Date: Fri Oct 28 10:21:52 2011
New Revision: 1190232

URL: http://svn.apache.org/viewvc?rev=1190232&view=rev
Log:
Rejigger jobqueue indexes to drop one and reorder another.  This lines up better with HSQLDB
usage constraints.

Modified:
    incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
    incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobQueue.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=1190232&r1=1190231&r2=1190232&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
Fri Oct 28 10:21:52 2011
@@ -1598,11 +1598,10 @@ public class JobManager implements IJobM
     // If FOR UPDATE was included, deadlock conditions would be common because of the complexity
of this query.
 
     ArrayList list = new ArrayList();
-    list.add(new Long(currentTime));
-    list.add(jobQueue.actionToString(JobQueue.ACTION_REMOVE));
-
     list.add(jobQueue.statusToString(JobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(JobQueue.ACTION_REMOVE));
+    list.add(new Long(currentTime));
 
     list.add(jobs.statusToString(jobs.STATUS_ACTIVE));
     list.add(jobs.statusToString(jobs.STATUS_ACTIVESEEDING));
@@ -1622,10 +1621,11 @@ public class JobManager implements IJobM
     sb.append(jobQueue.statusField).append(",t0.");
     sb.append(jobQueue.failTimeField).append(",t0.");
     sb.append(jobQueue.failCountField).append(" FROM ").append(jobQueue.getTableName()).append("
t0,")
-      .append(jobs.getTableName()).append(" t1 WHERE t0.");
-    sb.append(jobQueue.checkTimeField).append("<=? AND t0.");
-    sb.append(jobQueue.checkActionField).append("=? AND ");
-    sb.append("t0.").append(jobQueue.statusField).append(" IN(?,?) AND t0.").append(jobQueue.jobIDField).append("=t1.").append(jobs.idField).append("
AND t1.")
+      .append(jobs.getTableName()).append(" t1 WHERE ")
+      .append("t0.").append(jobQueue.statusField).append(" IN(?,?) AND ")
+      .append("t0.").append(jobQueue.checkActionField).append("=? AND ")
+      .append("t0.").append(jobQueue.checkTimeField).append("<=? AND ")
+      .append("t0.").append(jobQueue.jobIDField).append("=t1.").append(jobs.idField).append("
AND t1.")
       .append(jobs.statusField).append(" IN (?,?) AND ");
     sb.append("NOT EXISTS(SELECT 'x' FROM ").append(jobQueue.getTableName()).append(" t2
WHERE t0.")
       .append(jobQueue.docHashField).append("=t2.").append(jobQueue.docHashField).append("
AND t0.")
@@ -2060,21 +2060,21 @@ public class JobManager implements IJobM
     list.add(Jobs.statusToString(jobs.STATUS_ACTIVE));
     list.add(Jobs.statusToString(jobs.STATUS_ACTIVESEEDING));
     
+    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDING));
+    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY));
+    
     list.add(jobQueue.actionToString(JobQueue.ACTION_RESCAN));
     
     list.add(currentTimeValue);
         
-    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDING));
-    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY));
-    
     sb.append(jobQueue.docPriorityField).append(",").append(jobQueue.jobIDField).append(",")
       .append(jobQueue.docHashField).append(",").append(jobQueue.docIDField)
       .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.statusField).append(" IN(?,?) AND ")
       .append(jobQueue.checkActionField).append("=? AND ")
-      .append(jobQueue.checkTimeField).append("<=? AND ")
-      .append(jobQueue.statusField).append(" IN(?,?)")
+      .append(jobQueue.checkTimeField).append("<=?")
       .append(" ORDER BY ").append(jobQueue.docPriorityField).append(" ASC ").append(database.constructOffsetLimitClause(0,1));
 
 
@@ -2119,13 +2119,13 @@ public class JobManager implements IJobM
     
     list.add(currentPriorityValue);
 
+    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDING));
+    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY));
+    
     list.add(jobQueue.actionToString(JobQueue.ACTION_RESCAN));
 
     list.add(currentTimeValue);
     
-    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDING));
-    list.add(jobQueue.statusToString(JobQueue.STATUS_PENDINGPURGATORY));
-    
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
@@ -2133,9 +2133,9 @@ public class JobManager implements IJobM
     list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGDELETED));
     list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGCLEANED));
     
-    sb.append("t0.").append(jobQueue.checkActionField).append("=? AND ")
-      .append("t0.").append(jobQueue.checkTimeField).append("<=? AND ")
-      .append("t0.").append(jobQueue.statusField).append(" IN (?,?) AND ");
+    sb.append("t0.").append(jobQueue.statusField).append(" IN (?,?) AND ")
+      .append("t0.").append(jobQueue.checkActionField).append("=? AND ")
+      .append("t0.").append(jobQueue.checkTimeField).append("<=? AND ");
       
     sb.append("NOT EXISTS(SELECT 'x' FROM ").append(jobQueue.getTableName()).append(" t2
WHERE t0.")
       .append(jobQueue.docHashField).append("=t2.").append(jobQueue.docHashField).append("
AND t0.")
@@ -6478,21 +6478,21 @@ public class JobManager implements IJobM
     list.add(jobQueue.statusToString(jobQueue.STATUS_COMPLETE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PURGATORY));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
@@ -6501,17 +6501,17 @@ public class JobManager implements IJobM
     list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGCLEANED));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ELIGIBLEFORDELETE));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     
     list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
@@ -6538,38 +6538,38 @@ public class JobManager implements IJobM
       .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
       .append(" THEN 'Inactive'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkActionField).append("=?")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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.checkActionField).append("=?")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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.checkActionField).append("=?")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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.checkActionField).append("=?")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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(" IN (?,?)")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").append("t0.").append(jobQueue.checkTimeField).append(" IS NULL")
       .append(" THEN 'Waiting forever'")
       .append(" WHEN ").append("t0.").append(jobQueue.statusField).append(" IN (?,?,?)")
       .append(" THEN 'Deleting'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkActionField).append("=?")
-      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append(" AND ").append("t0.").append(jobQueue.checkActionField).append("=?")
       .append(" THEN 'Processing'")
       .append(" WHEN ")
-      .append("t0.").append(jobQueue.checkActionField).append("=?")
-      .append(" AND ").append("t0.").append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append("t0.").append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append(" AND ").append("t0.").append(jobQueue.checkActionField).append("=?")
       .append(")")
       .append(" THEN 'Expiring'")
       .append(" ELSE 'Unknown'")
@@ -6625,37 +6625,37 @@ public class JobManager implements IJobM
     list.add(jobQueue.statusToString(jobQueue.STATUS_COMPLETE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PURGATORY));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     
     list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGDELETED));
     list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGCLEANED));
     list.add(jobQueue.statusToString(jobQueue.STATUS_ELIGIBLEFORDELETE));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
     
-    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
+    list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
     
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
     list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
@@ -6668,15 +6668,15 @@ public class JobManager implements IJobM
       .append(" AS inactive,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkActionField).append("=?")
-      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append(" AND ").append(jobQueue.checkActionField).append("=?")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as processing,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkActionField).append("=?")
-      .append(" AND ").append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append(jobQueue.statusField).append(" IN (?,?,?,?)")
+      .append(" AND ").append(jobQueue.checkActionField).append("=?")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as expiring,")
@@ -6688,40 +6688,40 @@ public class JobManager implements IJobM
       .append(" as deleting,")
       .append("CASE")
       .append(" WHEN ")
-      .append(jobQueue.checkActionField).append("=?")
+      .append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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.checkActionField).append("=?")
+      .append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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.checkActionField).append("=?")
+      .append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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.checkActionField).append("=?")
+      .append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").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(" IN (?,?)")
+      .append(jobQueue.statusField).append(" IN (?,?)")
+      .append(" AND ").append(jobQueue.checkTimeField).append(" IS NULL")
       .append(" THEN 1 ELSE 0")
       .append(" END")
       .append(" as waitingforever");
@@ -6842,22 +6842,22 @@ public class JobManager implements IJobM
         sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)");
         break;
       case DOCSTATUS_PROCESSING:
-        list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
-        sb.append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
-          .append(" AND ").append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?,?,?)");
+        list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
+        sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?,?,?)")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?");
         break;
       case DOCSTATUS_EXPIRING:
-        list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVE));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVEPURGATORY));
         list.add(jobQueue.statusToString(jobQueue.STATUS_ACTIVENEEDRESCANPURGATORY));
-        sb.append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
-          .append(" AND ").append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?,?,?)");
+        list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
+        sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?,?,?)")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?");
         break;
       case DOCSTATUS_DELETING:
         list.add(jobQueue.statusToString(jobQueue.STATUS_BEINGDELETED));
@@ -6866,36 +6866,36 @@ public class JobManager implements IJobM
         sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?,?)");
         break;
       case DOCSTATUS_READYFORPROCESSING:
-        list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
-        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 (?,?)");
+        list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
+        sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkTimeField).append("<=").append(nowTime.toString());
         break;
       case DOCSTATUS_READYFOREXPIRATION:
-        list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
-        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 (?,?)");
+        list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
+        sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkTimeField).append("<=").append(nowTime.toString());
         break;
       case DOCSTATUS_WAITINGFORPROCESSING:
-        list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
-          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 (?,?)");
+        list.add(jobQueue.actionToString(jobQueue.ACTION_RESCAN));
+        sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkTimeField).append(">").append(nowTime.toString());
         break;
       case DOCSTATUS_WAITINGFOREXPIRATION:
-        list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDINGPURGATORY));
-          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 (?,?)");
+        list.add(jobQueue.actionToString(jobQueue.ACTION_REMOVE));
+        sb.append(fieldPrefix).append(jobQueue.statusField).append(" IN (?,?)")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkActionField).append("=?")
+          .append(" AND ").append(fieldPrefix).append(jobQueue.checkTimeField).append(">").append(nowTime.toString());
         break;
       case DOCSTATUS_WAITINGFOREVER:
         list.add(jobQueue.statusToString(jobQueue.STATUS_PENDING));

Modified: incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobQueue.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobQueue.java?rev=1190232&r1=1190231&r2=1190232&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobQueue.java
(original)
+++ incubator/lcf/branches/CONNECTORS-284/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobQueue.java
Fri Oct 28 10:21:52 2011
@@ -205,9 +205,8 @@ public class JobQueue extends org.apache
       IndexDescription jobStatusIndex = new IndexDescription(false,new String[]{jobIDField,statusField});
       IndexDescription jobSeedIndex = new IndexDescription(false,new String[]{jobIDField,isSeedField});
       IndexDescription jobHashStatusIndex = new IndexDescription(false,new String[]{jobIDField,docHashField,statusField});
-      IndexDescription statusIndex = new IndexDescription(false,new String[]{statusField});
-      IndexDescription actionTimeStatusIndex = new IndexDescription(false,new String[]{checkActionField,checkTimeField,statusField});
-      IndexDescription prioritysetStatusIndex = new IndexDescription(false,new String[]{prioritySetField,statusField});
+      IndexDescription actionTimeStatusIndex = new IndexDescription(false,new String[]{statusField,checkActionField,checkTimeField});
+      IndexDescription prioritysetStatusIndex = new IndexDescription(false,new String[]{prioritySetField,statusField,checkActionField});
       IndexDescription docpriorityIndex = new IndexDescription(false,new String[]{docPriorityField});
 
       // Get rid of unused indexes
@@ -226,8 +225,6 @@ public class JobQueue extends org.apache
           jobSeedIndex = null;
         else if (jobHashStatusIndex != null && id.equals(jobHashStatusIndex))
           jobHashStatusIndex = null;
-        else if (statusIndex != null && id.equals(statusIndex))
-          statusIndex = null;
         else if (actionTimeStatusIndex != null && id.equals(actionTimeStatusIndex))
           actionTimeStatusIndex = null;
         else if (prioritysetStatusIndex != null && id.equals(prioritysetStatusIndex))
@@ -250,9 +247,6 @@ public class JobQueue extends org.apache
       if (jobHashStatusIndex != null)
         performAddIndex(null,jobHashStatusIndex);
 
-      if (statusIndex != null)
-        performAddIndex(null,statusIndex);
-
       if (actionTimeStatusIndex != null)
         performAddIndex(null,actionTimeStatusIndex);
 



Mime
View raw message