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 00:04:17 UTC

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

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


##########
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:
   Is there a race here? Could the state be set to STOPPING between this check and the entry into `synchronized (stateChangeLock)`?



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