Author: kwright
Date: Wed Dec 12 03:04:58 2012
New Revision: 1420515

URL: http://svn.apache.org/viewvc?rev=1420515&view=rev
Log:
Final fix for CONNECTORS-584.

Modified:
    manifoldcf/trunk/CHANGES.txt
    
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1420515&r1=1420514&r2=1420515&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Dec 12 03:04:58 2012
@@ -3,6 +3,12 @@ $Id$
 
 ======================= 1.1-dev =====================
 
+CONNECTORS-584: Fix MySQL use of indexes on ORDER-BY stuffing query.
+Turns out that MySQL will not order by an index unless only the first column
+in the index is specified in the ordering criteria.  Still need to check if 
this
+breaks other databases like PostgreSQL, Derby, or HSQLDB.
+(Shigeki Kobayashi, Karl Wright)
+
 CONNECTORS-583: Catch MySQL lock timeout, and retry that transaction.
 (Shigeki Kobayashi, Karl Wright)
 

Modified: 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1420515&r1=1420514&r2=1420515&view=diff
==============================================================================
--- 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
 (original)
+++ 
manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
 Wed Dec 12 03:04:58 2012
@@ -2123,10 +2123,11 @@ public class JobManager implements IJobM
       .append(") ");
       
     sb.append(" ORDER BY ")
-      .append(jobQueue.docPriorityField).append(" ASC,")
-      .append(jobQueue.statusField).append(" ASC,")
-      .append(jobQueue.checkActionField).append(" ASC,")
-      .append(jobQueue.checkTimeField).append(" ASC ")
+      .append(jobQueue.docPriorityField).append(" ASC ")
+      // These match the where clause, but they break MySQL
+      //.append(jobQueue.statusField).append(" ASC,")
+      //.append(jobQueue.checkActionField).append(" ASC,")
+      //.append(jobQueue.checkTimeField).append(" ASC ")
       .append(database.constructOffsetLimitClause(0,1,true));
 
     IResultSet set = 
database.performQuery(sb.toString(),list,null,null,1,null);
@@ -2202,10 +2203,11 @@ public class JobManager implements IJobM
       .append(")");
 
     sb.append(" ORDER BY ")
-      .append("t0.").append(jobQueue.docPriorityField).append(" ASC,")
-      .append("t0.").append(jobQueue.statusField).append(" ASC,")
-      .append("t0.").append(jobQueue.checkActionField).append(" ASC,")
-      .append("t0.").append(jobQueue.checkTimeField).append(" ASC ");
+      .append("t0.").append(jobQueue.docPriorityField).append(" ASC ");
+      // These break MySQL
+      //.append("t0.").append(jobQueue.statusField).append(" ASC,")
+      //.append("t0.").append(jobQueue.checkActionField).append(" ASC,")
+      //.append("t0.").append(jobQueue.checkTimeField).append(" ASC ");
 
 
     // Before entering the transaction, we must provide the throttlelimit 
object with all the connector


Reply via email to