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/02 01:21:24 UTC

[lucene-solr] branch reference_impl updated: @687 Defensive wait.

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


The following commit(s) were added to refs/heads/reference_impl by this push:
     new 4d3f97e  @687 Defensive wait.
4d3f97e is described below

commit 4d3f97e9e5cacf465929fc866f8001e1553b25f7
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Sep 1 20:10:51 2020 -0500

    @687 Defensive wait.
---
 solr/core/src/java/org/apache/solr/core/SolrCore.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 8978bca..31d95af 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1079,7 +1079,12 @@ public final class SolrCore implements SolrInfoBean, Closeable {
 
       // seed version buckets with max from index during core initialization ... requires a searcher!
       seedVersionBuckets();
-
+      if (coreContainer.isZooKeeperAware()) {
+        // make sure we see our shard first - these tries to cover a surprising race where we don't find our shard in the clusterstate
+        // in the below bufferUpdatesIfConstructing call
+        coreContainer.getZkController().getZkStateReader().waitForState(coreDescriptor.getCollectionName(),
+            5, TimeUnit.SECONDS, (l,c) -> c != null && c.getSlice(coreDescriptor.getCloudDescriptor().getShardId()) != null);
+      }
       bufferUpdatesIfConstructing(coreDescriptor);
 
       this.ruleExpiryLock = new ReentrantLock();
@@ -1149,6 +1154,8 @@ public final class SolrCore implements SolrInfoBean, Closeable {
 
       // ZK pre-register would have already happened so we read slice properties now
       final ClusterState clusterState = coreContainer.getZkController().getClusterState();
+
+
       final DocCollection collection = clusterState.getCollectionOrNull(coreDescriptor.getCloudDescriptor().getCollectionName());
       final Slice slice = collection.getSlice(coreDescriptor.getCloudDescriptor().getShardId());
       if (slice.getState() == Slice.State.CONSTRUCTION) {