Repository navigation
Make test_multi_consumer_with_partition_affinity deterministic - #120556
Merged
antaljanosbenjamin merged 2 commits intoSep 25, 2026
Merged
antaljanosbenjamin merged 2 commits into
antaljanosbenjamin merged 2 commits into
Conversation
aparajita31pandey
marked this pull request as draft
September 17, 2026 09:58
aparajita31pandey
marked this pull request as ready for review
September 18, 2026 05:08
Contributor
|
Workflow [PR], commit [900a831] Summary: ✅ AI ReviewSummaryThis PR tries to make Findings
Final VerdictStatus:
|
antaljanosbenjamin
approved these changes
Sep 24, 2026
Member
|
Backporting to fix CI |
clickhouse-gh Bot
added a commit
that referenced
this pull request
Sep 25, 2026
Backport #120556 to 26.9: Make test_multi_consumer_with_partition_affinity deterministic
kewin-robetti
pushed a commit
to viasoftkorp/ClickHouse
that referenced
this pull request
Oct 2, 2026
…tition_affinity deterministic
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.
Changelog category (leave one):
Problem
test_multi_consumer_with_partition_affinity, added in #116843, has been failing at ~0.06% (8 of 11654 runs). Every genuine failure is this test alone in an otherwise healthy job, on sanitizer builds, with:It asserts a liveness property, that every replica holds at least one partition, which StorageKafka2 does not currently guarantee on a short timescale. Details in #116844.
Why a replica can legitimately hold nothing
The anti-starvation guard in KeeperHandlingConsumer::lockTemporaryLocksLocked is gated on the consumer already holding a temporary lock:
A sibling consumer on the same replica whose
tmp_locks_quotais 0 skips the guard entirely and takes a temporary lock, even while a peer replica holds nothing. This test produces no data after setup, so a poll cycle runs toMAX_FAILED_POLL_ATTEMPTSand lock holders only re-evaluate roughly every ~89 s. Against the 240 s wait, the starved replica gets about two chances. In the failures analysed, the release window was open for 36 ms while the starved replica polls every 573 ms; in one case it lost by 2 ms.None of this is specific to the assertion being wrong about the product .
What this PR changes
Updated the testcase to fix assertion based on below
A replica can hold
node_quotapermanent locks plus at most one temporary lock per consumer — lockTemporaryLocksLocked only ever flips tmp_locks_quota between 0 and 1 — so 4 + 2 = 6 is a hard upper bound that holds at any instant and needs no convergence.The resize is what makes that assertion worth having: 6 < P_shard = 8, so the pre-#116843 behaviour (every consumer receiving the full node_quota, one replica taking the entire shard) trips it. At the old sizing the ceiling would have been 2 + 4 = 6 against a shard of 4 — true for every possible distribution, and therefore never able to fail. The docstring records this so the numbers are not "simplified" back later.
Updated the testcase to fix assertion based on below
tmp_locks_quotawould always oscillate between 0 and 1Workflow [PR]
Sync PR [sync-upstream/pr/120556]
Version info
26.10.1.659-master(included in26.10and later)26.9.3.36