Repository navigation
Fix flaky test 04839_parallel_replicas_cancel_before_announcement - #122773
PedroTadim merged 2 commits into
Conversation
The test failed on master in `Stateless tests (amd_tsan, s3 storage, sequential, 2/2)`: `partial_result_on_first_cancel did_not_wait` became 0 because the timed query took 1652 ms against the 1500 ms bound. On the s3 lanes the test table lived on the object-storage disk. Opening a part there takes `MetadataStorageFromDisk::metadata_mutex` shared, and every metadata commit on that disk (`MetadataStorageFromDiskTransaction::commit`) holds it exclusively. In the failing job a `system.metric_log` merge with 2184 columns held it for about 1.6 s and the one-granule read waited for it; commits in the same job took up to 2.6 s, so no bound below the 3 s `parallel_replicas_delay_announcement` delay is safe. The table now uses `storage_policy = 'default'`, the local disk, which has no disk-wide metadata lock. Nothing the test guards is storage-specific. The failing run had also drawn `automatic_parallel_replicas_mode = 2` (p = 0.25 in the runner), which only collects statistics and runs the single-node plan: no follower was contacted, so such a run cannot catch the regression the test exists for. `automatic_parallel_replicas_mode = 0` is added to the test's own parallel-replicas settings, which every timed query uses. A `Random settings limits` clamp is not used, because the runner applies the mode-2 bundle (client-level `enable_parallel_replicas = 1` and friends) before the clamp, which would turn every auxiliary query of the test into a parallel-replicas query while the delay failpoint is enabled. Validated on a debug build: a one-granule read of an s3 table waits up to 337 ms in `readMetadata` during concurrent 2000-column inserts while the same read of a `default`-policy table takes at most 7 ms; with a forced client-level mode 2 the old test runs no parallel replicas and the new one uses them in every timed query; with the initiator fix of ClickHouse#114862 reverted the new test fails 10/10 randomized and 5/5 in mode 2, while the old one passes in mode 2; 50/50 randomized runs pass on a local-disk and on an s3-backed server. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A timed query that falls back to a single-node read passes every other line of the test without reaching the cancel path, as the failing run with `automatic_parallel_replicas_mode = 2` did. Assert that all five cancel queries have `ParallelReplicasUsedCount > 0`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex): 1 finding on the first head, 0 on the re-review of the fixed head.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-48:20260928-220700 |
|
Workflow [PR], commit [e179228] Summary: ✅ AI ReviewSummaryThis PR makes TestsNot run locally; review is based on code inspection. Final Verdict✅ No new review findings. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The test
04839_parallel_replicas_cancel_before_announcementnow keeps its table on the local disk and pinsautomatic_parallel_replicas_mode = 0for its parallel-replicas queries, and checks that those queries actually use parallel replicas.Description
Related: #114862 (added the test)
Failed on master in
Stateless tests (amd_tsan, s3 storage, sequential, 2/2)(report):partial_result_on_first_cancel did_not_waitbecame0, the query took 1652 ms against the 1500 ms bound.Two causes, both in that job's logs:
MetadataStorageFromDisk::metadata_mutexshared, and every metadata commit holds it exclusively. Asystem.metric_logmerge committed for ~1.6 s and the query's read waited for it. Commits there took up to 2.6 s, so no bound below the 3 s failpoint delay is safe.automatic_parallel_replicas_mode = 2(a quarter of randomized runs do), which runs the single-node plan, so it could not have caught the regression the test is for.The table now uses
storage_policy = 'default', andautomatic_parallel_replicas_mode = 0is added to the test's parallel-replicas settings. The test now also checks that all five cancel queries used parallel replicas (ParallelReplicasUsedCount > 0). The 1500 ms bound and the failpoints are unchanged.Validation (debug build):
readMetadata), at most 7 ms on adefault-policy table.automatic_parallel_replicas_mode=2: the old test passes 5/5 without parallel replicas, the new one uses them in every timed query.used_parallel_replicas 0) instead of passing it.The
metadata_mutexcontention itself (reported earlier in #41831) is not changed here.Workflow [PR]
Sync PR [sync-upstream/pr/122773]
Version info
26.10.1.1200-master(included in26.10and later)