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


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancer.java:
##########
@@ -489,6 +535,27 @@ private RebalanceResult doRebalance(TableConfig 
tableConfig, RebalanceConfig reb
       minAvailableReplicas = numCurrentAssignmentReplicas;
     }
 
+    // Don't allow rebalance if peer-download is enabled but 
minAvailableReplicas = 0 (which is similar to downtime
+    // rebalance where we can drop to 0 replicas during rebalance)
+    if (minAvailableReplicas == 0
+        && 
!StringUtils.isEmpty(tableConfig.getValidationConfig().getPeerSegmentDownloadScheme()))
 {
+      if (!forceDowntime) {
+        // Don't allow minAvailableReplicas=0 rebalance if peer-download is 
enabled, as it can result in data loss.
+        // The best way to rebalance peer-download enabled tables is to:
+        // - Ensure that all segments have their deep-store copy available
+        // - Pause ingestion to prevent the creation of new segments during 
rebalance
+        // - set forceDowntime=true and re-try running the rebalance
+        String errorMsg = "Peer-download enabled tables with cannot set 
minAvailableReplicas=0 for rebalance due to "
+            + "the potential for data loss, validate all segments exist in 
deep store and pause ingestion prior to "
+            + "setting forceDowntime=true to override the downtime flag";
+        tableRebalanceLogger.error(errorMsg);
+        return new RebalanceResult(rebalanceJobId, 
RebalanceResult.Status.FAILED, errorMsg, instancePartitionsMap,

Review Comment:
   done



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to