kfaraz commented on code in PR #16182:
URL: https://github.com/apache/druid/pull/16182#discussion_r1535127992
##########
indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java:
##########
@@ -970,15 +982,32 @@ public CoordinatorRunStats getQueueStats()
return stats;
}
- public Optional<Task> getActiveTask(String id)
+ /**
+ * Returns an optional containing the task payload after successfully
redacting credentials.
+ * Returns an absent optional if there is no task payload corresponding to
the taskId in memory.
+ * Throws JsonProcessingException if password could not be redacted due to
serialization / deserialization failure
+ */
+ public Optional<Task> getActiveTask(String id) throws JsonProcessingException
{
+ Task task;
giant.lock();
try {
- return Optional.fromNullable(tasks.get(id));
+ task = tasks.get(id);
}
finally {
giant.unlock();
}
+ if (task != null) {
+ try {
+ // Write and read the value using a mapper with password redaction
mixin.
+ task = jsonMapper.readValue(jsonMapper.writeValueAsString(task),
Task.class);
+ }
+ catch (JsonProcessingException e) {
+ log.error(e, "Failed to serialize or deserialize task with id [%s].",
task.getId());
+ throw e;
Review Comment:
We should throw a `DruidException` here that need not be caught in the
callers.
--
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]