You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/09/05 15:26:09 UTC

[lucene-solr] 03/13: @736 Use the waitFor method we use and trust more.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit bf3c28e37f21e9e05fbec038e50c71feb11a901a
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Sep 4 08:17:19 2020 -0500

    @736 Use the waitFor method we use and trust more.
---
 solr/core/src/java/org/apache/solr/cloud/ZkController.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 82d1df3..f619f01 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -2191,11 +2191,11 @@ public class ZkController implements Closeable {
       if (cloudDesc.getShardId() == null) {
         throw new SolrException(ErrorCode.SERVER_ERROR, "No shard id for " + cd);
       }
-
+      StringBuilder sb = new StringBuilder(256);
       AtomicReference<String> errorMessage = new AtomicReference<>();
       AtomicReference<DocCollection> collectionState = new AtomicReference<>();
       try {
-        zkStateReader.waitForState(cd.getCollectionName(), WAIT_FOR_STATE, TimeUnit.SECONDS, (c) -> {
+        zkStateReader.waitForState(cd.getCollectionName(), WAIT_FOR_STATE, TimeUnit.SECONDS, (l, c) -> {
           collectionState.set(c);
           if (c == null)
             return false;
@@ -2206,7 +2206,7 @@ public class ZkController implements Closeable {
           }
           Replica replica = slice.getReplica(coreNodeName);
           if (replica == null) {
-            StringBuilder sb = new StringBuilder();
+            sb.setLength(0);
             slice.getReplicas().stream().forEach(replica1 -> sb.append(replica1.getName() + " "));
             errorMessage.set("coreNodeName " + coreNodeName + " does not exist in shard " + cloudDesc.getShardId() +
                 ", ignore the exception if the replica was deleted. Found: " + sb.toString());
@@ -2220,7 +2220,7 @@ public class ZkController implements Closeable {
           error = "coreNodeName " + coreNodeName + " does not exist in shard " + cloudDesc.getShardId() +
               ", ignore the exception if the replica was deleted" ;
 
-        throw new NotInClusterStateException(ErrorCode.SERVER_ERROR, error + "\n" + getZkStateReader().getClusterState().getCollection(cd.getCollectionName()));
+        throw new NotInClusterStateException(ErrorCode.SERVER_ERROR, error + "\n" + collectionState.get());
       }
     }
   }