gianm commented on a change in pull request #6206: Fix NPE in 
KafkaSupervisor.checkpointTaskGroup
URL: https://github.com/apache/incubator-druid/pull/6206#discussion_r212204330
 
 

 ##########
 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:
   I think that we don't want to stop/kill all tasks in the taskGroup just 
because one of them has processed all assigned events. It could be a checkpoint 
for an incremental handoff, and we want all tasks to continue running even 
after the checkpoint. Am I understanding this right?
   
   In other words, it sounds to me like we want to stop/kill all other tasks if 
any of them has _finished_ (status = success) but we don't want to stop/kill 
them if it was an incremental handoff.

----------------------------------------------------------------
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]

Reply via email to