Skip to content

Split the release-branch db disk integration job into 6 batches so it fits its session timeout - #112261

Open
groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:plan/26-6-db-disk-shard-saturation
Open

groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:plan/26-6-db-disk-shard-saturation

Conversation

@groeneai

@groeneai groeneai commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

Integration tests (amd_asan_ubsan, db disk, N/4) runs only on release branches and every
shard is cut by its own session timeout:

!!!!!!! xdist.dsession.Interrupted: session-timeout: 7200.0 sec exceeded !!!!!!!

The split does not fit the budget. The job runs on AMD_MEDIUM, where
integration_test_job.py:722 sizes workers as
min(ncpu // MAX_CPUS_PER_WORKER, mem_gb // MAX_MEM_PER_WORKER) = min(16 // 5, 61 // 11) = 3
(confirmed in job.log: ncpu: 16, mem_gb: 61, -n 3 --dist=loadfile). The parallel
phase gets session_timeout_parallel = 3600 * 2 = 7200 s, so one shard has
7200 x 3 = 21 600 worker-seconds, while the integration corpus measures at least
~90 800 s on master and ~86 500 s on 26.6 (a lower bound: measured durations cover
1 013 of the 1 044 test modules in the tree) - a quarter of it is ~22 000 s, i.e. over
100 % of the budget before any scheduling loss. Whichever modules the workers happen to be running when
the clock expires get reported as failures, which is why both the failing modules and the
failing shard index differ from branch to branch.

Measured (CIDB, 12 d, pull_request_number = 0); timeout runs counts SHAs whose run
emitted the Timeout pseudo-test:

branch shard SHAs timeout runs avg test-seconds /3 workers % of 7200 s
26.7 1/4 28 28 21 649 7 216 100.2 %
26.7 3/4 28 28 21 567 7 189 99.8 %
26.6 4/4 47 47 21 636 7 212 100.2 %
26.6 2/4 47 42 21 294 7 098 98.6 %
26.5 3/4 33 27 21 410 7 137 99.1 %
26.4 3/4 35 21 21 792 7 264 100.9 %

Those per-shard figures are censored: the run is cut at the budget, so the sum clusters
just under 21 600 because the clock ran out, not because the work was 21 600 s. The true
demand is at least that.

The sibling db disk, old analyzer, N/6 job runs the same corpus on the same runner with the
same sanitizer build, the same worker count and the same budget, and has 0 timeouts
(13 263 - 17 445 test-seconds per shard, 61-81 % of budget; 256 master SHAs). That sibling
also gives an uncensored measurement of the corpus, since its runs are not truncated. On 26.6
sha 7367c762184ba3f6bce70b7905084f326654e305 its six shards summed to
13 800 / 15 130 / 15 379 / 16 745 / 14 180 / 13 429 = 88 663 test-seconds, worst shard
77.5 % of budget. Split that same measured total 4 ways instead and a shard needs 22 166 s,
102.6 % of the 21 600 worker-second budget; 6 ways gives 14 777 s, 68.4 %. This change
gives the db disk job the same 6-way split.

With real measured per-module durations, the assignment produced by the in-tree
get_optimal_test_batch():

origin/master   4-way: worst 7904s (109.8%)  mean 7569s (105.1%)  over-budget shards 4/4
origin/master   6-way: worst 5521s ( 76.7%)  mean 5046s ( 70.1%)  over-budget shards 0/6
origin/26.6     4-way: worst 7462s (103.6%)  mean 7207s (100.1%)  over-budget shards 3/4
origin/26.6     6-way: worst 5443s ( 75.6%)  mean 4805s ( 66.7%)  over-budget shards 0/6

6 rather than 8 follows e1b6984c9341e96, which reverted the old analyzer sibling from 8
back to 6. The worst 6-way shard sits at about 77 % of budget, so a ~25 % corpus growth
re-opens this; 6 is the value that both fits today and matches that decision.

Runner cost is roughly unchanged: two more concurrent AMD_MEDIUM jobs per release-branch
push, each about two thirds of the work of an old shard, against runs that currently burn a
full two hours only to be aborted.

A shard times out with zero test failures

The clearest evidence that the timeout is the cause and the test failures are the symptom
is shard 4/4 on 26.6 sha 3ffa9682053c719b7e7edd8e94f49d858e4aa7eb:

!!!!!!! xdist.dsession.Interrupted: session-timeout: 7200.0 sec exceeded !!!!!!!
========== 1405 passed, 40 skipped, 31 warnings in 7249.47s (2:00:49) ==========

Last progress marker [gw2] [ 94%]. Shard 1/4 on sha
7367c762184ba3f6bce70b7905084f326654e305 reached [gw3] [ 96%] and reported
7 failed, 1062 passed, 79 skipped, 9 errors in 7302.32s. So today roughly 4-6 % of each
over-budget shard never executes, and the truncation is reported as test failures.

Two plausible causes that the measurements rule out

Memory pressure: grep -c "Out of memory" and grep -c "OOM" are both 0 on those two
job.log files, the 4/4 log has no node down line at all and still timed out, and the
harness's own OOM in dmesg check reports zero rows for every db disk shard over 20 days.

Stale RAW_TEST_DURATIONS: 26.7 carries the refreshed table and has the worst timeout rate
of any branch (28/28 on 1/4, 28/28 on 3/4). A better duration table only rebalances within a
total that does not fit; the static table's 4-way spread is 9 188 / 9 184 / 9 283 / 9 188 s,
an imbalance of 1.1 %.

Batch count alone does not imply overload

Two other 4-way integration jobs are healthy and are deliberately left alone:
arm_binary, distributed plan, N/4 (0 timeouts over 258 SHAs, 9 680-11 177 test-seconds per
shard) and amd_cfi, N/4 (0 timeouts, 8 940-11 099). They run the same module set -
get_parallel_sequential_tests_to_run globs the whole corpus and its only corpus filter is
gated on amd_llvm_coverage, which neither takes - and their per-shard module counts are in
the same range as this job's (arm_binary 239-284 per shard against db disk's 189-229). What
differs is the build: they run CH_ARM_BINARY and CH_AMD_CFI, this job runs
CH_AMD_ASAN_UBSAN. Comparing the same module measured under both, the median per-module
ratio is 2.03 for asan against arm_binary (87 734 s against 44 484 s over 1 032 common
modules) and 2.12 against cfi (89 267 s against 42 759 s over 1 038). So a sanitizer build
roughly doubles the wall-clock of an identical corpus, which is why 4 batches fit one and not
the other. All seven parametrized integration jobs were checked against CIDB; db disk, N/4
is the only one over budget.

