swaminathanmanish commented on code in PR #10359: URL: https://github.com/apache/pinot/pull/10359#discussion_r1139383484
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java: ########## @@ -712,6 +715,37 @@ public String getTableState( } } + @GET + @Produces(MediaType.APPLICATION_JSON) + @Authenticate(AccessType.UPDATE) + @Path("/rebalanceStatus/{jobId}") + @ApiOperation(value = "Gets detailed stats of a rebalance operation", + notes = "Gets detailed stats of a rebalance operation") + public ServerRebalanceJobStatusResponse rebalanceStatus( + @ApiParam(value = "Rebalance Job Id", required = true) @PathParam("jobId") String jobId) + throws JsonProcessingException { + Map<String, String> controllerJobZKMetadata = + _pinotHelixResourceManager.getControllerJobZKMetadataForJobType(jobId, ControllerJobType.TABLE_REBALANCE); + + if (controllerJobZKMetadata == null) { + throw new ControllerApplicationException(LOGGER, "Failed to find controller job id: " + jobId, + Response.Status.NOT_FOUND); + } + TableRebalanceProgressStats tableRebalanceProgressStats = + JsonUtils.stringToObject(controllerJobZKMetadata.get(RebalanceConfigConstants.REBALANCE_PROGRESS_STATS), + TableRebalanceProgressStats.class); + Long timeSinceStartInSecs = 0L; + if (!tableRebalanceProgressStats.getStatus().toString().equals(RebalanceResult.Status.DONE.toString())) { + timeSinceStartInSecs = + (long) (System.currentTimeMillis() - tableRebalanceProgressStats.getStartTimeInMilliseconds()) / 1000; Review Comment: Its needed, as return type is double. Long (in seconds) makes sense for reporting stats -- 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