This is an automated email from the ASF dual-hosted git repository.
kfaraz 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 a28cc248641 Fix NPE in
OverlordCompactionScheduler.getAllCompactionSnapshots() (#19118)
a28cc248641 is described below
commit a28cc248641d8e40e09218938a1c31f6761d94ca
Author: Virushade <[email protected]>
AuthorDate: Wed Mar 11 12:16:20 2026 +0800
Fix NPE in OverlordCompactionScheduler.getAllCompactionSnapshots() (#19118)
---
.../compact/OverlordCompactionScheduler.java | 2 +-
.../compact/OverlordCompactionSchedulerTest.java | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git
a/indexing-service/src/main/java/org/apache/druid/indexing/compact/OverlordCompactionScheduler.java
b/indexing-service/src/main/java/org/apache/druid/indexing/compact/OverlordCompactionScheduler.java
index 11709e616c7..cf368473e1b 100644
---
a/indexing-service/src/main/java/org/apache/druid/indexing/compact/OverlordCompactionScheduler.java
+++
b/indexing-service/src/main/java/org/apache/druid/indexing/compact/OverlordCompactionScheduler.java
@@ -183,7 +183,7 @@ public class OverlordCompactionScheduler implements
CompactionScheduler
this.overlordClient = new LocalOverlordClient(taskMaster, taskQueryTool,
objectMapper);
this.brokerClient = brokerClient;
this.activeSupervisors = new ConcurrentHashMap<>();
- this.datasourceToCompactionSnapshot = new AtomicReference<>();
+ this.datasourceToCompactionSnapshot = new
AtomicReference<>(Collections.emptyMap());
this.latestJobQueue = new AtomicReference<>();
this.taskActionClientFactory = taskActionClientFactory;
diff --git
a/indexing-service/src/test/java/org/apache/druid/indexing/compact/OverlordCompactionSchedulerTest.java
b/indexing-service/src/test/java/org/apache/druid/indexing/compact/OverlordCompactionSchedulerTest.java
index 4c98b52f48c..5c598024c15 100644
---
a/indexing-service/src/test/java/org/apache/druid/indexing/compact/OverlordCompactionSchedulerTest.java
+++
b/indexing-service/src/test/java/org/apache/druid/indexing/compact/OverlordCompactionSchedulerTest.java
@@ -480,6 +480,27 @@ public class OverlordCompactionSchedulerTest
scheduler.stopBeingLeader();
}
+ @Test
+ public void test_getAllCompactionSnapshots_returnsEmpty_beforeFirstRun()
+ {
+ Assert.assertTrue(scheduler.isEnabled());
+ Assert.assertFalse(scheduler.isRunning());
+
+ Assert.assertTrue(scheduler.getAllCompactionSnapshots().isEmpty());
+ }
+
+ @Test
+ public void
test_getCompactionSnapshot_returnsAwaitingFirstRunWithActiveSupervisor_beforeFirstRun()
+ {
+ scheduler.startCompaction(dataSource, createSupervisorWithInlineSpec());
+
+ AutoCompactionSnapshot snapshot =
scheduler.getCompactionSnapshot(dataSource);
+ Assert.assertEquals(
+ AutoCompactionSnapshot.ScheduleStatus.AWAITING_FIRST_RUN,
+ snapshot.getScheduleStatus()
+ );
+ }
+
private void createSegments(int numSegments, Granularity granularity,
DateTime firstSegmentStart)
{
final List<DataSegment> segments = CreateDataSegments
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]