siddharthteotia commented on code in PR #9662:
URL: https://github.com/apache/pinot/pull/9662#discussion_r1008592103
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/TableRebalancer.java:
##########
@@ -383,6 +383,23 @@ public RebalanceResult rebalance(TableConfig tableConfig,
Configuration rebalanc
}
}
+ public RebalanceResult.Status rebalanceStatus(String tableNameWithType,
IdealState idealState,
+ ExternalView externalView) {
+
+ if (idealState == null) {
+ throw new IllegalStateException("ideal state is empty");
+ }
+ if (externalView == null) {
+ return RebalanceResult.Status.NO_OP;
+ }
+
+ if (isExternalViewConverged(tableNameWithType,
externalView.getRecord().getMapFields(),
+ idealState.getRecord().getMapFields(), true)) {
+ return RebalanceResult.Status.DONE;
Review Comment:
I am not sure if it makes sense / helpful enough to sort of implement a
stateless API to get status of rebalance task -- which was triggered separately
through some other API and is being done asynchronously on potentially a
different controller that this API call comes on
Relying on the fact that `ExternalView` is not the same as `IdealState` to
indicate Rebalance `IN_PROGRESS` could be misleading.
Segment assignment changes ideal state as soon as segment lands on
controller and up until server successfully downloads the segment etc,
`ExternalView` does not get updated. But this API will return rebalance is in
`IN_PROGRESS` even though rebalance may have already finished or could have
errored out etc.
So not sure if this is going to be super helpful / accurate.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]