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/09/13 02:22:04 UTC

[GitHub] [druid] AmatyaAvadhanula commented on a diff in pull request #13072: Faster fix for dangling tasks upon supervisor termination

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


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -1454,20 +1454,23 @@ public void runInternal()
 
       checkCurrentTaskState();
 
-      synchronized (stateChangeLock) {
-        // if supervisor is not suspended, ensure required tasks are running
-        // if suspended, ensure tasks have been requested to gracefully stop
-        if (stateManager.getSupervisorState().getBasicState().equals(SupervisorStateManager.BasicState.STOPPING)) {
-          // if we're already terminating, don't do anything here, the terminate already handles shutdown
-          log.info("[%s] supervisor is already stopping.", dataSource);
-        } else if (!spec.isSuspended()) {
-          log.info("[%s] supervisor is running.", dataSource);
-
-          stateManager.maybeSetState(SeekableStreamSupervisorStateManager.SeekableStreamState.CREATING_TASKS);
-          createNewTasks();
-        } else {
-          log.info("[%s] supervisor is suspended.", dataSource);
-          gracefulShutdownInternal();
+      // If supervisor is already stopping, don't contend for stateChangeLock since the block can be skipped
+      if (!stateManager.getSupervisorState().getBasicState().equals(SupervisorStateManager.BasicState.STOPPING)) {

Review Comment:
   There is an additional check within the synchronized block to see if it has been set to STOPPING.
   The first check was added with the intent to prevent the need to enter that block once the supervisor has begun stopping.
   One such scenario is when a supervisor tries to terminate just before the CREATING_TASKS phase which can be reproduced by terminating a supervisor, after a period of its configured startDelay, right after creation. 



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