9aman commented on code in PR #14798:
URL: https://github.com/apache/pinot/pull/14798#discussion_r1916173997
##########
pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java:
##########
@@ -1248,6 +1249,63 @@ 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],
+ * "uploadURI": [leadControllerUrl],
+ * "uploadSegment": true
+ * }
+ */
+ //TODO: Add auth and https support
+ public void triggerReIngestion(String serverHostPort, String
tableNameWithType, String segmentName,
+ String leadControllerUrl)
+ throws IOException, URISyntaxException, HttpErrorStatusException {
+
+
+ if (serverHostPort.contains("http://")) {
+ serverHostPort = serverHostPort.replace("http://", "");
+ }
+
+ String serverHost = serverHostPort.split(":")[0];
+ String serverPort = serverHostPort.split(":")[1];
+
+ URI reIngestUri = getURI(HTTP, serverHost, Integer.parseInt(serverPort),
REINGEST_SEGMENT_PATH);
+
+ // Build the JSON payload
+ Map<String, Object> requestJson = new HashMap<>();
+ requestJson.put("tableNameWithType", tableNameWithType);
+ requestJson.put("segmentName", segmentName);
+ requestJson.put("uploadURI", leadControllerUrl);
+ requestJson.put("uploadSegment", true);
+
+ // Convert the request payload to JSON string
+ String jsonPayload = JsonUtils.objectToString(requestJson);
+ // Prepare a POST request with Simple HTTP
+ ClassicRequestBuilder requestBuilder = ClassicRequestBuilder
Review Comment:
+1
--
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]