jiajunwang 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_r308461347
##########
File path:
helix-core/src/main/java/org/apache/helix/controller/dataproviders/BaseControllerDataProvider.java
##########
@@ -290,12 +296,20 @@ private void updateIdealRuleMap() {
}
public synchronized void refresh(HelixDataAccessor accessor) {
+ refresh(accessor, new HashSet<>());
+ }
+
+ /**
+ * @param accessor
+ * @param refreshedType Record the types that has been updated during the
refresh.
+ */
+ protected synchronized void refresh(HelixDataAccessor accessor,
Set<HelixConstants.ChangeType> refreshedType) {
// Refresh raw data
_clusterConfig =
accessor.getProperty(accessor.keyBuilder().clusterConfig());
- refreshIdealState(accessor);
- refreshLiveInstances(accessor);
- refreshInstanceConfigs(accessor);
- refreshResourceConfig(accessor);
+ refreshIdealState(accessor, refreshedType);
Review comment:
I thought about this. I think the right way is making it property cache
class method instead of in the data provider. But as you said, not in this PR.
The previous cache work is half done. We will need to finish the refactor
work.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services