SOLR-9029: fix rare ZkStateReader visibility race during collection state format update

This commit is contained in:
Scott Blum 2016-04-25 21:15:02 -04:00
parent 922265b478
commit 89c65af2a6
2 changed files with 5 additions and 6 deletions

View File

@ -150,6 +150,8 @@ Bug Fixes
* SOLR-8992: Restore Schema API GET method functionality removed in 6.0 (noble, Steve Rowe) * 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 Optimizations
---------------------- ----------------------
* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation. * SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.

View File

@ -263,9 +263,9 @@ public class ZkStateReader implements Closeable {
} }
ClusterState.CollectionRef ref = clusterState.getCollectionRef(collection); ClusterState.CollectionRef ref = clusterState.getCollectionRef(collection);
if (ref == null) { if (ref == null || legacyCollectionStates.containsKey(collection)) {
// We don't know anything about this collection, maybe it's new? // We either don't know anything about this collection (maybe it's new?) or it's legacy.
// First try to update the legacy cluster state. // First update the legacy cluster state.
refreshLegacyClusterState(null); refreshLegacyClusterState(null);
if (!legacyCollectionStates.containsKey(collection)) { if (!legacyCollectionStates.containsKey(collection)) {
// No dice, see if a new collection just got created. // 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. // Edge case: if there's no external collection, try refreshing legacy cluster state in case it's there.
refreshLegacyClusterState(null); refreshLegacyClusterState(null);
} else if (legacyCollectionStates.containsKey(collection)) {
// Exists, and lives in legacy cluster state, force a refresh.
refreshLegacyClusterState(null);
} else if (watchedCollectionStates.containsKey(collection)) { } else if (watchedCollectionStates.containsKey(collection)) {
// Exists as a watched collection, force a refresh. // Exists as a watched collection, force a refresh.
DocCollection newState = fetchCollectionState(collection, null); DocCollection newState = fetchCollectionState(collection, null);