This is an automated email from the ASF dual-hosted git repository.
capistrant pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 7b16171c38c Double check that the TaskQueue is still active before
managing the queued tasks. (#18772)
7b16171c38c is described below
commit 7b16171c38c04d801f170f8f59727808d9b10c8d
Author: Lucas Capistrant <[email protected]>
AuthorDate: Sat Nov 22 13:50:01 2025 -0600
Double check that the TaskQueue is still active before managing the queued
tasks. (#18772)
---
.../apache/druid/indexing/overlord/TaskQueue.java | 4 +++-
.../druid/indexing/overlord/TaskQueueTest.java | 27 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
index 985579b923a..6d056ca66d3 100644
---
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
+++
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
@@ -379,7 +379,9 @@ public class TaskQueue
{
startStopLock.readLock().lock();
try {
- startPendingTasksOnRunner();
+ if (isActive()) {
+ startPendingTasksOnRunner();
+ }
}
finally {
startStopLock.readLock().unlock();
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
index 71441862bff..4d0733dfade 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
@@ -188,6 +188,33 @@ public class TaskQueueTest extends IngestionTestBase
Assert.assertEquals(0, stats.get(Stats.TaskQueue.STATUS_UPDATES_IN_QUEUE));
}
+ @Test
+ public void testManageQueuedTasksDoesNothingWhenInactive() throws Exception
+ {
+ // Add a task to the queue while active
+ final TestTask task = new TestTask("t1", Intervals.of("2021-01/P1M"));
+ taskQueue.add(task);
+
+ // Now set the queue to inactive (simulating stop())
+ taskQueue.setActive(false);
+
+ // Call manageQueuedTasks - it should exit early without starting the task
+ taskQueue.manageQueuedTasks();
+
+ // Verify task was NOT started (it should still be incomplete)
+ Assert.assertFalse(task.isDone());
+
+ // Verify task is still in queue
+ final Optional<TaskInfo> taskInfo =
taskQueue.getActiveTaskInfo(task.getId());
+ Assert.assertTrue(taskInfo.isPresent());
+ Assert.assertEquals(TaskState.RUNNING,
taskInfo.get().getStatus().getStatusCode());
+
+ // Verify no metrics were emitted since no tasks were processed
+ serviceEmitter.verifyNotEmitted("task/waiting/time");
+ serviceEmitter.verifyNotEmitted("task/run/time");
+ }
+
+
@Test
public void testShutdownReleasesTaskLock() throws Exception
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]