You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gc...@apache.org on 2016/06/09 20:26:42 UTC

lucene-solr:branch_6x: SOLR-9199: ZkController#publishAndWaitForDownStates logic is inefficient

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 4eead9b23 -> 360d9c40d


SOLR-9199: ZkController#publishAndWaitForDownStates logic is inefficient


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/360d9c40
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/360d9c40
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/360d9c40

Branch: refs/heads/branch_6x
Commit: 360d9c40da4cc1f86f080b4f2c7410da6fbc2195
Parents: 4eead9b
Author: Gregory Chanan <gc...@cloudera.com>
Authored: Wed Jun 8 17:31:47 2016 -0700
Committer: Gregory Chanan <gc...@cloudera.com>
Committed: Thu Jun 9 13:26:30 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                         |  2 ++
 .../src/java/org/apache/solr/cloud/ZkController.java     | 11 ++++-------
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/360d9c40/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 96a83b3..5d2b594 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -19,6 +19,8 @@ See the Quick Start guide at http://lucene.apache.org/solr/quickstart.html
 ==================  6.2.0 ==================
 (No Changes)
 
+* SOLR-9199: ZkController#publishAndWaitForDownStates logic is inefficient (Hrishikesh Gadre)
+
 ==================  6.1.0 ==================
 
 Upgrading from Solr any prior release

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/360d9c40/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index b36e766..1388ee5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -686,9 +686,9 @@ public final class ZkController {
     // now wait till the updates are in our state
     long now = System.nanoTime();
     long timeout = now + TimeUnit.NANOSECONDS.convert(WAIT_DOWN_STATES_TIMEOUT_SECONDS, TimeUnit.SECONDS);
-    boolean foundStates = true;
 
     while (System.nanoTime() < timeout) {
+      boolean foundStates = true;
       ClusterState clusterState = zkStateReader.getClusterState();
       Map<String, DocCollection> collections = clusterState.getCollectionsMap();
       for (Map.Entry<String, DocCollection> entry : collections.entrySet()) {
@@ -704,16 +704,13 @@ public final class ZkController {
         }
       }
 
+      Thread.sleep(1000);
       if (foundStates) {
-        Thread.sleep(1000);
-        break;
+        return;
       }
-      Thread.sleep(1000);
-    }
-    if (!foundStates) {
-      log.warn("Timed out waiting to see all nodes published as DOWN in our cluster state.");
     }
 
+    log.warn("Timed out waiting to see all nodes published as DOWN in our cluster state.");
   }
 
   /**