Notes

.github/workflows/release_branches.yml is regenerated with python3 -m ci.praktika yaml
rather than edited by hand, and is committed here so that _check_yaml_up_to_date does not
have to push a corrective commit. It is the only generated workflow that names this job.

Check names change from db disk, N/4 to db disk, N/6, so dashboards, mute lists or saved
queries keyed on the old literal stop matching and CIDB history does not carry over. The same
rename already happened for the old analyzer sibling in e1b6984c9341e96. No in-tree
consumer hardcodes the old names.

This PR's own CI cannot exercise ReleaseBranchCI, so it does not test the change. After it
reaches a release branch the db disk, N/6 shards should show no Timeout rows.

Release branches do not receive master CI-config commits after they are cut - each runs
ReleaseBranchCI from its own committed release_branches.yml, and
git rev-list --count $(git merge-base origin/master origin/26.6)..origin/26.6 -- ci/defs/job_configs.py
is 0 - so merging this fixes 26.8 and later, but not the live branches. Could a maintainer
apply the appropriate vX.Y-must-backport label once this is merged? A version-specific
label expands to that release plus every newer active branch, so v26.4-must-backport would
cover 26.4 through 26.7 in one go. I am not hand-authoring release-branch PRs.


Workflow [PR]
Sync PR [sync-upstream/pr/112261]

Integration tests (amd_asan_ubsan, db disk, N/4) is release-branch-only and
every shard is cut by its own session timeout:

    xdist.dsession.Interrupted: session-timeout: 7200.0 sec exceeded

