Repository navigation
Stabilize flaky test_modify_column_comment_only_on_cluster - #108983
alexey-milovidov merged 1 commit into
Conversation
An ON CLUSTER ALTER returns once the distributed DDL task is finished on every host, which does not guarantee the change is already visible in that host's in-memory metadata (what SHOW CREATE / system.columns read): the replicated ALTER_METADATA entry or the local settings/comment fast path can still be in flight, especially right after the replica restart the test performs. The test asserted on a single immediate SHOW CREATE read per replica and raced that window (failed on slow builds, 0 master). Poll SHOW CREATE / system.columns until the expected value converges before asserting (wait_show_create / wait_column_order helpers), matching the assert_eq_with_retry idiom of the sibling test_alter_comment_on_cluster. The asserts are unchanged, so a value that never converges still fails the test. The ZooKeeper /metadata version checks stay immediate (synchronous source of truth that verifies routing correctness). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-1:20260630-185600 |
|
cc @tavplubix — could you review this? It stabilizes the flaky |
|
Workflow [PR], commit [9369f93] Summary: ✅ AI ReviewSummaryThis PR stabilizes Final VerdictStatus: ✅ Approve |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 300 line(s) across 14 file(s) · Details Top files
|
But why? |
|
Because ON CLUSTER returns once every host has written its
So when the ON CLUSTER query returns, only the executing replica is guaranteed to have the new metadata in memory; the other replica has reported The settings/comment fast path is different (routed to every replica and applied inline), but the poll is applied uniformly and the asserts themselves are unchanged, so nothing is weakened. |
…-modify-column-comment-on-cluster Stabilize flaky test_modify_column_comment_only_on_cluster
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Stabilize the flaky integration test
test_alter_settings_or_comment_on_cluster::test_modify_column_comment_only_on_cluster(and its two sibling tests in the same file).An
ALTER ... ON CLUSTERreturns once the distributed DDL task has finished on every host. That does not guarantee the just-applied change is already reflected in a host's in-memory metadata, which is whatSHOW CREATE/system.columnsread: the replicatedALTER_METADATAlog entry (or the local settings/comment fast path) can still be in flight on a replica, especially right after the replica restart this test performs. The test asserted on a single immediateSHOW CREATEread per replica, so it raced that propagation window and intermittently failed (observed almost exclusively on slow builds, e.g.arm_binary, distributed planandamd_msan; 0 master failures).Failure signature (e.g.
Integration tests (arm_binary, distributed plan)):The previous comment is still shown because the last
MODIFY COLUMN ... String COMMENT 'modcol-with-type'had not yet become visible onch1when the assert ran.Fix (test-only): poll
SHOW CREATE/system.columnsuntil the expected value converges before asserting, via two small helpers (wait_show_create,wait_column_order) — the sameassert_eq_with_retryconvergence idiom already used by the siblingtest_alter_comment_on_cluster. The asserts themselves are unchanged, so a value that never converges still fails the test with the finalSHOW CREATE: the test keeps its full ability to catch a real routing/divergence regression. The ZooKeeper/metadataversion checks stay immediate — they read ZooKeeper directly (synchronous source of truth) and are what verify the routing (fast-path vs replicated-log) correctness.Validated with the local integration runner (debug build): the whole suite passed 30/30 (10 iterations x 3 tests). A standalone simulation of a lagging
SHOW CREATEconfirms the old single-read pattern fails the race while the polling helper converges, and a never-converging value still fails (intent preserved).