SOLR-9199: ZkController#publishAndWaitForDownStates logic is inefficient

This commit is contained in:
Gregory Chanan 2016-06-08 17:31:47 -07:00
parent 4eead9b235
commit 360d9c40da
2 changed files with 7 additions and 8 deletions

View File

@ -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

View File

@ -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 {
}
}
if (foundStates) {
Thread.sleep(1000);
break;
}
Thread.sleep(1000);
}
if (!foundStates) {
log.warn("Timed out waiting to see all nodes published as DOWN in our cluster state.");
if (foundStates) {
return;
}
}
log.warn("Timed out waiting to see all nodes published as DOWN in our cluster state.");
}
/**