guruguha commented on a change in pull request #5718:
URL: https://github.com/apache/incubator-pinot/pull/5718#discussion_r463895752
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java
##########
@@ -485,4 +503,80 @@ private void deleteSegmentsInternal(String
tableNameWithType, List<String> segme
throw new ControllerApplicationException(LOGGER, e.getMessage(),
Response.Status.FORBIDDEN);
}
}
+
+ @GET
+ @Path("segments/{tableName}/reload-status")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Status of segment reload", notes = "Status of segment
reload")
+ public Map<String, ServerSegmentMetadataReader.TableReloadStatus>
getReloadStatus(
+ @ApiParam(value = "Name of the table", required = true)
@PathParam("tableName") String tableName,
+ @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String
tableTypeStr) {
+ TableType tableType = Constants.validateTableType(tableTypeStr);
+ if (tableType == TableType.REALTIME) {
+ throw new ControllerApplicationException(LOGGER,
+ "Table type : " + tableTypeStr + " not yet supported.",
Status.NOT_IMPLEMENTED);
+ }
+
+ List<String> tableNamesWithType = getExistingTableNamesWithType(tableName,
Constants.validateTableType(tableTypeStr));
+ Map<String, ServerSegmentMetadataReader.TableReloadStatus> reloadStatusMap
= new HashMap<>();
+ for (String tableNameWithType : tableNamesWithType) {
+ ServerSegmentMetadataReader.TableReloadStatus tableReloadStatus;
+ try {
+ tableReloadStatus = getSegmentsReloadStatus(tableNameWithType);
+ } catch (InvalidConfigException e) {
+ throw new ControllerApplicationException(LOGGER, e.getMessage(),
Status.BAD_REQUEST);
+ }
+ reloadStatusMap.put(tableNameWithType, tableReloadStatus);
+ }
+ return reloadStatusMap;
+ }
+
+ private ServerSegmentMetadataReader.TableReloadStatus
getSegmentsReloadStatus(String tableNameWithType)
+ throws InvalidConfigException {
+ TableMetadataReader tableMetadataReader =
+ new TableMetadataReader(_executor, _connectionManager,
_pinotHelixResourceManager);
+ return tableMetadataReader.getReloadStatus(tableNameWithType,
+ _controllerConf.getServerAdminRequestTimeoutSeconds() * 1000);
+ }
+
+ @GET
+ @Path("segments/{tableName}/metadata")
+ @Produces(MediaType.APPLICATION_JSON)
+ @ApiOperation(value = "Get the server metadata for all table segments",
notes = "Get the server metadata for all table segments")
+ public Map<String, String> getServerMetadata(@ApiParam(value = "Name of the
table", required = true) @PathParam("tableName") String tableName,
+ @ApiParam(value =
"OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr) {
+ LOGGER.info("Received a request to fetch metadata for all segments for
table {}", tableName);
+ TableType tableType = Constants.validateTableType(tableTypeStr);
+ if (tableType == TableType.REALTIME) {
+ throw new ControllerApplicationException(LOGGER,
+ "Table type : " + tableTypeStr + " not yet supported.",
Status.NOT_IMPLEMENTED);
+ }
+
+ String tableNameWithType = getExistingTableNamesWithType(tableName,
tableType).get(0);
+ Map<String, String> segmentsMetadata;
+ try {
+ segmentsMetadata = getSegmentsMetadataFromServer(tableNameWithType);
+ } catch (InvalidConfigException e) {
+ throw new ControllerApplicationException(LOGGER, e.getMessage(),
Status.BAD_REQUEST);
+ } catch (IOException ioe) {
+ throw new ControllerApplicationException(LOGGER,
+ "Error parsing Pinot server response: " + ioe.getMessage(),
Status.INTERNAL_SERVER_ERROR, ioe);
Review comment:
Logged in the helper class
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]