patsonluk commented on code in PR #909: URL: https://github.com/apache/solr/pull/909#discussion_r922387781
########## solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java: ########## @@ -539,17 +672,17 @@ private void constructState(Set<String> changedCollections) { if (log.isDebugEnabled()) { log.debug( "clusterStateSet: interesting [{}] watched [{}] lazy [{}] total [{}]", - collectionWatches.keySet().size(), - watchedCollectionStates.keySet().size(), + collectionWatches.watchedCollections().size(), + collectionWatches.activeCollectionCount(), lazyCollectionStates.keySet().size(), clusterState.getCollectionStates().size()); } if (log.isTraceEnabled()) { log.trace( "clusterStateSet: interesting [{}] watched [{}] lazy [{}] total [{}]", - collectionWatches.keySet(), - watchedCollectionStates.keySet(), + collectionWatches.watchedCollections(), + collectionWatches.activeCollections(), lazyCollectionStates.keySet(), clusterState.getCollectionStates()); } Review Comment: I believe it could change but it should be okay. As far as I understand, we only need a strong guarantee/synchronization on the write ops. As for read op, it appears none of the read operation requires such guarantee, ie even if the value read has changed or is inconsistent with the `watchedCollectionStates`, it should not cause any serious issues. (it might print value that does not reflect the latest set or fetch/not fetch something - but these are not new behaviors) The core of this PR is to remove the race conditions between write operations of 2 separate maps, which can cause stale state. And now since all write ops are on the same map with sync, we should be safe 😊 . As for read ops, it's pretty much the same as before, which does not need to have such strong guarantee I suppose? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org