This is an automated email from the ASF dual-hosted git repository.

somandal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new c423ae04db Add updateTargetTier check to the rebalance configs 
pre-check for table rebalancer (#15689)
c423ae04db is described below

commit c423ae04dbd648594f59a48aba89e6ef58316b37
Author: Jhow <44998515+j-howhu...@users.noreply.github.com>
AuthorDate: Thu May 1 18:31:34 2025 -0700

    Add updateTargetTier check to the rebalance configs pre-check for table 
rebalancer (#15689)
---
 .../core/rebalance/DefaultRebalancePreChecker.java   |  7 ++++++-
 .../TableRebalancerClusterStatelessTest.java         | 20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/DefaultRebalancePreChecker.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/DefaultRebalancePreChecker.java
index 2c8812d799..64389172ee 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/DefaultRebalancePreChecker.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/DefaultRebalancePreChecker.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ExecutorService;
 import javax.annotation.Nullable;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
 import org.apache.pinot.common.assignment.InstanceAssignmentConfigUtils;
 import org.apache.pinot.common.exception.InvalidConfigException;
@@ -128,7 +129,7 @@ public class DefaultRebalancePreChecker implements 
RebalancePreChecker {
       Map<String, JsonNode> needsReloadMetadata = 
needsReloadMetadataPair.getServerReloadJsonResponses();
       int failedResponses = needsReloadMetadataPair.getNumFailedResponses();
       tableRebalanceLogger.info("Received {} needs reload responses and {} 
failed responses from servers assigned "
-              + "to table", needsReloadMetadata.size(), failedResponses);
+          + "to table", needsReloadMetadata.size(), failedResponses);
       needsReload = needsReloadMetadata.values().stream().anyMatch(value -> 
value.get("needReload").booleanValue());
       if (!needsReload && failedResponses > 0) {
         tableRebalanceLogger.warn(
@@ -362,6 +363,10 @@ public class DefaultRebalancePreChecker implements 
RebalancePreChecker {
       warnings.add(
           "bootstrap is enabled which can cause a large amount of data 
movement, double check if this is intended");
     }
+    if (CollectionUtils.isNotEmpty(tableConfig.getTierConfigsList()) && 
!rebalanceConfig.isUpdateTargetTier()) {
+      pass = false;
+      warnings.add("updateTargetTier should be enabled when tier configs are 
present");
+    }
 
     return pass ? RebalancePreCheckerResult.pass("All rebalance parameters 
look good")
         : RebalancePreCheckerResult.warn(StringUtil.join("\n", 
warnings.toArray(String[]::new)));
diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancerClusterStatelessTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancerClusterStatelessTest.java
index 49710aa1e9..1d81dac55e 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancerClusterStatelessTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancerClusterStatelessTest.java
@@ -912,6 +912,24 @@ public class TableRebalancerClusterStatelessTest extends 
ControllerTest {
             + "bootstrap is enabled which can cause a large amount of data 
movement, double check if this is "
             + "intended");
 
+    // test updateTargetTier warning
+    rebalanceConfig.setUpdateTargetTier(false);
+    rebalanceConfig.setBootstrap(false);
+    rebalanceConfig.setBestEfforts(false);
+    tableConfig =
+        new TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME)
+            .setTierConfigList(Collections.singletonList(
+                new TierConfig("dummyTier", 
TierFactory.TIME_SEGMENT_SELECTOR_TYPE, "7d", null,
+                    TierFactory.PINOT_SERVER_STORAGE_TYPE,
+                    
TagNameUtils.getRealtimeTagForTenant(TagNameUtils.DEFAULT_TENANT_NAME), null, 
null)))
+            .build();
+
+    rebalanceResult = tableRebalancer.rebalance(tableConfig, rebalanceConfig, 
null);
+    preCheckerResult = 
rebalanceResult.getPreChecksResult().get(DefaultRebalancePreChecker.REBALANCE_CONFIG_OPTIONS);
+    assertNotNull(preCheckerResult);
+    assertEquals(preCheckerResult.getPreCheckStatus(), 
RebalancePreCheckerResult.PreCheckStatus.WARN);
+    assertEquals(preCheckerResult.getMessage(), "updateTargetTier should be 
enabled when tier configs are present");
+
     // trigger downtime warning
     TableConfig newTableConfig =
         new 
TableConfigBuilder(TableType.REALTIME).setTableName(RAW_TABLE_NAME).setNumReplicas(3).build();
@@ -919,6 +937,8 @@ public class TableRebalancerClusterStatelessTest extends 
ControllerTest {
     rebalanceConfig.setBootstrap(false);
     rebalanceConfig.setBestEfforts(false);
     rebalanceConfig.setDowntime(true);
+    // udpateTargetTier is false, but there is no tier config so we should not 
see a warning
+    rebalanceConfig.setUpdateTargetTier(false);
     rebalanceResult = tableRebalancer.rebalance(newTableConfig, 
rebalanceConfig, null);
     preCheckerResult = 
rebalanceResult.getPreChecksResult().get(DefaultRebalancePreChecker.REBALANCE_CONFIG_OPTIONS);
     assertNotNull(preCheckerResult);


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

Reply via email to