The split does not fit the budget. On AMD_MEDIUM the job gets
min(ncpu // MAX_CPUS_PER_WORKER, mem_gb // MAX_MEM_PER_WORKER)
= min(16 // 5, 61 // 11) = 3 workers, and session_timeout_parallel is
3600 * 2 = 7200 s, so a shard has 21600 worker-seconds. The integration
corpus measures ~90800 s on master and ~86500 s on 26.6, so a quarter of it
is ~22000 s, over 100% of the budget before any scheduling loss. Whichever
modules the workers are running when the clock expires get reported as
failures, which is why both the failing modules and the failing shard index
differ from branch to branch.

Measured over 12 days on master-less refs (CIDB, pull_request_number = 0),
counting SHAs whose run emitted the Timeout pseudo-test: 26.7 shard 1/4
28/28 and shard 3/4 28/28, 26.6 shard 4/4 47/47 and shard 2/4 42/47,
26.5 shard 3/4 27/33, 26.4 shard 3/4 21/35. Those per-shard duration sums
are censored, since the run is cut at the budget, so the true demand is at
least that.

The sibling db disk, old analyzer, N/6 job runs the same corpus on the same
runner with the same worker count and the same budget and has no timeouts at
all, at 13263-17445 test-seconds per shard (61-81% of budget over 256 master
SHAs). This gives db disk the same 6-way split: with real measured
per-module durations fed through the in-tree get_optimal_test_batch(), the
worst shard goes from 109.8% to 76.7% of budget on master and from 103.6% to
75.6% on 26.6, with no shard over budget in either case.

Two plausible causes are ruled out by measurement. It is not memory: both
sampled job.log files contain no out-of-memory line, the shard that timed out
with 1405 passed and 0 failed has no node-down line either, and the harness's
own OOM in dmesg check reports nothing for any db disk shard over 20 days.
It is not a stale RAW_TEST_DURATIONS table: 26.7 carries the refreshed table
and has the worst timeout rate of any branch, and the static table's 4-way
spread is only 1.1% imbalanced, which cannot explain a 100% overrun.

Batch count alone does not imply overload, so two other 4-way integration
jobs are left alone: arm_binary, distributed plan, N/4 and amd_cfi, N/4 both
have no timeouts because they run filtered subsets totalling about 43000 s
and 41500 s, under half the corpus. All seven parametrized integration jobs
were checked; db disk, N/4 is the only one over budget.

6 rather than 8 follows e1b6984, which reverted the old analyzer
sibling from 8 back to 6.

.github/workflows/release_branches.yml is regenerated with
python3 -m ci.praktika yaml rather than edited by hand, and committed so that
_check_yaml_up_to_date does not have to push a corrective commit. It is the
only generated workflow that names this job.

Check names change from db disk, N/4 to db disk, N/6, so dashboards, mute
lists or saved queries keyed on the old literal stop matching and CIDB
history does not carry over. The same rename already happened for the old
analyzer sibling. No in-tree consumer hardcodes the old names.
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (3 findings, all agreed and fixed before publication)

This change was reviewed independently before publication: a cold code review by a reviewer
that had not seen the implementer's evidence, then a second-model review pass over the same
diff. Findings are adjudicated with evidence; nothing was overridden silently.

# Severity Finding Verdict
1 ⚠️ major The description explained the two healthy 4-way integration jobs by saying they "run a filtered subset" of the corpus. They do not. get_parallel_sequential_tests_to_run globs the whole tests/integration/test_*/test*.py corpus and its only corpus filter is gated on amd_llvm_coverage, which neither arm_binary, distributed plan nor amd_cfi takes. Their module counts are in fact comparable to this job's (239-284 per shard against 189-229). The real discriminator is the build: comparing the same module measured under both, the median per-module ratio is 2.03 for asan against arm_binary and 2.12 against amd_cfi. ❌ AGREE - description corrected to state the sanitizer-build mechanism with the measured ratios. The conclusion (leave both sibling 4-way jobs alone; key the fix on measured load, not on batch count) is unchanged.
2 💡 nit Every per-shard figure for the 4-way job is censored by the timeout, so the budget argument rested on a simulation. An uncensored measurement was available and unused: the 6-way sibling on the same 26.6 SHA completed without a timeout. 💡 AGREE - added. Its six shards summed to 88 663 test-seconds; splitting that measured total 4 ways needs 102.6 % of the 21 600 worker-second budget, 6 ways needs 68.4 %.
3 💡 nit "The corpus measures ~90 800 s" is a lower bound, since measured durations cover 1 013 of the 1 044 test modules in the tree. 💡 AGREE - stated as a lower bound with the coverage figure.

The second-model pass over the diff itself returned no findings. No blocker was deferred and
no finding was dismissed. All three findings were in the pull request description rather than
in the two changed files, so the committed change is unmodified from the reviewed content.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, and arithmetic rather than probabilistic. With real measured per-module durations fed through the in-tree get_optimal_test_batch(), 4/4 master shards and 3/4 of the 26.6 shards exceed the budget; CIDB corroborates (26.7 shard 1/4 = 28/28 SHAs timed out, 26.6 shard 4/4 = 47/47), as do two job.log artifacts. Not a low-rate flake.
b Root cause explained? AMD_MEDIUM gives min(16 // 5, 61 // 11) = 3 workers (integration_test_job.py:722), session_timeout_parallel = 3600 * 2 = 7200 s, so a shard has 21 600 worker-seconds; the corpus is ~90 800 s on master, so a quarter is ~22 000 s, over 100 % of the budget. xdist cuts the run and whatever was in flight is reported as failures.
c Fix matches root cause? The violated invariant is corpus / batches / workers <= session_timeout_parallel. The fix changes the only free term, costs no wall-clock (shards run concurrently) and weakens no assertion. Not a timeout bump, not a bigger runner, not a duration-table reshuffle, and not skipping the collateral modules.
d Test intent preserved / new tests added? Preserved: no test file is touched and nothing is skipped, muted or weakened. It restores coverage, since about 4-6 % of each over-budget shard currently never executes (last markers [gw3] [96%], [gw2] [94%]). No new test - this is a job-matrix property with no in-repo test surface; praktika's own _check_yaml_up_to_date guards the generated-YAML half and is satisfied.
e Both directions demonstrated? Yes. 4-way: worst shard 103.6 % (26.6) / 109.8 % (master) of budget, 3/4 and 4/4 shards over. 6-way: worst 75.6 % / 76.7 %, 0/6 over, inside the measured envelope of the old analyzer 6-way job that has 0 timeouts across 256 master SHAs.
f Fix is general across code paths? All seven parametrized integration total_batches sites audited against CIDB: db disk, N/4 is the only one over budget. arm_binary, distributed plan, N/4 (0 timeouts / 258 SHAs) and amd_cfi, N/4 (0 timeouts) are also 4-way and measured healthy, so they are left alone - the fix is keyed on measured load, not on the batch count. Second carrier class (the generated workflow YAML) enumerated: only release_branches.yml names this job, and it is regenerated.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A for type wrappers - no data path and no product code. The parameter-space equivalent was checked: all four live release branches (26.4/26.5/26.6/26.7) measure over budget at 4-way, and both phases of the job were verified - the sequential phase has its own session_timeout_sequential = 3600 s and its worst batch is 133 s (4 %), identical at 4-way and 6-way.
h Backward compatible? (maintainer-approved exception only) Yes. No setting, no serialization format, no SettingsChangesHistory.cpp, no product code. The one visible surface is the check name (db disk, N/4 to N/6), so dashboards, mute lists or saved queries keyed on the old literal stop matching and CIDB history does not carry over; called out in the description. The identical rename already happened for the old analyzer sibling in e1b6984c9341e96 (8 to 6). No in-tree consumer hardcodes the old names.
i Invariants and contracts preserved? The budget invariant is the one being restored. get_optimal_test_batch()'s own contracts hold for 6 (its batch_num <= total_batches guard and its total_assigned == len(tests) completeness assert were exercised for every batch 1..6), and its documented determinism is preserved since the CIDB-duration path stays disabled. The praktika generated-YAML invariant holds and is idempotent (a second python3 -m ci.praktika yaml leaves the file byte-identical, which is exactly the comparison _check_yaml_up_to_date makes). Downstream needs: lists were regenerated consistently, so no dangling job ids.

Session id: cron:clickhouse-impl-slot-45:20260728-095000

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus - could you review this? It changes the release-branch-only Integration tests (amd_asan_ubsan, db disk, N/4) job to 6 batches, because 4 batches cannot fit the job's own session_timeout_parallel: 3 workers x 7200 s = 21 600 worker-seconds per shard against a quarter-corpus of about 22 000 s, so every shard is cut by xdist ... session-timeout and whatever is in flight is reported as test failures. 6 is the value the old analyzer sibling already runs at, per e1b6984c9341e96.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 28, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8c6fb7e]

Summary: ✅

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 28, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 293124d

CI fully finished on this head: 174 check-runs, 0 queued or in progress, Finish Workflow pass,
Config Workflow pass. 0 failures. 169 jobs are skipped because the diff only touches
.github/workflows/release_branches.yml and the release-branch job definition, so the master
workflow has almost nothing to build or run for it; the change itself is exercised when it runs on a
release branch.

Check / test Reason Owner / fixing PR
(none) CI fully finished with no failing check at this commit not applicable

Session id: cron:our-pr-ci-monitor:20260728-130000

@groeneai groeneai added the groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding label Aug 19, 2026
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 19, 2026
Resolve the generated praktika workflow YAML by regenerating it
(`python3 -m ci.praktika yaml`) from the merged `ci/` sources, rather than
textually merging the single generated `needs:` line.
@clickhouse-gh

clickhouse-gh Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing f1f3e0444 with master 7c48f2ee2 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 704.45 MiB 701.40 MiB -3.05 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding manual approve Manual approve required to run CI pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants