Fix NPE in CompactSegments (#16713)

This commit is contained in:
Kashif Faraz 2024-07-09 23:51:52 -07:00 committed by GitHub
parent 7c625356c5
commit 616ae631c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -234,12 +234,13 @@ public class CompactSegments implements CoordinatorCustomDuty
Granularity configuredSegmentGranularity = dataSourceCompactionConfig.getGranularitySpec() Granularity configuredSegmentGranularity = dataSourceCompactionConfig.getGranularitySpec()
.getSegmentGranularity(); .getSegmentGranularity();
Granularity taskSegmentGranularity = compactionTaskQuery.getGranularitySpec().getSegmentGranularity(); Granularity taskSegmentGranularity = compactionTaskQuery.getGranularitySpec().getSegmentGranularity();
if (configuredSegmentGranularity.equals(taskSegmentGranularity)) { if (configuredSegmentGranularity == null
|| configuredSegmentGranularity.equals(taskSegmentGranularity)) {
return false; return false;
} }
LOG.info( 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 compactionTaskQuery.getId(), taskSegmentGranularity, configuredSegmentGranularity
); );
overlordClient.cancelTask(compactionTaskQuery.getId()); overlordClient.cancelTask(compactionTaskQuery.getId());