Github user dragonsinth commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/32#discussion_r61507382
  
    --- Diff: 
solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java ---
    @@ -484,6 +498,12 @@ private void refreshLegacyClusterState(Watcher watcher)
             }
             this.legacyCollectionStates = loadedData.getCollectionStates();
             this.legacyClusterStateVersion = stat.getVersion();
    +        for (Map.Entry<String, ClusterState.CollectionRef> entry : 
this.legacyCollectionStates.entrySet()) {
    +          if (entry.getValue().isLazilyLoaded() == false) {
    +            // a watched collection - trigger notifications
    +            notifyStateWatchers(entry.getKey(), entry.getValue().get());
    +          }
    +        }
    --- End diff --
    
    I think it would add a lot of value here to actually check differences.  
There really wouldn't be much computational work since you could restrict it to 
watched collections.  Something like:
    
    ```
            for (Map.Entry<String, CollectionWatch> watchEntry : 
this.collectionWatches.entrySet()) {
              String coll = watchEntry.getKey();
              CollectionWatch collWatch = watchEntry.getValue();
              DocCollection newState = 
this.legacyCollectionStates.get(coll).get();
              if (!collWatch.stateWatchers.isEmpty()
                  && !Objects.equals(oldCollectionStates.get(coll).get(), 
newState)) {
                notifyStateWatchers(coll, newState);
              }
            }
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to