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 2016/04/27 20:22:15 UTC

[31/50] [abbrv] lucene-solr:solr-5750: SOLR-9029: fix rare ZkStateReader visibility race during collection state format update

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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/89c65af2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/89c65af2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/89c65af2

Branch: refs/heads/solr-5750
Commit: 89c65af2a6e5f1c8216c1202f65e8d670ef14385
Parents: 922265b
Author: Scott Blum <dr...@apache.org>
Authored: Mon Apr 25 21:15:02 2016 -0400
Committer: Scott Blum <dr...@apache.org>
Committed: Mon Apr 25 21:15:02 2016 -0400

----------------------------------------------------------------------
 solr/CHANGES.txt                                            | 2 ++
 .../java/org/apache/solr/common/cloud/ZkStateReader.java    | 9 +++------
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/89c65af2/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 999bd73..7702950 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.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/89c65af2/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
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.java
index 568c791..1e57d7e 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);