gianm commented on a change in pull request #6206: Fix NPE in
KafkaSupervisor.checkpointTaskGroup
URL: https://github.com/apache/incubator-druid/pull/6206#discussion_r212164734
##########
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:
Do we really want to kill the task in this case -- I thought it could only
happen for a supervisor that is stopping gracefully? Maybe we should just
ignore the task, and log a warning, rather than killing it?
----------------------------------------------------------------
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]