You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "FrankChen021 (via GitHub)" <gi...@apache.org> on 2026/10/17 14:12:31 UTC
Re: [PR] fix: Fix Flaky StreamAppenderatorTest assertions on Windows #20602 (druid)
FrankChen021 commented on code in PR #20626:
URL: https://github.com/apache/druid/pull/20626#discussion_r4302972163
##########
server/src/test/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorTest.java:
##########
@@ -189,10 +189,10 @@ public void testSimpleIngestion() throws Exception
SegmentGenerationMetrics segmentGenerationMetrics = tester.getMetrics();
Assertions.assertEquals(2, segmentGenerationMetrics.numPersists());
Assertions.assertEquals(3, segmentGenerationMetrics.rowOutput());
- Assertions.assertTrue(segmentGenerationMetrics.persistTimeMillis() > 0);
+ Assertions.assertTrue(segmentGenerationMetrics.persistTimeMillis() >= 0);
Review Comment:
Thanks for the change. Updating the condition to use >= solves the flakiness problem, but it changes the semantics of the test case that `persistTimeMillis` should be updated.
The root cause here is: incrementPersistTimeMillis adds a millisecond value rounded down on every persist, so persists under 1 ms count as 0.
A better fix is(although the change is a little bit broader):
- SegmentGenerationMetrics: store persist time in nanoseconds, add persistTimeNanos(), and have persistTimeMillis() convert from nanoseconds.
- StreamAppenderator / BatchAppenderator: pass nanoseconds.
- TaskRealtimeMetricsMonitor: subtract in nanoseconds, then convert.
- Test: assert persistTimeNanos() > 0 and metrics.persistTimeMillis() == metrics.persistTimeNanos() / 1000_000
PR title and description should also be updated to reflect the change
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org