Apache Lucene open-source search software
try to avoid seeing stale state when deciding if we can kill or not by updating the state in the loop rather than just at the start
Mark Robert Miller7f31bb4974a4
diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.javaindex c01a507dba5..ac6488394e0 100644--- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java+++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkey.java@@ -242,11 +242,7 @@ public class ChaosMonkey {public JettySolrRunner getRandomJetty(String slice, boolean aggressivelyKillLeaders) throws KeeperException, InterruptedException {- // get latest cloud state- zkStateReader.updateCloudState(true);-- Slice theShards = zkStateReader.getCloudState().getSlices(collection)- .get(slice);+int numRunning = 0;int numRecovering = 0;int numActive = 0;@@ -254,6 +250,12 @@ public class ChaosMonkey {for (CloudJettyRunner cloudJetty : shardToJetty.get(slice)) {boolean running = true;+ // get latest cloud state+ zkStateReader.updateCloudState(true);++ Slice theShards = zkStateReader.getCloudState().getSlices(collection)+ .get(slice);+ZkNodeProps props = theShards.getShards().get(cloudJetty.coreNodeName);if (props == null) {throw new RuntimeException("shard name " + cloudJetty.coreNodeName + " not found in " + theShards.getShards().keySet());