i3wangyi commented on a change in pull request #363: Fix the race condition while Helix refresh cluster status cache. URL: https://github.com/apache/helix/pull/363#discussion_r308441158
########## File path: helix-core/src/main/java/org/apache/helix/controller/dataproviders/BaseControllerDataProvider.java ########## @@ -217,51 +220,54 @@ public String getObjName(StateModelDefinition obj) { _instanceMessagesCache = new InstanceMessagesCache(_clusterName); } - private void refreshIdealState(final HelixDataAccessor accessor) { - if (_propertyDataChangedMap.get(HelixConstants.ChangeType.IDEAL_STATE)) { - _propertyDataChangedMap.put(HelixConstants.ChangeType.IDEAL_STATE, false); - + private void refreshIdealState(final HelixDataAccessor accessor, + Set<HelixConstants.ChangeType> refreshedType) { + if (_propertyDataChangedMap.get(HelixConstants.ChangeType.IDEAL_STATE).getAndSet(false)) { Review comment: I personally feel `compareAndSet` probably is more self explainable, `getAndSet(false)` equals to `compareAndSet(true, false)`. Minor issue, it's your call ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services