Repository navigation
fix: Fix Flaky StreamAppenderatorTest assertions on Windows #20602 - #20626
Open
Nimish2098 wants to merge 1 commit into
Open
Nimish2098 wants to merge 1 commit into
Nimish2098 wants to merge 1 commit into
Conversation
| Assertions.assertEquals(2, segmentGenerationMetrics.numPersists()); | ||
| Assertions.assertEquals(3, segmentGenerationMetrics.rowOutput()); | ||
| Assertions.assertTrue(segmentGenerationMetrics.persistTimeMillis() > 0); | ||
| Assertions.assertTrue(segmentGenerationMetrics.persistTimeMillis() >= 0); |
Member
There was a problem hiding this 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20602
Description
Fixed a flaky test in
StreamAppenderatorTestwherepersistTimeMillis()andmergeTimeMillis()could occasionally evaluate to0in extremely fast execution environments, causing assertion failures. Updated the assertions from> 0to>= 0.Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
Key changed/added classes in this PR
StreamAppenderatorTestThis PR has: