jiajunwang commented on a change in pull request #365: Fix RoutingTableProvider 
statePropagationLatency metric reporting bug
URL: https://github.com/apache/helix/pull/365#discussion_r308548892
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/common/caches/CurrentStateCache.java
 ##########
 @@ -135,10 +135,15 @@ private void refreshCurrentStatesCache(HelixDataAccessor 
accessor,
     Set<PropertyKey> cachedKeys = new HashSet<>(_currentStateCache.keySet());
     cachedKeys.retainAll(currentStateKeys);
 
+    List<PropertyKey> reloadKeyList = new ArrayList<>(reloadKeys);
     Map<PropertyKey, CurrentState> newStateCache = Collections.unmodifiableMap(
-        refreshProperties(accessor, new ArrayList<>(reloadKeys), new 
ArrayList<>(cachedKeys),
+        refreshProperties(accessor, reloadKeyList, new ArrayList<>(cachedKeys),
             _currentStateCache));
 
+    // reloadKeyList is updated by refreshProperties()
+    reloadKeys.clear();
+    reloadKeys.addAll(reloadKeyList);
+
     // if the cache was not initialized, the previous state should not be 
included in the snapshot
 
 Review comment:
   IMHO, refreshProperties needs to be improved. The main issue is that the 
function takes one parameter as the input and also the output.
   Ideally, we shall have 2 separate list/set. One for the input, which keys 
require reload. The other for the output, read the real reloaded keys.

----------------------------------------------------------------
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

Reply via email to