kfaraz commented on code in PR #14880:
URL: https://github.com/apache/druid/pull/14880#discussion_r1331642096
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractTask.java:
##########
@@ -216,6 +232,23 @@ public void cleanUp(TaskToolbox toolbox, TaskStatus
taskStatus) throws Exception
}
}
+ @Override
+ public boolean waitForCleanupToFinish()
+ {
+ try {
+ if (cleanupCompletionLatch != null) {
+ // block until the cleanup process completes
+ return cleanupCompletionLatch.await(30, TimeUnit.SECONDS);
Review Comment:
Is 30 seconds typically enough time for the cleanup to finish?
I think 5 minutes might be better as the cleanup seems to be doing a bunch
of things - update status, update location, push task reports, .
It might also be good to
- log a warning message if the cleanup could not be finished in time and the
latch returned `false`.
- log an info message for the time taken to finish the cleanup (or is it
already being done in `cleanup` method?)
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractTask.java:
##########
@@ -178,14 +183,25 @@ public final TaskStatus run(TaskToolbox taskToolbox)
throws Exception
throw e;
}
finally {
- cleanUp(taskToolbox, taskStatus);
+ try {
+ cleanUp(taskToolbox, taskStatus);
+ }
+ finally {
+ cleanupCompletionLatch.countDown();
+ }
}
}
public abstract TaskStatus runTask(TaskToolbox taskToolbox) throws Exception;
+ @Override
public void cleanUp(TaskToolbox toolbox, TaskStatus taskStatus) throws
Exception
{
+ if (Thread.currentThread().isInterrupted()) {
Review Comment:
I think this might not be needed. You could just use `Thread.interrupted` to
have the same effect.
--
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]