Repository navigation
Backport #107119 to 25.8: Fix flaky test_async_load_databases::test_materialized_views_replicated - #108917
Conversation
…aterialized_views_replicated Cherry-pick of the test-only fix merged to `master` in #107119 (commit `6166517952c1`, change `e5479ff4869`). The fix is absent on `25.8`, where `test_materialized_views_replicated` still uses `disconnect_event.wait(90)` and un-timed INSERTs. Under sanitizers the server stop+start budget alone is ~120s, so a restart slower than the ignored 90s wait let the main thread race ahead, and an INSERT to a half-restarted server could block up to 600s and exhaust the 900s pytest session timeout. The fix waits 180s and asserts it, bounds each INSERT with `timeout=60`, catches `QueryTimeoutExceedException`, and stops the warm-up INSERT loop once the restart finishes or its budget elapses. This clears the `test_async_load_databases` failures observed on the `25.8` base and on `backport/25.8/*` PRs (e.g. #107889). True `master` has been clean since #107119 merged (2026-06-18). Closes: #108914 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [BackportPR], commit [7154c69] |
|
The only CI failure ( The backported tests themselves pass: The failing test is This is the known race tracked in #82719 and fixed on I opened the backport of that fix to |
|
Update: the re-run of This confirms the earlier analysis: the failure was the flaky Keeper TSan data race (#82719), not anything in this test-only backport. The backported tests The durable fix for the underlying race is the |
|
Merged the base `25.8` into this branch (`3e51fbda` → `7154c699`, The branch was ~1 day / 21 commits behind `25.8` and still showed a stale `FAILURE` commit status for `Integration tests (amd_tsan, 6/6)` (the flaky Keeper TSan The durable fix #108965 (backport of #100396 to `25.8`) merged into the base at 05:43 UTC today, so this merge pulls it in. The fresh |
The `initd_test` script in `ci/jobs/install_check.py` on `25.8` runs `clickhouse-client -q 'SELECT version()'` exactly once, immediately after the init.d wrapper prints `Server started`. The wrapper only checks that the pid file exists, but on a slow CI host (notably the `amd_debug` build) the server can take several seconds longer to open the TCP listener on port 9000. The test then fails with `Code: 210. DB::NetException: Connection refused (localhost:9000)`. In the same job the sibling `binary_test` already retries `SELECT version()` in a loop, and on `25.8` backport runs it routinely takes ~4 seconds (4 retries) before the debug server accepts connections, while `initd_test` gives up after the first attempt. This is the same failure mode as ClickHouse#86278, which was fixed on `master` by ClickHouse#106056 ("Extend `Run server init.d` retry budget from 5s to 30s"). That fix never reached `25.8`, so the flake keeps blocking `25.8` backport PRs (for example ClickHouse#108965 and ClickHouse#108917). Because the `25.8` `initd_test` predates the retry loop entirely, ClickHouse#106056 does not cherry-pick cleanly; this commit adapts the same fix by adding a 30-iteration poll loop that breaks early on success, matching the existing `binary_test` and `keeper_test` patterns. `SYSTEMCTL_SKIP_REDIRECT` is intentionally not added, since the `25.8` init.d script does not support it. Related: ClickHouse#86278, ClickHouse#106056 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Closes: #108914
Related: #107119
Related: #107889
Backport of the test-only fix #107119 (commit
6166517952c1) to the25.8release branch. The fix landed onmasteron 2026-06-18 but was never backported, sotest_async_load_databases::test_materialized_views_replicatedand::test_materialized_views_cascaded_multiplekeep flaking on the25.8base and on everybackport/25.8/*pull request built on it (e.g. #107889).On
25.8the test still usesdisconnect_event.wait(90)(return value ignored) and un-timed INSERTs. Under sanitizers the server stop+start budget alone is ~120s, so a restart slower than the ignored 90s wait lets the main thread race ahead, and an INSERT to a half-restarted server can block up to 600s and exhaust the 900s pytest session timeout. The fix waits 180s and asserts it, bounds each INSERT withtimeout=60, catchesQueryTimeoutExceedException, and stops the warm-up INSERT loop once the restart finishes or its budget elapses.Since #107119 merged, the CI database shows
masterclean (1879 OK / 0 FAIL across all sanitizers) while25.8still shows failures (59 OK / 7 FAIL) — full breakdown in #108914.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
25.8.26.9