npawar commented on code in PR #8828: URL: https://github.com/apache/pinot/pull/8828#discussion_r900607520
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java: ########## @@ -543,6 +559,78 @@ public SuccessResponse reloadSegmentDeprecated2( return reloadSegmentDeprecated1(tableName, segmentName, tableTypeStr); } + @GET + @Path("tables/{tableName}/segmentReloadStatus/{taskId}") + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Get status for a submitted reload operation", + notes = "Get status for a submitted reload operation") + public ServerReloadTaskStatusResponse getReloadTaskStatus( + @ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName, + @ApiParam(value = "Reload task id", required = true) @PathParam("taskId") String reloadTaskId) + throws Exception { + Map<String, String> taskZKMetadata = null; + + // Call all servers to get status, collate and return + List<String> tableNamesWithType = + ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager, tableName, null, LOGGER); + + Set<String> instances = new HashSet<>(); + for (String tableNameWithType : tableNamesWithType) { + Map<String, List<String>> serverToSegments = _pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType); + instances.addAll(serverToSegments.keySet()); + + if (taskZKMetadata == null) { + taskZKMetadata = _pinotHelixResourceManager.getTaskZKMetadata(tableNameWithType, reloadTaskId); + } + } + + BiMap<String, String> serverEndPoints = _pinotHelixResourceManager.getDataInstanceAdminEndpoints(instances); + CompletionServiceHelper completionServiceHelper = + new CompletionServiceHelper(_executor, _connectionManager, serverEndPoints); + + List<String> serverUrls = new ArrayList<>(); + BiMap<String, String> endpointsToServers = serverEndPoints.inverse(); + for (String endpoint : endpointsToServers.keySet()) { + String reloadTaskStatusEndpoint = endpoint + "/task/status/" + reloadTaskId; + serverUrls.add(reloadTaskStatusEndpoint); + } + + CompletionServiceHelper.CompletionServiceResponse serviceResponse = Review Comment: But the realtime and offline table can be on completely different servers -- 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