This is an automated email from the ASF dual-hosted git repository. jackie 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 2f3612f45d add getter for precheckcontext (#15339) 2f3612f45d is described below commit 2f3612f45dc4d7ee70d48a30a41e3afbacdcebbf Author: Jhow <44998515+j-howhu...@users.noreply.github.com> AuthorDate: Thu Mar 20 16:45:19 2025 -0700 add getter for precheckcontext (#15339) --- .../core/rebalance/DefaultRebalancePreChecker.java | 14 ++++----- .../helix/core/rebalance/RebalancePreChecker.java | 36 ++++++++++++++++++---- 2 files changed, 37 insertions(+), 13 deletions(-) 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 bc88a516b0..53f834abe8 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 @@ -65,9 +65,9 @@ public class DefaultRebalancePreChecker implements RebalancePreChecker { @Override public Map<String, RebalancePreCheckerResult> check(PreCheckContext preCheckContext) { - String rebalanceJobId = preCheckContext._rebalanceJobId; - String tableNameWithType = preCheckContext._tableNameWithType; - TableConfig tableConfig = preCheckContext._tableConfig; + String rebalanceJobId = preCheckContext.getRebalanceJobId(); + String tableNameWithType = preCheckContext.getTableNameWithType(); + TableConfig tableConfig = preCheckContext.getTableConfig(); LOGGER.info("Start pre-checks for table: {} with rebalanceJobId: {}", tableNameWithType, rebalanceJobId); Map<String, RebalancePreCheckerResult> preCheckResult = new HashMap<>(); @@ -79,13 +79,13 @@ public class DefaultRebalancePreChecker implements RebalancePreChecker { // Check if all servers involved in the rebalance have enough disk space for rebalance operation. // Notice this check could have false positives (disk utilization is subject to change by other operations anytime) preCheckResult.put(DISK_UTILIZATION_DURING_REBALANCE, - checkDiskUtilization(preCheckContext._currentAssignment, preCheckContext._targetAssignment, - preCheckContext._tableSubTypeSizeDetails, _diskUtilizationThreshold, true)); + checkDiskUtilization(preCheckContext.getCurrentAssignment(), preCheckContext.getTargetAssignment(), + preCheckContext.getTableSubTypeSizeDetails(), _diskUtilizationThreshold, true)); // Check if all servers involved in the rebalance will have enough disk space after the rebalance. // TODO: give this check a separate threshold other than the disk utilization threshold preCheckResult.put(DISK_UTILIZATION_AFTER_REBALANCE, - checkDiskUtilization(preCheckContext._currentAssignment, preCheckContext._targetAssignment, - preCheckContext._tableSubTypeSizeDetails, _diskUtilizationThreshold, false)); + checkDiskUtilization(preCheckContext.getCurrentAssignment(), preCheckContext.getTargetAssignment(), + preCheckContext.getTableSubTypeSizeDetails(), _diskUtilizationThreshold, false)); LOGGER.info("End pre-checks for table: {} with rebalanceJobId: {}", tableNameWithType, rebalanceJobId); return preCheckResult; diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/RebalancePreChecker.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/RebalancePreChecker.java index ddd9bd3102..b95ecc75a0 100644 --- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/RebalancePreChecker.java +++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/RebalancePreChecker.java @@ -31,12 +31,12 @@ public interface RebalancePreChecker { double diskUtilizationThreshold); class PreCheckContext { - protected final String _rebalanceJobId; - protected final String _tableNameWithType; - protected final TableConfig _tableConfig; - protected final Map<String, Map<String, String>> _currentAssignment; - protected final Map<String, Map<String, String>> _targetAssignment; - protected final TableSizeReader.TableSubTypeSizeDetails _tableSubTypeSizeDetails; + private final String _rebalanceJobId; + private final String _tableNameWithType; + private final TableConfig _tableConfig; + private final Map<String, Map<String, String>> _currentAssignment; + private final Map<String, Map<String, String>> _targetAssignment; + private final TableSizeReader.TableSubTypeSizeDetails _tableSubTypeSizeDetails; public PreCheckContext(String rebalanceJobId, String tableNameWithType, TableConfig tableConfig, Map<String, Map<String, String>> currentAssignment, Map<String, Map<String, String>> targetAssignment, @@ -48,6 +48,30 @@ public interface RebalancePreChecker { _targetAssignment = targetAssignment; _tableSubTypeSizeDetails = tableSubTypeSizeDetails; } + + public String getRebalanceJobId() { + return _rebalanceJobId; + } + + public String getTableNameWithType() { + return _tableNameWithType; + } + + public TableConfig getTableConfig() { + return _tableConfig; + } + + public Map<String, Map<String, String>> getCurrentAssignment() { + return _currentAssignment; + } + + public Map<String, Map<String, String>> getTargetAssignment() { + return _targetAssignment; + } + + public TableSizeReader.TableSubTypeSizeDetails getTableSubTypeSizeDetails() { + return _tableSubTypeSizeDetails; + } } Map<String, RebalancePreCheckerResult> check(PreCheckContext preCheckContext); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org