9aman commented on code in PR #14920: URL: https://github.com/apache/pinot/pull/14920#discussion_r1942241681
########## pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java: ########## @@ -1274,6 +1275,47 @@ public File downloadUntarFileStreamed(URI uri, File dest, AuthProvider authProvi httpHeaders, maxStreamRateInByte); } + /** + * Invokes the server's reIngestSegment API via a POST request with JSON payload, + * using Simple HTTP APIs. + * + * POST http://[serverURL]/reIngestSegment + * { + * "tableNameWithType": [tableName], + * "segmentName": [segmentName] + * } + */ + public void triggerReIngestion(String serverHostPort, String tableNameWithType, String segmentName) + throws IOException, URISyntaxException, HttpErrorStatusException { + String scheme = HTTP; + if (serverHostPort.contains(HTTPS)) { + scheme = HTTPS; + serverHostPort = serverHostPort.replace(HTTPS + "://", ""); + } else if (serverHostPort.contains(HTTP)) { + serverHostPort = serverHostPort.replace(HTTP + "://", ""); + } + + String serverHost = serverHostPort.split(":")[0]; + String serverPort = serverHostPort.split(":")[1]; + + URI reIngestUri = getURI(scheme, serverHost, Integer.parseInt(serverPort), REINGEST_SEGMENT_PATH); + + Map<String, Object> requestJson = new HashMap<>(); + requestJson.put("tableNameWithType", tableNameWithType); + requestJson.put("segmentName", segmentName); + + String jsonPayload = JsonUtils.objectToString(requestJson); + SimpleHttpResponse response = + HttpClient.wrapAndThrowHttpException(_httpClient.sendJsonPostRequest(reIngestUri, jsonPayload)); + + // Check that we got a 2xx response + int statusCode = response.getStatusCode(); + if (statusCode / 100 != 2) { + throw new IOException(String.format("Failed POST to %s, HTTP %d: %s", Review Comment: Was the code updated here ? I see that the comment has been resolved but no changes in the code. -- 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