From 616ae631c62a98d2145af0a87a0e2ab3af199d1f Mon Sep 17 00:00:00 2001 From: Kashif Faraz Date: Tue, 9 Jul 2024 23:51:52 -0700 Subject: [PATCH] Fix NPE in CompactSegments (#16713) --- .../druid/server/coordinator/duty/CompactSegments.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/apache/druid/server/coordinator/duty/CompactSegments.java b/server/src/main/java/org/apache/druid/server/coordinator/duty/CompactSegments.java index 27f6d17638d..335912fe23e 100644 --- a/server/src/main/java/org/apache/druid/server/coordinator/duty/CompactSegments.java +++ b/server/src/main/java/org/apache/druid/server/coordinator/duty/CompactSegments.java @@ -234,12 +234,13 @@ public class CompactSegments implements CoordinatorCustomDuty Granularity configuredSegmentGranularity = dataSourceCompactionConfig.getGranularitySpec() .getSegmentGranularity(); Granularity taskSegmentGranularity = compactionTaskQuery.getGranularitySpec().getSegmentGranularity(); - if (configuredSegmentGranularity.equals(taskSegmentGranularity)) { + if (configuredSegmentGranularity == null + || configuredSegmentGranularity.equals(taskSegmentGranularity)) { return false; } LOG.info( - "Cancelling task [%s] as task segmentGranularity is [%s] but compaction config segmentGranularity is [%s]", + "Cancelling task[%s] as task segmentGranularity[%s] differs from compaction config segmentGranularity[%s].", compactionTaskQuery.getId(), taskSegmentGranularity, configuredSegmentGranularity ); overlordClient.cancelTask(compactionTaskQuery.getId());