Repository navigation
Conversation
…asured runtimes In PR selected mode every query of every selected XML runs, so the cost of a test spans three orders of magnitude (amd: jit_aggregate_functions ~1240 s with 400 queries, string_sort ~950 s, the median test under 60 s). The name-sorted selection was split round robin, which ignores that cost: when the heaviest tests land on one shard it needs 25-50 min more than its siblings and is killed at the 7200 s job timeout, losing every result of the shard (amd_release 5/6 of 469ce02: 92 min of tests, siblings 42-69). Split the selected tests with `assign_tests`, the longest-first balancer the coverage collection already uses for the same XML files. Weight each test by `quantileExact(wall_clock_sec)` over the PR runs of the same architecture in `perf_test_times_v1` that ran all its queries (the rows with the test's largest `queries`), in the window from 8 days to 1 day before the selection cutoff. Every shard of a run has the same cutoff and the window is settled, so all shards compute the same assignment. Each weight carries the identity recorded in the committed coverage timings, so a test changed since then keeps the changed-input floor (the upper quartile); a test without a runtime gets the upper quartile. If the read returns nothing, the committed coverage timings are the weights. A CIDB failure takes the existing selection SKIPPED/ERROR paths. `assign_tests` gains `skip_shell_queries` (default True, as before): coverage collection cannot run shell queries, PR runs do, so PR mode weights them. NightlyCoverage's assignment is unchanged (`--show-plan` byte-identical). Full mode, master, nightly and Iceberg runs keep round robin. Offline replay with the real method and recorded CIDB data (weights out of sample): heaviest-shard test minutes, p99/max, heads since 2026-11-15 20:00: amd 239 heads 72.5/76.9 -> 55.0/56.8, arm 743 heads 60.0/74.4 -> 46.2/58.6; the killed run 92 -> 68. Considered: a deadline in `run_tests` (the shard still fails), sampling 10 queries of coverage-selected tests (drops the queries coverage chose), 8 AMD shards (more machines for an imbalance that is free to fix), the committed coverage weights alone (instrumented runtimes predict release ones poorly; the killed run only drops to 84 min). Co-Authored-By: Claude Opus 5.5 <[email protected]>
`shard_tests` anchored its runtime window on `selection_cutoff()`, which on a rerun attempt is the start of that attempt. Rerunning some shards then read a shifted window and split the same selection differently from the shards whose results are kept, so some tests ran on no final shard and others on two (ClickHouse#125013's 642 tests: 502 of them move for a rerun one hour later). Anchor the window on `info.workflow_start_time`, which every attempt of the run keeps. The first attempt sends the same query as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 3 findings over 2 rounds) plus my own review (4 findings).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261118-193100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20261118-184501 |
|
Workflow [PR], commit [23facef] Summary: ✅
AI ReviewSummaryThe PR balances selected performance tests using historical runtimes while retaining all queries in each selected test. Reviewed all four changed files at Final VerdictStatus: ✅ Approve |
The tests of a selected-mode shard and their placement on the shards come from CIDB (the coverage cohort, the previous failures of the PR and, since the runtime balancing, the PR runtimes of the 8 days to 1 day before the workflow run started). None of it is part of the job digest, so a later workflow with the same digest could reuse the success records of some shards and run the others with a different assignment: the tests moved off the re-run shards then have no execution at all. Complete selected-mode shards with `do_not_cache`, the praktika flag for a verdict that depends on run-time state no digest input captures, as the unavailable-selection path of the same job already does. Full mode keeps its cache: round robin over the digested list of tests. Reuse of these shards across workflows needs an unchanged merge-commit build digest: in the 14 days to 2026-11-18, 3 of the 939 PR heads with AMD `master_head, N/6` shards had a cached `amd_release` build, and all three re-ran every shard, so the cache saved nothing measurable here. The README and the `shard_tests` comment now say that a rerun keeps the placement for the same selection only: a rerun attempt advances the selection cutoff, so the selected set itself can change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #131328
Related: #129327
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
PR
Performance Comparison (amd_release, master_head, N/6)shards in selected mode are killed at the 7200 s job timeout when the heaviest selected tests land on one shard, and the whole shard reports nothing. Example: amd_release 5/6, 92 min of tests while its five siblings, with the same 642 selected tests, needed 42 to 69 min.Every query of a selected XML runs, so test costs differ by three orders of magnitude (amd:
jit_aggregate_functions~1240 s,string_sort~950 s, the median test under 60 s), but the name-sorted selection is split round robin, which ignores the cost.The selected tests now go through
assign_tests, the longest-first balancer of the coverage collection. The weight of each test is its median runtime in the PR runs of the same architecture at its largest recorded number of queries, from 8 days to 1 day before the workflow run started, so every shard and every rerun attempt reads the same rows. Selected-mode shards are not reused from the CI cache (do_not_cache): their tests and weights come from CIDB, outside the job digest. A test without a runtime gets the upper quartile; a test changed since, or absent from, the coverage timings keeps at least that. With no runtime at all, the committed coverage timings are the weights. PR mode also weights shell-query tests (skip_shell_queries=False); the coverage assignment is unchanged. Full mode, master, nightly and Iceberg runs keep round robin.Validated offline with the real method on recorded CIDB data: on the killed head the heaviest shard goes from 92 to 68 min; over the heads since 2026-11-15 20:00 (out of sample for the weights), heaviest-shard test time p99/max goes from 72.5/76.9 to 55.0/56.8 min (239 amd heads) and from 60.0/74.4 to 46.2/58.6 min (743 arm heads).
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/132767]