Skip to content

Commit

Permalink
Fix NPE in CompactSegments (apache#16713)
Browse files Browse the repository at this point in the history
  • Loading branch information
kfaraz authored Jul 10, 2024
1 parent 7c62535 commit 616ae63
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,13 @@ private boolean cancelTaskIfGranularityChanged(
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());
Expand Down

0 comments on commit 616ae63

Please sign in to comment.