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:33:16 UTC

[lucene-solr] branch reference_impl updated: @688 We can still stop watching a collection we actually still care about and is local.

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 a7b0f30  @688 We can still stop watching a collection we actually still care about and is local.
a7b0f30 is described below

commit a7b0f30f209ac5d116a555d65abf4e988cfe4573
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Sep 1 20:32:14 2020 -0500

    @688 We can still stop watching a collection we actually still care about and is local.
---
 .../src/java/org/apache/solr/cloud/ZkController.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 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 dd3e15c..fe8ca82 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1947,6 +1947,9 @@ public class ZkController implements Closeable {
   public void unregister(String coreName, CoreDescriptor cd, boolean removeCoreFromZk) throws Exception {
     final String coreNodeName = cd.getCloudDescriptor().getCoreNodeName();
     final String collection = cd.getCloudDescriptor().getCollectionName();
+
+    zkStateReader.unregisterCore(collection);
+
     synchronized (collectionToTerms) {
       ZkCollectionTerms ct = collectionToTerms.get(collection);
       if (ct != null) {
@@ -2109,6 +2112,12 @@ public class ZkController implements Closeable {
 
     String coreNodeName = getCoreNodeName(cd);
 
+    // the watcher is added to a set so multiple calls of this method will left only one watcher
+    zkStateReader.registerCore(cloudDesc.getCollectionName());
+    // the watcher is added to a set so multiple calls of this method will left only one watcher
+    zkStateReader.registerDocCollectionWatcher(cloudDesc.getCollectionName(),
+        new UnloadCoreOnDeletedWatcher(coreNodeName, cloudDesc.getShardId(), cd.getName()));
+
     // before becoming available, make sure we are not live and active
     // this also gets us our assigned shard id if it was not specified
     try {
@@ -2119,12 +2128,6 @@ public class ZkController implements Closeable {
         cloudDesc.setCoreNodeName(coreNodeName);
       }
       log.info("PreRegister found coreNodename of {}", coreNodeName);
-      
-      // the watcher is added to a set so multiple calls of this method will left only one watcher
-      zkStateReader.registerCore(cloudDesc.getCollectionName());
-      // the watcher is added to a set so multiple calls of this method will left only one watcher
-      zkStateReader.registerDocCollectionWatcher(cloudDesc.getCollectionName(),
-          new UnloadCoreOnDeletedWatcher(coreNodeName, cloudDesc.getShardId(), cd.getName()));
 
       // publishState == false on startup
       if (isPublishAsDownOnStartup(cloudDesc)) {
@@ -2796,7 +2799,6 @@ public class ZkController implements Closeable {
     @Override
     // synchronized due to SOLR-11535
     public synchronized boolean onStateChanged(DocCollection collectionState) {
-      if (true) return true;
       if (isClosed()) { // don't accidentally delete cores on shutdown due to unreliable state
         return true;
       }