klsince commented on code in PR #15266: URL: https://github.com/apache/pinot/pull/15266#discussion_r2033692672
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/ZkBasedTableRebalanceObserver.java: ########## @@ -284,4 +319,255 @@ public static TableRebalanceProgressStats.RebalanceStateStats getDifferenceBetwe (totalSegments == 0) ? 0 : ((double) rebalanceStats._segmentsToRebalance / totalSegments) * 100.0; return rebalanceStats; } + + /** + * Calculates the progress stats for the given step or for the overall based on the trigger type + * @param targetAssignment target assignment (either updated IS or the target end IS depending on the step) + * @param currentAssignment current assignment (either EV or the current IS depending on the step) + * @param rebalanceContext rebalance context + * @param trigger reason to trigger the stats update + * @param rebalanceProgressStats current value of the rebalance progress stats, used to calculate the next + * @return the calculated step or progress stats + */ + @VisibleForTesting + static TableRebalanceProgressStats.RebalanceProgressStats calculateUpdatedProgressStats( + Map<String, Map<String, String>> targetAssignment, Map<String, Map<String, String>> currentAssignment, + RebalanceContext rebalanceContext, Trigger trigger, TableRebalanceProgressStats rebalanceProgressStats) { + Map<String, Set<String>> existingServersToSegmentMap = new HashMap<>(); + Map<String, Set<String>> newServersToSegmentMap = new HashMap<>(); + Map<String, Set<String>> targetInstanceToOfflineSegmentsMap = new HashMap<>(); + Set<String> newSegmentsNotExistingBefore = new HashSet<>(); + + // Segments to monitor is the list of segments that are being moved as part of the table rebalance that the + // table rebalance intends to track convergence for. This list usually includes segments from the last next Review Comment: typo? "... from the last next ..." -- 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