xyuanlu commented on code in PR #2746:
URL: https://github.com/apache/helix/pull/2746#discussion_r1471752830


##########
helix-core/src/main/java/org/apache/helix/controller/dataproviders/BaseControllerDataProvider.java:
##########
@@ -429,24 +429,31 @@ private void updateInstanceSets(Map<String, 
InstanceConfig> instanceConfigMap,
     }
 
     liveInstancesMap.forEach((instanceName, liveInstance) -> {
-      if (_assignableInstanceConfigMap.containsKey(instanceName)) {
-        _assignableLiveInstancesMap.put(instanceName, liveInstance);
+      if (newAssignableInstanceConfigMap.containsKey(instanceName)) {
+        newAssignableLiveInstancesMap.put(instanceName, liveInstance);
       }
     });
 
     swapOutLogicalIdsByInstanceName.forEach((swapOutInstanceName, value) -> {
       String swapInInstanceName = swapInInstancesByLogicalId.get(value);
       if (swapInInstanceName != null) {
-        _swapOutInstanceNameToSwapInInstanceName.put(swapOutInstanceName, 
swapInInstanceName);
+        newSwapOutInstanceNameToSwapInInstanceName.put(swapOutInstanceName, 
swapInInstanceName);
         if (liveInstancesMap.containsKey(swapInInstanceName)) {
-          _liveSwapInInstanceNames.add(swapInInstanceName);
+          newLiveSwapInInstanceNames.add(swapInInstanceName);
         }
         if 
(InstanceValidationUtil.isInstanceEnabled(instanceConfigMap.get(swapInInstanceName),
             clusterConfig)) {
-          _enabledSwapInInstanceNames.add(swapInInstanceName);
+          newEnabledSwapInInstanceNames.add(swapInInstanceName);
         }
       }
     });
+
+    // Replace caches with up to date instance sets.

Review Comment:
   question: do we want to have some kind of barrier so that when user access 
different maps, they will access the same snapshot. (i.e., not the new 
_assignableInstanceConfigMap and old _enabledSwapInInstanceNames etc)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to