somandal commented on code in PR #16341: URL: https://github.com/apache/pinot/pull/16341#discussion_r2211387208
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancer.java: ########## @@ -1813,9 +1865,63 @@ public int fetch(String segmentName) { } } + @VisibleForTesting + @FunctionalInterface + interface DataLossRiskAssessor { + boolean hasDataLossRisk(String segmentName); + } + + private static class DataLossRiskAssessorImpl implements DataLossRiskAssessor { + private final String _tableNameWithType; + private final HelixManager _helixManager; + private final boolean _isPeerDownloadEnabled; + private final boolean _isUpsertOrDedupTable; + private final boolean _isPauselessEnabled; + + private DataLossRiskAssessorImpl(String tableNameWithType, TableConfig tableConfig, HelixManager helixManager) { + _tableNameWithType = tableNameWithType; + _helixManager = helixManager; + _isPeerDownloadEnabled = !StringUtils.isEmpty(tableConfig.getValidationConfig().getPeerSegmentDownloadScheme()); + _isUpsertOrDedupTable = tableConfig.isUpsertEnabled() || tableConfig.isDedupEnabled(); + _isPauselessEnabled = PauselessConsumptionUtils.isPauselessEnabled(tableConfig); + } + + @Override + public boolean hasDataLossRisk(String segmentName) { Review Comment: now modified the code to use a NoOp assessor if minAvailableReplicas > 0 or peer download is disabled. that should make it easier to follow. Also added the validations for the downtime rebalance case as well. -- 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