Repository navigation
Fix flaky test_parallel_quorum_actually_quorum - #108433
Conversation
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260625-005300 |
|
cc @tavplubix — could you review? Test-only fix for the flaky |
|
Workflow [PR], commit [13b91d5] Summary: ✅ AI ReviewSummaryThis PR changes only Final VerdictStatus: ✅ Approve No required actions. |
test_parallel_quorum_actually_quorum partitions node2 off node1/node3 on port 9009 for the whole test. While partitioned, node2's GET_PART queue entries fail repeatedly and accumulate the ReplicatedMergeTree exponential fetch backoff (1<<num_tries ms, capped at max_postpone_time_for_failed_replicated_fetches_ms, default 60000). After the partition heals, the final "SYSTEM SYNC REPLICA q" must wait out that accumulated postpone before node2 re-fetches the 3 parts. Under the parallel sanitizer flaky-check (--dist=each, many concurrent clusters under ASAN) the backoff plus contention pushes the catch-up well past the barrier's tight 10s client-side timeout, so the test fails with "Client timed out!". Two changes, neither weakens an assertion: - Set max_postpone_time_for_failed_replicated_fetches_ms = 0 on the table so node2 retries fetches without the exponential postpone once it can reach its peers again (same idiom as test_lost_part / test_postpone_failed_tasks, which disable the analogous backoff settings for fault-window flakiness). - Raise the final SYSTEM SYNC REPLICA barrier timeout from 10s to 60s (the common value used by other integration tests) to absorb residual parallel sanitizer slowness. Correctness is still gated by the retrying assert_eq_with_retry(node2, count, "3") that follows, so a genuine "node2 never syncs" regression still fails there. Co-Authored-By: Claude Opus 4.8 <[email protected]>
fde7e87 to
13b91d5
Compare
|
Updated the fix after the Refined root cause: the failure is a client-side 10s timeout on the final Change (neither weakens an assertion):
Verified locally: |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 457 line(s), 14 function(s) across 128 file(s) · Details Top files
|
Backport #108433 to 26.6: Fix flaky test_parallel_quorum_actually_quorum
Fix flaky test_parallel_quorum_actually_quorum
…ff the sync must wait out test_different_credentials and test_credentials_and_no_credentials each run a phase with mismatched interserver credentials on purpose, so the reader replica's GET_PART for the writer's part is rejected 401 and enters the failed-entry backoff. ReplicatedMergeTreeQueue::getPostponeTimeMsForEntry gates re-execution for min(2^num_tries ms, <bound>) measured from last_exception_time_ms, where <bound> is max_postpone_time_for_failed_replicated_fetches_ms for GET_PART and ..._merges_ms for MERGE_PARTS, both defaulting to 60000 ms; the 2^num_tries term saturates against the bound from num_tries = 16, and nothing but a queue reload shortens it. Both tests then repair the credentials and call SYSTEM SYNC REPLICA with no mode keyword, i.e. SyncReplicaMode::DEFAULT, which snapshots every queue entry present at call time and waits for all of them, so the sync sits out whatever remains of that window while the client-side kill timer runs. Raising the client timeout cannot fix this, because the reachable window is the bound itself. Driving the entry to num_tries = 16 on the unfixed test, I measured a window of 59299 ms armed on it, 58705 ms still outstanding when the sync started, and a 60000 ms client cap still losing: the fetch succeeded 0.03 s after the client had been killed. So this sets both bounds to 0 on the table and keeps the two client budgets aligned with the four other sync sites in this file as a secondary guard. It is the same pairing that fixed test_parallel_quorum_actually_quorum (ClickHouse#108433); test_lost_part sets both bounds the same way, and tests/config/config.d/backoff_policy_25_4.xml zeroes them for the whole stateless suite. _fill_nodes builds the table for all four shards. That is neutral for the two matched-credential shards: with no failed entry last_exception_time_ms stays 0, so next_min_allowed_time_ms is already in the past and getPostponeTimeMsForEntry returns 0 whatever the bound is. With the bounds at 0 both sites pass at the old 10 s budget with the sync taking 0.115 s, and redden again with the original traceback when only the setting is removed. On the shipped tree the two syncs drop from 32.859 s and 16.043 s to 0.017 s and 0.015 s, so both tests stop waiting out a recovery window they previously sat through on every green run. No assertion changes, so genuinely broken replication still fails. The two syncs that keep a 10 s budget directly follow a TRUNCATE on the peer, so they drain a DROP_RANGE and need no interserver fetch at all. Recorded failures: 2 in 120 days, both on Integration tests (amd_llvm_coverage, 7/8), none on master. Co-Authored-By: Claude Opus 5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Fixes the flaky integration test
test_quorum_inserts_parallel/test.py::test_parallel_quorum_actually_quorum.Failure: the final line
node2.query("SYSTEM SYNC REPLICA q", timeout=10)raisesQueryTimeoutExceedException: Client timed out!. 100% of the 30-day CIDB failures are on slow sanitizer integration shards (asan / tsan / msan); ~13 distinct PRs + 2 master hits, none related to the failing test.Root cause: the test partitions
node2fromnode1/node3on the interserver port (9009) for the whole body. While partitioned,node2still reaches ZooKeeper, pulls the log and createsGET_PARTqueue entries, but every fetch fails ("Connection refused"). Each failure increments the entry'snum_tries, andReplicatedMergeTreeQueue::getPostponeTimeMsForEntryschedules the next attempt1 << num_triesms out (capped atmax_postpone_time_for_failed_replicated_fetches_ms, default60000). After enough failed tries the next retry is scheduled more than 10s out, so once the partition heals theSYSTEM SYNC REPLICAmust wait out that accumulated backoff and the client times out. On the slow sanitizer shards the partition phase lasts long enough fornum_triesto cross the threshold, which is why it is sanitizer-only.Fix: disable the fetch-failure backoff for this table (
max_postpone_time_for_failed_replicated_fetches_ms = 0) sonode2retries the fetch on the next queue tick after the partition heals. This is the same idiom used bytest_postpone_failed_tasks'sno_backoff_policy.xml. Quorum semantics and every assertion are unchanged.Validation: reproduced deterministically with a partition held long enough to drive
num_triespast the threshold. With the default backoff the 10sSYSTEM SYNC REPLICAtimes out; withmax_postpone_time_for_failed_replicated_fetches_ms = 0it completes within 10s.Version info
26.7.1.146(included in26.7and later)26.6.2.101