fix(datafusion-distributed): relax ttl map timing constraints #218
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.
Resolves #126: Fix flaky test
I believe the intention of the test is as follows:
ttl: 10msandtick: 2ms(garbage collector runs every tick, entries expire after 5 ticks)Say the final insertion of an entry into the map by an arbitrary tokio task occurs at time
T. Then in an idealized setting we'd expect this entry to be removed by the ttl map garbage collector at timeT + TTL, so it seems reasonable to assert that the map should be empty byT + 2 * TTL.The issue is:
10msassert_eventually(defined just above the test) that performs a check every10ms2msindependent of insertion timeIn the image, the blue lines represent the garbage collection operation, which in this configuration will occur every 2ms (size of
tick). It's possible for the final entry to be inserted just after a gc cycle, meaning that whenassert_eventuallyreachesT+10ms, the final entry has not expired. The entry is collected just afterwards, but looking at the wayassert_eventuallyis written, it does not actually check the final bound, meaning it is only checking1 * TTLin this configuration, leading to the flake.Combining the above with crowded CI machines that may also arbitrarily delay operations by a few ms, this test becomes noticeably flaky.
To resolve this problem, we boost the window to
100ms, which should be more than enough to resolve flakiness and will not meaningfully increase CI time.