J-HowHuang commented on code in PR #17494:
URL: https://github.com/apache/pinot/pull/17494#discussion_r2691618967


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java:
##########
@@ -984,29 +994,49 @@ public void uploadSegmentAsMultiPartV2(FormDataMultiPart 
multiPart,
   @Authenticate(AccessType.UPDATE)
   @Produces(MediaType.APPLICATION_JSON)
   @ApiOperation(value = "Start to replace segments", notes = "Start to replace 
segments")
-  public Response startReplaceSegments(
+  public void startReplaceSegments(
       @ApiParam(value = "Name of the table", required = true) 
@PathParam("tableName") String tableName,
       @ApiParam(value = "OFFLINE|REALTIME", required = true) 
@QueryParam("type") String tableTypeStr,
       @ApiParam(value = "Force cleanup") @QueryParam("forceCleanup") 
@DefaultValue("false") boolean forceCleanup,
       @ApiParam(value = "Fields belonging to start replace segment request", 
required = true)
-      StartReplaceSegmentsRequest startReplaceSegmentsRequest, @Context 
HttpHeaders headers) {
-    tableName = DatabaseUtils.translateTableName(tableName, headers);
-    TableType tableType = Constants.validateTableType(tableTypeStr);
-    if (tableType == null) {
-      throw new ControllerApplicationException(LOGGER, "Table type should 
either be offline or realtime",
-          Response.Status.BAD_REQUEST);
-    }
-    String tableNameWithType =
-        
ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager, 
tableName, tableType, LOGGER).get(0);
-    try {
-      String segmentLineageEntryId = 
_pinotHelixResourceManager.startReplaceSegments(tableNameWithType,
-          startReplaceSegmentsRequest.getSegmentsFrom(), 
startReplaceSegmentsRequest.getSegmentsTo(), forceCleanup,
-          startReplaceSegmentsRequest.getCustomMap());
-      return 
Response.ok(JsonUtils.newObjectNode().put("segmentLineageEntryId", 
segmentLineageEntryId)).build();
-    } catch (Exception e) {
-      _controllerMetrics.addMeteredTableValue(tableNameWithType, 
ControllerMeter.NUMBER_START_REPLACE_FAILURE, 1);
-      throw new ControllerApplicationException(LOGGER, e.getMessage(), 
Response.Status.INTERNAL_SERVER_ERROR, e);
-    }
+      StartReplaceSegmentsRequest startReplaceSegmentsRequest, @Context 
HttpHeaders headers,
+      @Suspended final AsyncResponse asyncResponse) {

Review Comment:
   This follows the examples from Jersey: 
https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/async.html



-- 
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]

Reply via email to