[ https://issues.apache.org/jira/browse/SOLR-8323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15263080#comment-15263080 ]
ASF GitHub Bot commented on SOLR-8323: -------------------------------------- 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); } } ``` > Add CollectionWatcher API to ZkStateReader > ------------------------------------------ > > Key: SOLR-8323 > URL: https://issues.apache.org/jira/browse/SOLR-8323 > Project: Solr > Issue Type: Improvement > Affects Versions: master > Reporter: Alan Woodward > Assignee: Alan Woodward > Attachments: SOLR-8323.patch, SOLR-8323.patch, SOLR-8323.patch, > SOLR-8323.patch > > > An API to watch for changes to collection state would be a generally useful > thing, both internally and for client use. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org