Apache Lucene open-source search software
SOLR-9029: fix rare ZkStateReader visibility race during collection state format update
Scott Blum89c65af2a6e5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 999bd737fd9..77029502213 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -150,6 +150,8 @@ Bug Fixes* SOLR-8992: Restore Schema API GET method functionality removed in 6.0 (noble, Steve Rowe)+* SOLR-9029: fix rare ZkStateReader visibility race during collection state format update (Scott Blum, hossman)+Optimizations----------------------* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.javaindex 568c791af4a..1e57d7eda41 100644--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java@@ -263,9 +263,9 @@ public class ZkStateReader implements Closeable {}ClusterState.CollectionRef ref = clusterState.getCollectionRef(collection);- if (ref == null) {- // We don't know anything about this collection, maybe it's new?- // First try to update the legacy cluster state.+ if (ref == null || legacyCollectionStates.containsKey(collection)) {+ // We either don't know anything about this collection (maybe it's new?) or it's legacy.+ // First update the legacy cluster state.refreshLegacyClusterState(null);if (!legacyCollectionStates.containsKey(collection)) {// No dice, see if a new collection just got created.@@ -283,9 +283,6 @@ public class ZkStateReader implements Closeable {}// Edge case: if there's no external collection, try refreshing legacy cluster state in case it's there.refreshLegacyClusterState(null);- } else if (legacyCollectionStates.containsKey(collection)) {- // Exists, and lives in legacy cluster state, force a refresh.- refreshLegacyClusterState(null);} else if (watchedCollectionStates.containsKey(collection)) {// Exists as a watched collection, force a refresh.DocCollection newState = fetchCollectionState(collection, null);