Skip to content

test: stabilize flaky streaming-aggregation memory test#222

Open
ghostiee-11 wants to merge 1 commit into
xqlsystems:mainfrom
ghostiee-11:fix/flaky-streaming-perf-test
Open

test: stabilize flaky streaming-aggregation memory test#222
ghostiee-11 wants to merge 1 commit into
xqlsystems:mainfrom
ghostiee-11:fix/flaky-streaming-perf-test

Conversation

@ghostiee-11

Copy link
Copy Markdown
Contributor

test_streaming_aggregation_does_not_explode flakes intermittently in CI (seen on Python 3.10 and 3.12 on recent PRs), always at ~124-125 MB against its 123.9 MB threshold (4 * source).

Root cause: DataFusion processes partitions concurrently, so the tracemalloc peak scales with the number of in-flight partitions (and therefore the runner's core count). Locally the peak varies roughly 1.2x to 4x the source run to run, so the 4x threshold sits inside that noise band and fails about 1 run in 3.

Fix: sample the peak a few times and assert on the minimum. The best run reflects the true streaming floor (~1.5x source, stable), while a regression that buffers the whole row set would keep every sample high, so the minimum still catches it. The 4x threshold is unchanged.

Verified: min-of-3 stayed at or below 1.92x across 25 local stress trials (vs the 4x threshold), and the test passes.

The tracemalloc peak of the streaming GROUP BY varies run to run (~1.2x-4x
the source) because DataFusion processes partitions concurrently, so the
number of in-flight partitions (and the peak) scales with the core count.
A single sample right at the 4x threshold flaked intermittently across
Python versions in CI.

Sample the peak a few times and assert on the minimum: the best run
reflects the true streaming floor (~1.5x source), while a regression that
buffers the whole row set would keep every sample high, so the minimum
still catches it. Threshold stays at 4x source size.

@alxmrs alxmrs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for deflaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants