You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/11/08 16:54:46 UTC

[GitHub] [druid] AmatyaAvadhanula commented on a diff in pull request #13328: Optimize metadata calls in SeekableStreamSupervisor

AmatyaAvadhanula commented on code in PR #13328:
URL: https://github.com/apache/druid/pull/13328#discussion_r1016889444


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -2276,17 +2280,33 @@ public Void apply(@Nullable Boolean result)
     );
   }
 
+  /**
+   * Determines whether a given task was created by the current version of the supervisor
+   * One can choose to pass a map of activeTasks. If the taskId doesn't correspond to any task in it, fallback to the db
+   * @param taskGroupId task group id
+   * @param taskId task id
+   * @param activeTaskMap Set of active tasks that were pre-fetched
+   * @return true if the task was created by the current supervisor
+   */
   @VisibleForTesting
-  public boolean isTaskCurrent(int taskGroupId, String taskId)
+  public boolean isTaskCurrent(int taskGroupId, String taskId, Map<String, Task> activeTaskMap)
   {
-    Optional<Task> taskOptional = taskStorage.getTask(taskId);
-    if (!taskOptional.isPresent() || !doesTaskTypeMatchSupervisor(taskOptional.get())) {
-      return false;
+    @SuppressWarnings("unchecked")
+    SeekableStreamIndexTask<PartitionIdType, SequenceOffsetType, RecordType> task;
+
+    if (activeTaskMap == null || !activeTaskMap.containsKey(taskId)) {
+      Optional<Task> taskOptional = taskStorage.getTask(taskId);

Review Comment:
   The issue is that a task may be complete, in which case we would like to shutdown other replicas belonging to the same task group.
   If such a complete task were to be marked as "not current", the replicas corresponding to its group wouldn't be shutdown by `checkCurrentTaskState`



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org