Repository navigation
Batch CREATE TABLE loop in test_replicated_database::test_sync_replica - #107379
Conversation
Pre-PR validation gate
CIDB: across 5647 passing runs in the last 30 days on Tracking issue: #107378 Session id: cron:clickhouse-worker-slot-0:20260613-054200 |
|
cc @tavplubix - could you review? Test-only change: adds |
|
Workflow [PR], commit [df0f1a8] Summary: ✅ AI ReviewSummary
Final Verdict
|
|
CI fully finished on The change is a single Session: cron:our-pr-ci-monitor:20260613-113000 |
| # Creating 1000 tables serially plus the SYSTEM SYNC and two DROP DATABASE SYNC | ||
| # legitimately approach the global 900s pytest-timeout on the slowest sanitizer | ||
| # flavors (asan+ubsan, db disk, old analyzer), where passing runs already reach ~873s. | ||
| @pytest.mark.timeout(1800) |
There was a problem hiding this comment.
@groeneai This is the wrong fix. Please investigate why it times out, so we can actually fix it or, if it's not possible then make the test smaller. Increasing time outs is not ok
127b15e to
d0649ad
Compare
|
@Algunenano Agreed, dropped the timeout marker. Made the test smaller instead: The runtime is strictly linear in the table count (serial CREATE loop ~0.7s/table dominates the ~915s intrinsic time), so it was a workload-size problem, not a hang. Reducing the count keeps the exact code path the test exercises: the disconnected replica still replays the queued CREATE backlog via incremental log-replay on reconnect. That path is gated by Measured on the failing flavor (amd_asan_ubsan, db disk, old analyzer): passes in ~86s, vs the ~915s that was tripping the 900s budget. |
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-3:20260615-160100 |
|
@groeneai Do you mind checking why it takes 0.7 seconds to create a single table, please? Seems too high |
|
You're right that it's too high, and it isn't the server. I measured it from the
So ~87% of the per-table time is the test harness, not ClickHouse. Net: the 0.7s/table is harness + sanitizer overhead, ~32x the engine work, and not a DatabaseReplicated regression. The 1000->100 reduction stands as the fix. If you'd want the loop itself cheaper independent of count, batching the CREATEs into one client invocation (multi-statement, or |
Let's try this instead please |
The test created 1000 tables in a Python loop, one node.query() call per table. The integration harness (tests/integration/helpers/client.py) spawns a fresh clickhouse-client subprocess per node.query(), so each table paid process start + TCP connect + auth + teardown. Measured on the failing flavor (amd_asan_ubsan, db disk, old analyzer): server-side CREATE was ~33ms median, but the harness idled ~406ms between requests, so ~87% of the ~0.47s per-table wall time was harness overhead, not the engine. Total runtime crept to ~915s and crossed the 900s pytest-timeout. Submit all 1000 CREATE statements in a single client invocation (one multi-statement string through one node.query()). This keeps the original 1000-table count (the disconnected-replica DDL-log catch-up coverage is unchanged: each CREATE is still its own DDL queue entry replayed on reconnect) while removing the per-table process spawn. Runtime on the same flavor drops from ~915s to 224s. Closes ClickHouse#107378 Co-Authored-By: Claude Opus 4.8 <[email protected]>
d0649ad to
df0f1a8
Compare
|
Done. Replaced the per-table loop with a single client invocation: all CREATE TABLE statements go through one With the loop now cheap independent of count, I restored the original Measured on the same flavor ( |
Pre-PR validation gate
Session id: cron:clickhouse-worker-slot-1:20260615-200900 |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 300 line(s), 32 function(s) across 116 file(s) · Details Top files
|
|
CI finished on HEAD
No PR-caused failures. The batched-CREATE test rewrite passed CI. Ready for review. Session id: cron:our-pr-ci-monitor:20260615-233000 |
Backport #107379 to 26.5: Batch CREATE TABLE loop in test_replicated_database::test_sync_replica
…eplicated_database::test_sync_replica
Closes: #107378
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
test_replicated_database::test_sync_replicacreated 1000 tables in a Python loop, onenode.query()per table. The integration harness (tests/integration/helpers/client.py) spawns a freshclickhouse-clientsubprocess pernode.query(), so each table paid process start + TCP connect + auth + teardown.Measured on the failing flavor (
amd_asan_ubsan, db disk, old analyzer): server-side CREATE was ~33ms median, but the harness idled ~406ms between requests, so ~87% of the ~0.47s per-table wall time was harness overhead, not the engine. Total runtime crept to ~915s and crossed the 900s pytest-timeout (#107378).Fix: submit all 1000 CREATE statements in a single client invocation (one multi-statement string through one
node.query()). This keeps the original 1000-table count, so the disconnected-replica DDL-log catch-up coverage is unchanged (each CREATE is still its own DDL queue entry, replayed on reconnect viaSYSTEM SYNC DATABASE REPLICA), while removing the per-table process spawn.Runtime on the same flavor (
Integration tests (amd_asan_ubsan, db disk, old analyzer, 4/6)) drops from ~915s to 224s, verified locally (1 passed in 223.66s).Version info
26.6.1.879(included in26.6and later)26.5.6.110