uds5501 commented on code in PR #18436:
URL: https://github.com/apache/druid/pull/18436#discussion_r2302974551
##########
server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorTest.java:
##########
@@ -2449,6 +2450,118 @@ public void testSchemaAnnouncement() throws Exception
}
}
+
+ @Test
+ public void test_abandonSegment_unlockIntervalWithOverlap() throws Exception
+ {
+ final List<Interval> unlockedIntervals = new ArrayList<>();
+ final TaskIntervalUnlocker mockUnlocker = interval -> {
+ synchronized (unlockedIntervals) {
+ unlockedIntervals.add(interval);
+ }
+ };
+
+ try (final StreamAppenderatorTester tester = new
StreamAppenderatorTester.Builder()
+ .basePersistDirectory(temporaryFolder.newFolder())
+ .maxRowsInMemory(2)
+ .releaseLocksOnHandoff(true)
+ .taskIntervalUnlocker(mockUnlocker)
+ .build()) {
+ final Appenderator appenderator = tester.getAppenderator();
+
+ appenderator.startJob();
+
+ final SegmentIdWithShardSpec identifier1 =
si("2000-01-01T00:00/2000-01-01T01:00", "version1", 0);
+ final SegmentIdWithShardSpec identifier2 =
si("2000-01-01T01:00/2000-01-01T02:00", "version1", 0);
+
+ final InputRow row1 = new MapBasedInputRow(
+ DateTimes.of("2000"),
+ ImmutableList.of("dim1"),
+ ImmutableMap.of("dim1", "bar", "met1", 1)
+ );
+
+ final InputRow row2 = new MapBasedInputRow(
+ DateTimes.of("2000-01-01T02:30"),
+ ImmutableList.of("dim1"),
+ ImmutableMap.of("dim1", "baz", "met1", 1)
+ );
+
+ appenderator.add(identifier1, row1,
Suppliers.ofInstance(Committers.nil()), false);
+ appenderator.add(identifier2, row2,
Suppliers.ofInstance(Committers.nil()), false);
+
+ Assert.assertEquals(2, appenderator.getSegments().size());
+
+ synchronized (unlockedIntervals) {
+ unlockedIntervals.clear();
+ }
Review Comment:
I did this for sanity in case the appenderator already dropped it (not
really required because it's being called later explicitly)
--
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]