npawar commented on a change in pull request #6336: URL: https://github.com/apache/incubator-pinot/pull/6336#discussion_r549535850
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java ########## @@ -355,6 +354,61 @@ public SuccessResponse reloadSegment( } } + /** + * Resets the segment of the table, by disabling and then enabling it. + * This API will take segments to OFFLINE state, wait for External View to stabilize, and then back to ONLINE/CONSUMING state, + * thus effective in resetting segments or consumers in error states. + */ + @POST + @Path("segments/{tableNameWithType}/{segmentName}/reset") + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Resets a segment by first disabling it, waiting for external view to stabilize, and finally enabling it again", + notes = "Resets a segment by disabling and then enabling a segment") + public SuccessResponse resetSegment( + @ApiParam(value = "Name of the table with type", required = true) @PathParam("tableNameWithType") String tableNameWithType, + @ApiParam(value = "Name of the segment", required = true) @PathParam("segmentName") @Encoded String segmentName, + @ApiParam(value = "Time in millis to wait for external view to converge") @QueryParam("externalViewWaitTimeMs") long externalViewWaitTimeMs) { + segmentName = URIUtils.decode(segmentName); + TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableNameWithType); + try { + Preconditions.checkState(tableType != null, "Must provide table name with type: %s", tableNameWithType); Review comment: It does show up. ``` { "code": 404, "error": "Failed to reset segments in table: foo_REALTIME. Could not find ideal state for table: foo_REALTIME" } ``` Also, all places which you've commented for 4xx are already throwing 4xx. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org