You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2015/07/29 14:45:25 UTC

svn commit: r1693252 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/solrj/ solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java

Author: shalin
Date: Wed Jul 29 12:45:25 2015
New Revision: 1693252

URL: http://svn.apache.org/r1693252
Log:
SOLR-7840: ZkStateReader.updateClusterState fetches watched collections twice from ZK

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1693252&r1=1693251&r2=1693252&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Wed Jul 29 12:45:25 2015
@@ -209,7 +209,8 @@ Optimizations
   For Example: The facet request  {type:terms, field:field1, facet:{x:"unique(field2)"}}
   saw a 7x improvement when field1 and 1M unique terms and field2 had 1000 unique terms.
   (yonik)
-  
+
+* SOLR-7840: ZkStateReader.updateClusterState fetches watched collections twice from ZK. (shalin)
 
 Other Changes
 ----------------------

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java?rev=1693252&r1=1693251&r2=1693252&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java Wed Jul 29 12:45:25 2015
@@ -428,7 +428,7 @@ public class ZkStateReader implements Cl
         if (watchedCollections.contains(s)) {
           DocCollection live = getCollectionLive(this, s);
           if (live != null) {
-            watchedCollectionStates.put(s, live);
+            updateWatchedCollection(live);
             // if it is a watched collection, add too
             result.put(s, new ClusterState.CollectionRef(live));
           }
@@ -506,15 +506,6 @@ public class ZkStateReader implements Cl
         }
         this.clusterState = clusterState;
       }
-      synchronized (ZkStateReader.this) {
-        for (String watchedCollection : watchedCollections) {
-          DocCollection live = getCollectionLive(this, watchedCollection);
-          if (live != null) {
-            updateWatchedCollection(live);
-          }
-        }
-      }
-
     } else {
       if (clusterStateUpdateScheduled) {
         log.debug("Cloud state update for ZooKeeper already scheduled");
@@ -946,9 +937,7 @@ public class ZkStateReader implements Cl
   
   private void updateWatchedCollection(DocCollection newState) {
     watchedCollectionStates.put(newState.getName(), newState);
-    log.info("Updating data for {} to ver {} ", newState.getName(),
-        newState.getZNodeVersion());
-    
+    log.info("Updating data for {} to ver {} ", newState.getName(), newState.getZNodeVersion());
     this.clusterState = clusterState.copyWith(newState.getName(), newState);
   }