tibrewalpratik17 commented on code in PR #14257:
URL: https://github.com/apache/pinot/pull/14257#discussion_r1812336110


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/PinotTaskManager.java:
##########
@@ -589,6 +601,13 @@ private synchronized List<String> scheduleTask(String 
taskType, List<String> tab
     PinotTaskGenerator taskGenerator = 
_taskGeneratorRegistry.getTaskGenerator(taskType);
     Preconditions.checkState(taskGenerator != null, "Task type: %s is not 
registered", taskType);
 
+    TaskState taskState = 
_helixTaskResourceManager.getTaskQueueState(taskType);
+    if (TaskState.STOPPED.equals(taskState) || 
TaskState.STOPPING.equals(taskState)) {
+      LOGGER.warn("Task queue is in state: {}. Tasks won't be scheduled for 
taskType: {} and tables: {}. Resume task "
+          + "queue before attempting to schedule tasks.", taskState.name(), 
taskType, tables);
+      return new ArrayList<>();
+    }

Review Comment:
   Ah my bad! You are right. Orthogonal to this PR, we should consider 
refactoring the class a bit to move everything to call one single method (maybe 
the below one). This way all validations and improvements can be limited to one 
single method.
   ```
   private List<String> scheduleTask(PinotTaskGenerator taskGenerator, 
List<TableConfig> enabledTableConfigs,
         boolean isLeader, @Nullable String minionInstanceTagForTask)
   ```



-- 
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-unsubscr...@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to