You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2021/04/05 21:24:01 UTC

[lucene-solr] 10/17: more logging

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

ishan pushed a commit to branch prs-perf-test
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit a74b079633b22de6a5c16de45bba96d67cb0b01f
Author: noblepaul <no...@gmail.com>
AuthorDate: Sat Feb 6 00:44:02 2021 +1100

    more logging
---
 .../cloud/api/collections/CreateCollectionCmd.java | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
index c2b4ae4..d743dba 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/CreateCollectionCmd.java
@@ -32,6 +32,7 @@ import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
 
 import org.apache.solr.client.solrj.cloud.DistribStateManager;
 import org.apache.solr.client.solrj.cloud.SolrCloudManager;
@@ -52,6 +53,7 @@ import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.DocCollection;
 import org.apache.solr.common.cloud.DocRouter;
 import org.apache.solr.common.cloud.ImplicitDocRouter;
+import org.apache.solr.common.cloud.PerReplicaStates;
 import org.apache.solr.common.cloud.Replica;
 import org.apache.solr.common.cloud.ReplicaPosition;
 import org.apache.solr.common.cloud.WaitTime;
@@ -90,6 +92,7 @@ import static org.apache.solr.common.params.CommonAdminParams.ASYNC;
 import static org.apache.solr.common.params.CommonAdminParams.WAIT_FOR_FINAL_STATE;
 import static org.apache.solr.common.params.CommonParams.NAME;
 import static org.apache.solr.common.util.StrUtils.formatString;
+import static org.apache.solr.common.util.StrUtils.parseBoolean;
 import static org.apache.solr.handler.admin.ConfigSetsHandler.DEFAULT_CONFIGSET_NAME;
 import static org.apache.solr.handler.admin.ConfigSetsHandler.getSuffixedNameForAutoGeneratedConfigSet;
 
@@ -189,14 +192,21 @@ public class CreateCollectionCmd implements OverseerCollectionMessageHandler.Cmd
           
           if (collectionName.equals("coll192")) log.info("CCN 3");
 
-          created = zksr.fetchCollectionState(collectionName, null, null) != null;
-          
-          if (collectionName.equals("coll192")) log.info("CCN 4");
-
-          if (created) {
-            break;
+          DocCollection docCollection = zksr.fetchCollectionState(collectionName, null, null);
+          created = docCollection != null;
+          if(!created) continue;
+
+          if(docCollection.isPerReplicaState()) {
+            PerReplicaStates prs = PerReplicaStates.fetch(ZkStateReader.getCollectionPath(collectionName), zksr.getZkClient(), null);
+            boolean[] anyDown = new boolean[]{false};
+            prs.states.forEachEntry((s, state) -> {
+              if(state.state != Replica.State.ACTIVE) anyDown[0]  =true;
+            });
+            if(anyDown[0]) continue;
           }
-          
+
+          if(created) break;
+          if (collectionName.equals("coll192")) log.info("CCN 4");
           if (collectionName.equals("coll192")) log.info("CCN 5");
 
         }