lei-xia commented on a change in pull request #941: Fix unexpceted partition 
movements in the CrushEd strategy.
URL: https://github.com/apache/helix/pull/941#discussion_r407628317
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/controller/rebalancer/AbstractRebalancer.java
 ##########
 @@ -417,4 +417,25 @@ public int compare(String ins1, String ins2) {
       return p1.compareTo(p2);
     }
   }
+
+  // This is for a backward compatible workaround to fix
+  // https://github.com/apache/helix/issues/940.
+  // TODO: remove the workaround once we are able to apply the simple fix 
without majorly
+  // TODO: impacting user's clusters.
+  protected List<String> getStablePartitionList(ResourceControllerDataProvider 
clusterData,
+      IdealState currentIdealState) {
+    List<String> partitions =
+        
clusterData.getStablePartitionList(currentIdealState.getResourceName());
+    Set<String> currentPartitionSet = currentIdealState.getPartitionSet();
+    if (partitions.size() != currentPartitionSet.size() || !currentPartitionSet
+        .containsAll(partitions)) {
 
 Review comment:
   Let us think about if we  have any other way to do this.  We actually found 
containsAll() has been a big performance issue before, specially if you compare 
a set with a list (which take O(N) to iterator). 

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

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

Reply via email to