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/08/28 21:28:58 UTC

[lucene-solr] branch reference_impl_dev updated: @618 Try to harden a race where we can stop watching a collection we are creating.

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

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new cafe9e3  @618 Try to harden a race where we can stop watching a collection we are creating.
cafe9e3 is described below

commit cafe9e310f82d81a08dc9222f8e2e15bbc9c317c
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Aug 28 16:28:14 2020 -0500

    @618 Try to harden a race where we can stop watching a collection we are creating.
---
 solr/core/src/java/org/apache/solr/cloud/ZkController.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 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 57fbc66..c6747e8 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1592,7 +1592,6 @@ public class ZkController implements Closeable {
       }
 
       // the watcher is added to a set so multiple calls of this method will left only one watcher
-      zkStateReader.registerCore(cloudDesc.getCollectionName());
       zkStateReader.registerDocCollectionWatcher(cloudDesc.getCollectionName(),
           new UnloadCoreOnDeletedWatcher(coreZkNodeName, shardId, desc.getName()));
       return shardId;
@@ -2096,6 +2095,12 @@ public class ZkController implements Closeable {
 
   public void preRegister(CoreDescriptor cd, boolean publishState) {
     log.info("PreRegister SolrCore, collection={}, shard={} coreNodeName={}", cd.getCloudDescriptor().getCollectionName(), cd.getCloudDescriptor().getShardId());
+
+    CloudDescriptor cloudDesc = cd.getCloudDescriptor();
+
+    // the watcher is added to a set so multiple calls of this method will left only one watcher
+    zkStateReader.registerCore(cloudDesc.getCollectionName());
+
     String coreNodeName = getCoreNodeName(cd);
 
     // before becoming available, make sure we are not live and active
@@ -2103,8 +2108,6 @@ public class ZkController implements Closeable {
     try {
       checkStateInZk(cd);
 
-      CloudDescriptor cloudDesc = cd.getCloudDescriptor();
-
       // make sure the node name is set on the descriptor
       if (cloudDesc.getCoreNodeName() == null) {
         cloudDesc.setCoreNodeName(coreNodeName);