maytasm commented on a change in pull request #11850:
URL: https://github.com/apache/druid/pull/11850#discussion_r738844146



##########
File path: 
server/src/test/java/org/apache/druid/server/coordinator/duty/NewestSegmentFirstPolicyTest.java
##########
@@ -935,6 +937,66 @@ public void 
testIteratorReturnsSegmentsAsSegmentsWasCompactedAndHaveDifferentOri
     Assert.assertFalse(iterator.hasNext());
   }
 
+  @Test
+  public void 
testIteratorReturnsSegmentsAsSegmentsWasCompactedAndHaveDifferentRollup()
+  {
+    // Same indexSpec as what is set in the auto compaction config
+    Map<String, Object> indexSpec = mapper.convertValue(new IndexSpec(), new 
TypeReference<Map<String, Object>>() {});
+    // Same partitionsSpec as what is set in the auto compaction config
+    PartitionsSpec partitionsSpec = 
NewestSegmentFirstIterator.findPartitinosSpecFromConfig(ClientCompactionTaskQueryTuningConfig.from(null,
 null));
+
+    // Create segments that were compacted (CompactionState != null) and have
+    // rollup=false for interval 2017-10-01T00:00:00/2017-10-02T00:00:00,
+    // rollup=true for interval 2017-10-02T00:00:00/2017-10-03T00:00:00,
+    // and rollup=null for interval 2017-10-03T00:00:00/2017-10-04T00:00:00
+    final VersionedIntervalTimeline<String, DataSegment> timeline = 
createTimeline(

Review comment:
       This test should also cover that case. Here we have:
   - segments with interval 2017-10-01T00:00:00/2017-10-02T00:00:00 and 
rollup=false in compaction state
   - segments with interval 2017-10-02T00:00:00/2017-10-03T00:00:00 and 
rollup=true in compaction state
   - segments with interval 2017-10-03T00:00:00/2017-10-04T00:00:00 and 
rollup=null in compaction state (this means that the last time this 
segment/interval was compacted, the rollup value was not set in the auto 
compaction config).
   Then we set auto compaction config with rollup=true. 
   We then expect that the segments with interval 
2017-10-02T00:00:00/2017-10-03T00:00:00 are not returned since rollup in last 
compaction state is same as auto compaction config
   We expect segments with interval 2017-10-01T00:00:00/2017-10-02T00:00:00 and 
segments with interval 2017-10-03T00:00:00/2017-10-04T00:00:00 to be returned.




-- 
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