Skip to content

Apache Lucene open-source search software

fix retry limit mismatch and print known config set names when config name cannot be found

Mark Robert Miller98e144bd6091
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 67310c31fb8..5e9750732bc 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -924,15 +924,17 @@ public final class ZkController {
InterruptedException {
// check for configName
log.info("Looking for collection configName");
+ List<String> configNames = null;
int retry = 1;
- for (; retry < 6; retry++) {
+ int retryLimt = 6;
+ for (; retry < retryLimt; retry++) {
if (zkClient.exists(collectionPath, true)) {
ZkNodeProps cProps = ZkNodeProps.load(zkClient.getData(collectionPath, null, null, true));
if (cProps.containsKey(CONFIGNAME_PROP)) {
break;
}
}
- List<String> configNames = null;
+
// if there is only one conf, use that
try {
configNames = zkClient.getChildren(CONFIGS_ZKNODE, null,
@@ -949,11 +951,11 @@ public final class ZkController {
log.info("Could not find collection configName - pausing for 3 seconds and trying again - try: " + retry);
Thread.sleep(3000);
}
- if (retry == 10) {
+ if (retry == retryLimt) {
log.error("Could not find configName for collection " + collection);
throw new ZooKeeperException(
SolrException.ErrorCode.SERVER_ERROR,
- "Could not find configName for collection " + collection);
+ "Could not find configName for collection " + collection + " found:" + configNames);
}
}