diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 5ab52b29542..9e6da65d9ce 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -101,6 +101,9 @@ Bug Fixes * SOLR-8902: Make sure ReturnFields only returns the requested fields from (fl=) evn when DocumentTransformers ask for getExtraRequestFields() (ryan) +* SOLR-8875: SolrCloud Overseer clusterState could unexpectedly be null resulting in NPE. + (Scott Blum via David Smiley) + Optimizations ---------------------- * SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation. diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java index 0e5bded5f3f..f25cab7b670 100644 --- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java +++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java @@ -151,6 +151,7 @@ public class Overseer implements Closeable { continue; // not a no, not a yes, try ask again } + //TODO consider removing 'refreshClusterState' and simply check if clusterState is null if (refreshClusterState) { try { reader.updateClusterState(); diff --git a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java index 9fb3ada40c6..ec67ed7dbc4 100644 --- a/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java +++ b/solr/core/src/java/org/apache/solr/cloud/overseer/ZkStateWriter.java @@ -16,6 +16,7 @@ */ package org.apache.solr.cloud.overseer; +import java.lang.invoke.MethodHandles; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -35,8 +36,6 @@ import org.slf4j.LoggerFactory; import static java.util.Collections.singletonMap; -import java.lang.invoke.MethodHandles; - /** * ZkStateWriter is responsible for writing updates to the cluster state stored in ZooKeeper for * both stateFormat=1 collection (stored in shared /clusterstate.json in ZK) and stateFormat=2 collections @@ -84,6 +83,7 @@ public class ZkStateWriter { this.reader = zkStateReader; this.stats = stats; + this.clusterState = zkStateReader.getClusterState(); } /**