gianm commented on a change in pull request #6206: Fix NPE in
KafkaSupervisor.checkpointTaskGroup
URL: https://github.com/apache/incubator-druid/pull/6206#discussion_r212829932
##########
File path:
extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/supervisor/KafkaSupervisor.java
##########
@@ -1480,31 +1506,38 @@ private void checkTaskDuration() throws
InterruptedException, ExecutionException
String taskId = taskEntry.getKey();
TaskData task = taskEntry.getValue();
- if (task.status.isSuccess()) {
- // If any task in this group has already completed, stop the rest of
the tasks in the group and return.
- // This will cause us to create a new set of tasks next cycle that
will start from the offsets in
- // metadata store (which will have advanced if we succeeded in
publishing and will remain the same if publishing
- // failed and we need to re-ingest)
- return Futures.transform(
- stopTasksInGroup(taskGroup),
- new Function<Object, Map<Integer, Long>>()
- {
- @Nullable
- @Override
- public Map<Integer, Long> apply(@Nullable Object input)
+ // task.status can be null if any runNotice is processed before
kafkaSupervisor is stopped gracefully.
+ if (task.status != null) {
+ if (task.status.isSuccess()) {
+ // If any task in this group has already completed, stop the rest
of the tasks in the group and return.
+ // This will cause us to create a new set of tasks next cycle that
will start from the offsets in
+ // metadata store (which will have advanced if we succeeded in
publishing and will remain the same if
+ // publishing failed and we need to re-ingest)
+ return Futures.transform(
+ stopTasksInGroup(taskGroup),
+ new Function<Object, Map<Integer, Long>>()
{
- return null;
+ @Nullable
+ @Override
+ public Map<Integer, Long> apply(@Nullable Object input)
+ {
+ return null;
+ }
}
- }
- );
- }
+ );
+ }
- if (task.status.isRunnable()) {
- if
(taskInfoProvider.getTaskLocation(taskId).equals(TaskLocation.unknown())) {
- log.info("Killing task [%s] which hasn't been assigned to a
worker", taskId);
- killTask(taskId);
- i.remove();
+ if (task.status.isRunnable()) {
+ if
(taskInfoProvider.getTaskLocation(taskId).equals(TaskLocation.unknown())) {
+ log.info("Killing task [%s] which hasn't been assigned to a
worker", taskId);
+ killTask(taskId);
+ i.remove();
+ }
}
+ } else {
+ log.info("Killing task [%s] of unknown status", taskId);
Review comment:
> Hmm, good point. I thought it makes sense to kill them because the
supervisor is currently killing running tasks if they are not allocated to
middleManagers yet.
I think killing unassigned running tasks does make sense, since if a task
hasn't even started running yet, it has no hope of catching up so we should
just cancel it. However, if there is some risk that the task actually is
running but the supervisor just doesn't know where yet, this killing might be
over-eager. If that's the case I think it'd be an issue for a separate PR
though.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]