Skip to content

Commit 8cc47cd

Browse files
Add comment for explaining LinkedHashMap usage
1 parent 888dbb0 commit 8cc47cd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

helix-rest/src/main/java/org/apache/helix/rest/clusterMaintenanceService/MaintenanceManagementService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ private List<String> batchHelixInstanceStoppableCheck(String clusterId,
492492
Function.identity(),
493493
instance -> POOL.submit(() -> performHelixOwnInstanceCheck(clusterId, instance, toBeStoppedInstances)),
494494
(existing, replacement) -> existing,
495+
// Use LinkedHashMap when preserveOrder is true as we need to preserve the order of instances.
496+
// This is important for addMinActiveReplicaChecks which processes instances sequentially,
497+
// and the order of processing can affect which instances pass the min active replica check
495498
preserveOrder ? LinkedHashMap::new : HashMap::new
496499
));
497500

0 commit comments

Comments
 (0)