somandal commented on code in PR #15317:
URL: https://github.com/apache/pinot/pull/15317#discussion_r2013202143


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/DefaultRebalancePreChecker.java:
##########
@@ -279,6 +299,43 @@ private RebalancePreCheckerResult 
checkDiskUtilization(Map<String, Map<String, S
         : RebalancePreCheckerResult.error(message.toString());
   }
 
+  private RebalancePreCheckerResult checkRebalanceConfig(RebalanceConfig 
rebalanceConfig, TableConfig tableConfig,
+      Map<String, Map<String, String>> currentAssignment, Map<String, 
Map<String, String>> targetAssignment) {
+    StringBuilder message = new StringBuilder();
+    boolean pass = true;
+    if (rebalanceConfig.isBestEfforts()) {
+      pass = false;
+      message.append("bestEfforts is enabled, only enable it if you know what 
you are doing\n");
+    }
+    List<String> segmentsToMove = 
SegmentAssignmentUtils.getSegmentsToMove(currentAssignment, targetAssignment);
+
+    if (rebalanceConfig.isDowntime()) {
+      int numReplicas = Integer.MAX_VALUE;
+      for (String segment : segmentsToMove) {
+        numReplicas = Math.min(targetAssignment.get(segment).size(), 
numReplicas);
+      }
+      if (!segmentsToMove.isEmpty() && numReplicas > 1) {
+        pass = false;
+        message.append("Number of replicas (")
+            .append(numReplicas)
+            .append(") is greater than 1, downtime is not recommended.\n");
+      }
+    }
+
+    if (!rebalanceConfig.isIncludeConsuming() && tableConfig.getTableType() == 
TableType.REALTIME) {
+      pass = false;
+      message.append("includeConsuming is disabled for a realtime table.\n");
+    }
+    if (rebalanceConfig.isBootstrap()) {
+      pass = false;
+      message.append(
+          "bootstrap is enabled which can cause a large amount of data 
movement, double check if this is intended\n");
+    }
+
+    return pass ? RebalancePreCheckerResult.pass("No rebalance parameters need 
to double check")

Review Comment:
   nit: sorry my mistake, this sounds confusing. let's reword this to "All 
rebalance configs look good" (not sure if parameters or configs is better, use 
either here)



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