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


##########
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:
   Could you please share a better alternative to avoid waiting to enter the 
synchronized block after the supervisor has begun?
   The lock leads to a delay in the run itself and gracefulShutdown times out 
frequently in the specified case and there isn't anything to do in the block in 
such cases



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to