cryptoe commented on code in PR #13304:
URL: https://github.com/apache/druid/pull/13304#discussion_r1014662915


##########
server/src/main/java/org/apache/druid/server/coordinator/duty/NewestSegmentFirstIterator.java:
##########
@@ -129,6 +130,12 @@ public class NewestSegmentFirstIterator implements 
CompactionSegmentIterator
             // For example, if the original is interval of 
2020-01-28/2020-02-03 with WEEK granularity
             // and the configuredSegmentGranularity is MONTH, the segment will 
be split to two segments
             // of 2020-01/2020-02 and 2020-02/2020-03.
+            if (Intervals.ETERNITY.equals(segment.getInterval())
+                && !Granularities.ALL.equals(configuredSegmentGranularity)) {
+              // This is to prevent the coordinator from crashing as raised in 
https://github.com/apache/druid/issues/13208
+              log.warn("Cannot compact segments from ALL to finer granularity 
for datasource[%s]", dataSource);

Review Comment:
   ```suggestion
                 log.warn("Cannot compact segments from ALL to finer 
granularity[%s] for datasource[%s]", configuredSegmentGranularity, dataSource);
   ```



##########
server/src/test/java/org/apache/druid/server/coordinator/duty/NewestSegmentFirstPolicyTest.java:
##########
@@ -1584,6 +1585,38 @@ public void 
testIteratorDoesNotReturnSegmentWithChangingAppendableIndexSpec()
     Assert.assertFalse(iterator.hasNext());
   }
 
+  @Test
+  public void testAllToFinerGranularity()

Review Comment:
   Does it make sense to have a test case having All to ALL granularity?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to