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

[lucene-solr] branch reference_impl_dev updated: @619 Keep trying to harden these collection creation race with registered collection watchers.

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 45b51c3  @619 Keep trying to harden these collection creation race with registered collection watchers.
45b51c3 is described below

commit 45b51c3e8bb8d4a168c4320f44a5fa40c70063f3
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Aug 28 16:53:27 2020 -0500

    @619 Keep trying to harden these collection creation race with registered collection watchers.
---
 solr/core/src/java/org/apache/solr/cloud/ZkController.java  | 13 +++++++------
 .../solr/cloud/api/collections/CreateCollectionCmd.java     |  5 ++---
 2 files changed, 9 insertions(+), 9 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 c6747e8..79dfec9 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1591,9 +1591,6 @@ public class ZkController implements Closeable {
         throw e;
       }
 
-      // the watcher is added to a set so multiple calls of this method will left only one watcher
-      zkStateReader.registerDocCollectionWatcher(cloudDesc.getCollectionName(),
-          new UnloadCoreOnDeletedWatcher(coreZkNodeName, shardId, desc.getName()));
       return shardId;
     } finally {
       MDCLoggingContext.clear();
@@ -2098,9 +2095,6 @@ public class ZkController implements Closeable {
 
     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
@@ -2113,6 +2107,13 @@ 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)) {
         publish(cd, Replica.State.DOWN, false, true);
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 c2455d5..6c20391 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
@@ -376,7 +376,6 @@ public class CreateCollectionCmd implements OverseerCollectionMessageHandler.Cmd
         if (async != null) {
           zkStateReader.waitForState(collectionName, 30, TimeUnit.SECONDS, BaseCloudSolrClient.expectedShardsAndActiveReplicas(shardNames.size(), replicaPositions.size()));
         }
-
       }
 
       // modify the `withCollection` and store this new collection's name with it
@@ -404,10 +403,10 @@ public class CreateCollectionCmd implements OverseerCollectionMessageHandler.Cmd
       ParWork.propegateInterrupt(ex);
       throw ex;
     } catch (SolrException ex) {
-      log.error("Exception creating collections zk node", ex);
+      log.error("Exception creating collections", ex);
       throw ex;
     } catch (Exception ex) {
-      log.error("Exception creating collections zk node", ex);
+      log.error("Exception creating collection", ex);
       throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, null, ex);
     } finally {
       if (sessionWrapper.get() != null) sessionWrapper.get().release();