You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2020/05/03 14:24:23 UTC
[lucene-solr] branch branch_8x updated: SOLR-14351: Oops;
add back null check for ZkController
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 6c9024f SOLR-14351: Oops; add back null check for ZkController
6c9024f is described below
commit 6c9024f77358ae1f372b3078691ada3f64a84e59
Author: David Smiley <ds...@salesforce.com>
AuthorDate: Sun May 3 10:23:16 2020 -0400
SOLR-14351: Oops; add back null check for ZkController
(cherry picked from commit e7c7a62a84927cf6c49d75229f9ebfbe2feb9df9)
---
solr/core/src/java/org/apache/solr/core/ZkContainer.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/solr/core/src/java/org/apache/solr/core/ZkContainer.java b/solr/core/src/java/org/apache/solr/core/ZkContainer.java
index fcf7b75..0d0da26 100644
--- a/solr/core/src/java/org/apache/solr/core/ZkContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/ZkContainer.java
@@ -44,7 +44,16 @@ import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Used by {@link CoreContainer} to hold ZooKeeper / SolrCloud info, especially {@link ZkController}.
+ * Mainly it does some ZK initialization, and ensures a loading core registers in ZK.
+ * Even when in standalone mode, perhaps surprisingly, an instance of this class exists.
+ * If {@link #getZkController()} returns null then we're in standalone mode.
+ */
public class ZkContainer {
+ // NOTE DWS: It's debatable if this in-between class is needed instead of folding it all into ZkController.
+ // ZKC is huge though.
+
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected ZkController zkController;
@@ -180,6 +189,10 @@ public class ZkContainer {
public static volatile Predicate<CoreDescriptor> testing_beforeRegisterInZk;
public void registerInZk(final SolrCore core, boolean background, boolean skipRecovery) {
+ if (zkController == null) {
+ return;
+ }
+
CoreDescriptor cd = core.getCoreDescriptor(); // save this here - the core may not have it later
Runnable r = () -> {
MDCLoggingContext.setCore(core);
@@ -220,7 +233,6 @@ public class ZkContainer {
} else {
r.run();
}
-
}
public ZkController getZkController() {