LZD-PratyushBhatt commented on code in PR #3029:
URL: https://github.com/apache/helix/pull/3029#discussion_r2083929183


##########
helix-rest/src/main/java/org/apache/helix/rest/clusterMaintenanceService/MaintenanceManagementService.java:
##########
@@ -476,12 +484,19 @@ private MaintenanceManagementInstanceInfo 
takeFreeSingleInstanceHelper(String cl
 
   private List<String> batchHelixInstanceStoppableCheck(String clusterId,
       Collection<String> instances, Map<String, StoppableCheck> 
finalStoppableChecks,
-      Set<String> toBeStoppedInstances) {
+      Set<String> toBeStoppedInstances, boolean preserveOrder) {
 
     // Perform all but min_active replicas check in parallel
     Map<String, Future<StoppableCheck>> helixInstanceChecks = 
instances.stream().collect(
-        Collectors.toMap(Function.identity(), instance -> POOL.submit(
-            () -> performHelixOwnInstanceCheck(clusterId, instance, 
toBeStoppedInstances))));
+        Collectors.toMap(
+            Function.identity(),
+            instance -> POOL.submit(() -> 
performHelixOwnInstanceCheck(clusterId, instance, toBeStoppedInstances)),
+            (existing, replacement) -> existing,
+            // Use LinkedHashMap when preserveOrder is true as we need to 
preserve the order of instances.
+            // This is important for addMinActiveReplicaChecks which processes 
instances sequentially,
+            // and the order of processing can affect which instances pass the 
min active replica check
+            preserveOrder ? LinkedHashMap::new : HashMap::new

Review Comment:
   Ah yes, missed modifying Custom checks. Added now.
   
   In `addMinActiveReplicaChecks()` idts we need it, the order-sensitive 
collection (futureStoppableCheckByInstance) is already created with the correct 
type (HashMap or LinkedHashMap) before it's passed to addMinActiveReplicaChecks



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