Apache Lucene open-source search software
SOLR-7011: Delete collection returns before collection is actually removed
Shalin Shekhar Mangar2d2b07928f17
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 4d9e57d8392..2a5c84a516a 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -521,6 +521,9 @@ Bug Fixes* SOLR-6928: solr.cmd stop works only in english (john.work, Jan Høydahl, Timothy Potter)+* SOLR-7011: Delete collection returns before collection is actually removed.+ (Christine Poerschke via shalin)+Optimizations----------------------diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.javaindex e559f1fbd86..f34e8e2a9e6 100644--- a/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java@@ -1161,7 +1161,7 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {private void deleteCollection(ZkNodeProps message, NamedList results)throws KeeperException, InterruptedException {- String collection = message.getStr("name");+ final String collection = message.getStr("name");try {ModifiableSolrParams params = new ModifiableSolrParams();params.set(CoreAdminParams.ACTION, CoreAdminAction.UNLOAD.toString());@@ -1181,7 +1181,7 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {boolean removed = false;while (System.nanoTime() < timeout) {Thread.sleep(100);- removed = !zkStateReader.getClusterState().hasCollection(message.getStr(collection));+ removed = !zkStateReader.getClusterState().hasCollection(collection);if (removed) {Thread.sleep(500); // just a bit of time so it's more likely other// readers see on return@@ -1190,7 +1190,7 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {}if (!removed) {throw new SolrException(ErrorCode.SERVER_ERROR,- "Could not fully remove collection: " + message.getStr("name"));+ "Could not fully remove collection: " + collection);}} finally {