Repository navigation
Fix flaky test_parallel_replicas_protocol backward-compat OPTIMIZE hang - #110129
Conversation
test_backward_compatability builds a 3-replica ReplicatedMergeTree mixing old release binaries (25.3, CLICKHOUSE_CI_MIN_TESTED_VERSION) with the build under test. It inserts once from nodes[0] and then ran `optimize table t final`. With a single insert the table has exactly one part, so FINAL only merges a part into itself (server log: "Merging 1 parts: from all_0_0_0 to all_0_0_0"). That no-op merge still creates a MERGE_PARTS log entry that every replica must execute. The old (25.3) replicas produce a byte-different merge result from the new build (CHECKSUM_DOESNT_MATCH: "3 compressed (expected 3) and 2 uncompressed ones (expected 3)"), so they discard their own merge and fall back to fetching the canonical part from the new replica. That fetch fallback only fires after a merge-retry backoff that can take ~10 minutes, while the synchronous OPTIMIZE (alter_sync=1) issued from an old replica blocks on its own queue entry and hits the integration client's 600s timeout, failing the test at the optimize line. The two parallel-replicas assertions (sum(a) and order by a limit 10) do not depend on part layout, so the no-op FINAL merge serves no purpose. Removing it eliminates the cross-version MERGE_PARTS entry entirely; the existing `system sync replica t` loop still guarantees every replica sees the data before the assertions. Verified with 20 consecutive local runs mixing 25.3 and the current build. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-3:20260712-001000 |
|
cc @nickitat — could you review this? It removes a no-op |
|
Workflow [PR], commit [2f69c7a] Summary: ✅ AI ReviewSummaryThis PR removes an unnecessary Missing context / blind spots
Final VerdictStatus: ✅ Approve |
CI finish ledger — 2f69c7aAll CI checks passed (Finish Workflow / Mergeable Check green, all Integration test batches green including the previously-flaky
Session id: cron:our-pr-ci-monitor:20260712-053000 |
…rolling_upgrade A single insert is one part, so OPTIMIZE FINAL is a no-op merge whose MERGE_PARTS log entry the 26.5 replicas cannot reproduce byte-identically across versions. It can hang for minutes and occasionally raises code 341 (log entry not processed, replica shut down), as seen on the amd_tsan Integration run. The assertions are part-layout-independent and the existing system sync replica loop already guarantees convergence. Mirrors the sibling fix in ClickHouse#110129 which removed the same no-op OPTIMIZE FINAL from test_backward_compatability. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…-replicas-protocol-optimize-hang Fix flaky test_parallel_replicas_protocol backward-compat OPTIMIZE hang
…rolling_upgrade A single insert is one part, so OPTIMIZE FINAL is a no-op merge whose MERGE_PARTS log entry the 26.5 replicas cannot reproduce byte-identically across versions. It can hang for minutes and occasionally raises code 341 (log entry not processed, replica shut down), as seen on the amd_tsan Integration run. The assertions are part-layout-independent and the existing system sync replica loop already guarantees convergence. Mirrors the sibling fix in ClickHouse#110129 which removed the same no-op OPTIMIZE FINAL from test_backward_compatability. Co-Authored-By: Claude Opus 4.8 <[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_backward_compatibility/test_parallel_replicas_protocol.py::test_backward_compatability, which intermittently fails with the client 600s timeout onoptimize table t final.test_backward_compatabilitybuilds a 3-replicaReplicatedMergeTreemixing old release binaries (25.3,CLICKHOUSE_CI_MIN_TESTED_VERSION) with the build under test. It inserts once fromnodes[0]and then ranoptimize table t final.With a single insert the table has exactly one part, so
FINALonly merges a part into itself (server log:Merging 1 parts: from all_0_0_0 to all_0_0_0). That no-op merge still creates aMERGE_PARTSlog entry every replica must execute. The old (25.3) replicas produce a byte-different merge result from the new build (CHECKSUM_DOESNT_MATCH: Different number of files: 3 compressed (expected 3) and 2 uncompressed ones (expected 3)), so they discard their own merge and fall back to fetching the canonical part from the new replica. That fetch fallback only fires after a merge-retry backoff that can take minutes, while the synchronousOPTIMIZE(alter_sync=1) issued from an old replica blocks on its own queue entry and hits the integration client's 600s timeout.The two parallel-replicas assertions (
sum(a)andorder by a limit 10) do not depend on part layout, so the no-opFINALmerge serves no purpose. Removing it eliminates the cross-versionMERGE_PARTSentry entirely; the existingsystem sync replica tloop still guarantees every replica sees the data before the assertions.Not PR-caused: the failure recurs on master and across unrelated PRs (~0.1% on
Integration tests (arm_binary, distributed plan, 3/4)); e.g. master run sha b5bea174, 2026-07-10.Verified with 20 consecutive local runs mixing 25.3 and the current build.
Version info
26.7.1.829(included in26.7and later)