You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2014/10/27 21:56:41 UTC

svn commit: r1634684 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java

Author: shalin
Date: Mon Oct 27 20:56:41 2014
New Revision: 1634684

URL: http://svn.apache.org/r1634684
Log:
SOLR-6591: Do not batch updates for different stateFormats together

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1634684&r1=1634683&r2=1634684&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/Overseer.java Mon Oct 27 20:56:41 2014
@@ -258,6 +258,7 @@ public class Overseer implements Closeab
       }
       
       log.info("Starting to work on the main queue");
+      int lastStateFormat = -1; // sentinel
       try {
         while (!this.isClosed) {
           isLeader = amILeader();
@@ -293,6 +294,23 @@ public class Overseer implements Closeab
               while (head != null) {
                 final ZkNodeProps message = ZkNodeProps.load(head.getBytes());
                 final String operation = message.getStr(QUEUE_OPERATION);
+
+                // we batch updates for the main cluster state together (stateFormat=1)
+                // but if we encounter a message for a collection with a stateFormat different than the last
+                // then we stop batching at that point
+                String collection = message.getStr(ZkStateReader.COLLECTION_PROP);
+                if (collection == null) collection = message.getStr("name");
+                if (collection != null) {
+                  DocCollection docCollection = clusterState.getCollectionOrNull(collection);
+                  if (lastStateFormat != -1 && docCollection != null && docCollection.getStateFormat() != lastStateFormat)  {
+                    lastStateFormat = docCollection.getStateFormat();
+                    break;
+                  }
+                  if (docCollection != null)  {
+                    lastStateFormat = docCollection.getStateFormat();
+                  }
+                }
+
                 final TimerContext timerContext = stats.time(operation);
                 try {
                   clusterState = processMessage(clusterState, message, operation);