mcvsubbu commented on code in PR #8551:
URL: https://github.com/apache/pinot/pull/8551#discussion_r851555399
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java:
##########
@@ -643,6 +650,23 @@ public String getParentTaskName(String taskType, String
taskName) {
return TASK_PREFIX + taskType + TASK_NAME_SEPARATOR + taskName;
}
+ public String getTaskMetadataByTable(String taskType, String
tableNameWithType) {
+ ZkHelixPropertyStore<ZNRecord> propertyStore =
_helixResourceManager.getPropertyStore();
+ ZNRecord raw = MinionTaskMetadataUtils.fetchTaskMetadata(propertyStore,
taskType, tableNameWithType);
+ Preconditions
+ .checkState(raw != null, "Found task metadata for task type: %s for
table: %s", taskType, tableNameWithType);
+ try {
+ return JsonUtils.objectToString(raw);
+ } catch (JsonProcessingException e) {
+ throw new RuntimeException("Failed to convert task metadata to Json
format", e);
Review Comment:
should this be a 5xx return?
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotHelixTaskResourceManager.java:
##########
@@ -643,6 +650,23 @@ public String getParentTaskName(String taskType, String
taskName) {
return TASK_PREFIX + taskType + TASK_NAME_SEPARATOR + taskName;
}
+ public String getTaskMetadataByTable(String taskType, String
tableNameWithType) {
+ ZkHelixPropertyStore<ZNRecord> propertyStore =
_helixResourceManager.getPropertyStore();
+ ZNRecord raw = MinionTaskMetadataUtils.fetchTaskMetadata(propertyStore,
taskType, tableNameWithType);
+ Preconditions
Review Comment:
so, if the metadata is not there, we return 5xx? Please change it to return
a 4xx.
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTaskRestletResource.java:
##########
@@ -149,6 +149,28 @@ public Map<String, TaskState> getTaskStatesByTable(
return _pinotHelixTaskResourceManager.getTaskStatesByTable(taskType,
tableNameWithType);
}
+ @GET
+ @Path("/tasks/{taskType}/{tableNameWithType}/metadata")
+ @ApiOperation("Get task metadata for the given task type and table")
+ public String getTaskMetadataByTable(
+ @ApiParam(value = "Task type", required = true) @PathParam("taskType")
String taskType,
+ @ApiParam(value = "Table name with type", required = true)
@PathParam("tableNameWithType")
+ String tableNameWithType) {
+ return _pinotHelixTaskResourceManager.getTaskMetadataByTable(taskType,
tableNameWithType);
+ }
+
+ @DELETE
Review Comment:
helix deletes task metadata after sometime, right ? Why provide an endpoint
to delete it? Have you verified with helix that this ok? and there is no race
condition?
--
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]