Repository navigation
Add the double-check-perf-tests skill - #115278
Conversation
The skill locally reproduces the CI performance comparison for a given commit: it fetches the perf report, extracts the queries listed under "Changes in Performance", downloads the patched and reference binaries from S3 for the local architecture, starts two `clickhouse-server` instances and reruns only the affected queries via `tests/performance/scripts/perf.py`, then prints CI numbers next to the local ones with a per-query verdict. This makes it cheap to tell a real regression from a noisy CI measurement without waiting for another CI round. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
|
Workflow [PR], commit [c17f020] Summary: ✅ AI ReviewSummaryThis PR adds the Findings💡 Nits
Final Verdict
|
Four defects found while reviewing the skill before upstreaming it. `fetch_reference_sha` keyed the lookup only on `(new_sha, arch)` and took `DISTINCT ... LIMIT 1` with no ordering. A commit measured more than once carries one reference build per run, so the arbitrary pick could return a baseline from a run other than the one the scraped report reflects. Over the last 14 days 15 of 5106 `(new_sha, arch)` pairs on `play.clickhouse.com` have more than one `old_sha` — for example PR #112940 at `0a03e389`, reran a day later against a different master build. The S3 report is overwritten in place, so the newest run is the matching one: order by `event_time` and warn when the choice was not unique. The servers were started without `--http_port`, even though the perf-comparison drop-in removes `<http_port>` and `CHServer` in `ci/jobs/performance_tests.py` puts it back on the command line. The `perf.py` invocation also omitted `--binary` and `--http-port`, whose defaults are `clickhouse` from `$PATH` and port 8123. A `<query type="shell">` test would therefore time the same unrelated binary on both sides and report "no change" whatever the patch does. Four tests use shell queries today (`clickhouse_local_startup`, `http_read_gzip`, `insert_direct_parallel`, `ttl_group_by_consecutive_keys`). Since the HTTP ports mirror CI's 8123/18123, and 8123 is the default port of an ordinary local server, the ports we are about to bind are now checked up front instead of failing with a bind error buried in the server log. CI runs `populate_data_both`, re-inserting the `hits` datasets on each server so each side's parts are written by its own binary; the script only hardlinked one frozen copy into both sides, which hides every write-path change and reports it as `NOT REPRODUCED`. Hardlinking stays the default — it is much cheaper — and the new `--populate` reproduces CI, rebuilding only the `hits` tables the affected XMLs actually reference. Verified against live data and locally: the reference-SHA lookup now picks the newest run and warns on the ambiguous ones, and `http_read_gzip` (two shell queries over HTTP) runs to completion against two locally started servers. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
The work dir defaults to a fixed path and is shared across runs, but the
binary cache only checked whether `left/clickhouse` and `right/clickhouse`
existed. A second run for a different commit, or with a different
`--reference-sha`, silently benchmarked the previously downloaded pair while
the report printed the new SHAs. Each download now records the SHA and build
type it came from, and a cached binary is reused only on an exact match.
The Configure stage of `ci/jobs/performance_tests.py` symlinks
`tests/performance/user_files/*` into both servers' `user_files` directories.
That was missing here, so `json_file_query`, whose query reads
`file('instances.json')`, failed locally with `CANNOT_STAT` while CI runs it
fine. The seeding happens after the hardlink copy, which wipes the
destination.
Verified locally: with a recorded identity the binaries are reused, and a
changed commit refuses to reuse them and looks for the right build instead;
`json_file_query` now runs to a diff on two locally started servers, and fails
with `CANNOT_STAT` without the seeding.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
On Linux x86_64 `ci/jobs/performance_tests.py` pins both measured servers with `taskset` to one hyperthread per physical core and writes a `users.d` override capping `max_threads` at the size of that set, so query threads never share a hyperthread sibling depending on scheduler mood - its top suspect for the amd-vs-arm A/A noise gap (0.51% vs 0.42%). The local rerun did neither, so it adjudicated CI's verdicts under noisier conditions than the run that produced them, which is how a real change ends up looking `NOT REPRODUCED`. `cpu_pinning_enabled` and `get_physical_core_cpu_list` are ported from the CI job, including the intersection with the process affinity mask (sysfs exposes the host topology, and `taskset` fails on a disallowed CPU) and the fallback to every allowed CPU when the topology cannot be read. `--no-cpu-pinning` turns it off. `--jemalloc_profiler_sampling_rate` now matches `CHServer` too. Verified on a 16-physical-core host: the helper selects exactly 16 of the 32 logical CPUs, and both started servers report `Cpus_allowed_list: 0-15`, `max_threads = 16` and `jemalloc_profiler_sampling_rate = 16`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
The reference (left) binary is an older master build, but the config comes from the current checkout. When a drop-in sets a server setting that build predates, it is rejected with `UNKNOWN_SETTING` and the server never starts - so the run dies before a single query, in the preconfig step or at server start. The INSTALL_CLICKHOUSE stage of `ci/jobs/performance_tests.py` strips such settings from `keeper_port.xml` for exactly this reason; that scrub is now mirrored here, applied to both sides after the perf drop-ins are overlaid. The list is hardcoded, as it is in the CI job, so it goes stale as soon as master adds another such setting. To keep that from surfacing as an unexplained startup failure, a server that fails to come up now has its log searched for the rejected setting, which is named in the error along with where to add it. Verified locally: a `keeper_port.xml` carrying `log_readahead_commit_window_bytes` has exactly that line removed and nothing else, and an unknown coordination setting reproduces the failure (`Unknown setting ...: in Coordination settings config. (UNKNOWN_SETTING)`), which the new diagnostic reports. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
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 units7 translation units recompiled, 15 s compile time in total, 7 of them have a recent master baseline. |
…tests The `CONFIRMED` verdict used a flat 10% bar. `compare.sh` flags a query with `abs(diff) > changed_threshold and abs(diff) >= stat_threshold`, where `changed_threshold` is per query: the 0.15 floor raised by the query's historical p99 and the test's `<max_ignored_relative_change>`. So the bar was below even the floor, and far below the bar of a historically noisy query - the rerun could report `CONFIRMED` for a change CI's own gate would not have flagged. The floor exists because micro benchmarks swing 10-15% between two binaries from machine noise and code-layout artifacts alone. `compare.sh` exports that per-query threshold as a trailing column of `all-query-metrics.tsv` for exactly this purpose. It is now parsed, carried per query, and applied, with the 0.15 floor for shards predating the column. Significance is gated on `p <= 0.05` - `perf.py` reports a p-value rather than the randomization threshold `compare.sh` derives downstream, and 0.05 is the cutoff `perf.py` itself uses. A `NOT REPRODUCED` verdict now names which of the three conditions failed. Tests write into `user_files` with `INSERT INTO FUNCTION file(...)` (`parquet_read`, `json_type_parsing`, `insert_values_with_expressions`, ...) and `drop_query` only drops tables, so a later XML could read what an earlier one left behind, making a multi-test rerun order-dependent. CI removes the non-symlink entries after every test; that cleanup is mirrored here, keeping the seeded fixture symlinks. Verified locally: the trailing column is parsed and absent columns fall back to the floor; a query CI flagged with a 0.30 threshold is NOT REPRODUCED at +12% and CONFIRMED at +35% (under the old rule +12% was CONFIRMED); an above-bar delta with p=0.400 is rejected; and the cleanup removes generated files and directories from both sides while the fixture symlinks keep resolving. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
The confirmation gate substituted a Welch t-test (`p <= 0.05`) for the noise check, so the tool could confirm or reject a different set of queries than CI's own confirmation step. `compare.sh` uses `abs(diff) > changed_threshold and abs(diff) >= stat_threshold`, recomputing `stat_threshold` from the rerun's per-run samples - it collects them out of the raw TSV with `sed -n "s/^query\t/.../p"`. `perf.py` prints those same rows and carries a Python implementation of that randomization test to drive its adaptive stop, so the gate is now reproduced exactly: the per-run samples are parsed, and `stat_threshold` is lifted out of `perf.py` by AST instead of being copied, so there is no second implementation to drift. A failed lift stops the run rather than quietly judging by some other rule. The p-value is still displayed. `--runs` defaulted to 7 and was documented as matching CI, but `CHServer.run_test` omits the flag unless a caller asks for it, leaving `perf.py`'s adaptive `--min-runs`/`--tau` policy in charge. Forcing 7 widens that policy and changes the sampling, the medians, the rerun precision and therefore the verdict. It is now unset by default and omitted from the command line, as in CI. `gh` is invoked with `GH_CONFIG_DIR` dropped. Some agent and CI runners point it at a config dir with no usable auth, which fails every call with HTTP 403 before any perf logic runs; `.claude/tools/gh-ro.sh` and `patch-release-check` already work around it the same way. Verified locally: the lifted `stat_threshold` returns bit-identical results to `perf.py`'s own on five sample sets including the degenerate ones; run rows are parsed per side with prewarm rows excluded; a real `perf.py` run with no `--runs` chose its own counts and yielded `stat_threshold = 0.027`, against which its own -0.59% A/A difference is correctly not confirmed; the gate is non-strict at the boundary; and `gh` now succeeds with a poisoned `GH_CONFIG_DIR` that fails a plain invocation. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
The temporary preconfig server bound the fixed port 9001 before anything had
checked it was free, and both the readiness probe and
`RENAME TABLE datasets.hits_v1 TO test.hits` talked to that fixed port. With
another server already listening there, the temporary one fails to bind while
`select 1` succeeds against the stranger, and the rename moves *its* tables.
The preconfig server now has its own ports, they are checked free before it is
launched, and it is asked for `system.server_settings.path` and must answer
with the dataset directory we started it for before any rename is issued.
`run_perf_test` discarded perf.py's exit code, so a broken rerun surfaced as
"no local data" - which reads as "the change did not reproduce" when in fact
nothing was measured. The exit code is now recorded per test, those queries are
reported as `perf.py FAILED ... NOT MEASURED` pointing at `<test>-err.log`, the
summary counts them separately, and the script exits non-zero.
Dataset detection scanned whole XML files, so a mixed-dataset test demanded and
rebuilt tarballs the flagged queries never touch: rerunning one query of
`aggregation_in_order.xml` asked for both hits_10m_single and hits_100m_single,
~10 GB of it for nothing. Only the flagged indices are scanned now, expanded by
`perf.py --print-queries` (which owns the numbering - substitutions turn one
`<query>` element into several - and inlines `<query file="...">` bodies),
together with the preparation queries, which run regardless of
`--queries-to-run` and are expanded over every substitution. That also fixes
`tpch.xml` reporting no datasets at all, since its `USE {database}` only names
`tpch10` after substitution.
Verified locally: a decoy server holding its own `datasets.hits_v1` on the
preconfig port is refused twice - by the port check, and with that bypassed by
the identity check - and comes out with its tables intact and no `test`
database; a failed perf.py run is reported as NOT MEASURED rather than as a
verdict; and each of the four expanded queries of `aggregation_in_order.xml`
now resolves to exactly the one table its own body reads.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
`scan_external_datasets` now keys its results by test name, but the `path = Path(test_name)` binding from the previous version stayed behind, which `ruff` fails as F841. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
Shards were taken from `result_pr.json` regardless of status. A `SKIPPED` shard publishes no artifacts, so the synthesized `report.html` URL only 403s, every shard was skipped for that reason, and the run ended with "no queries categorized as 'Changes in Performance' ... nothing to do" and exit 0 - which reads as CI having measured the commit and found it clean. On this skill's own pull request all 12 shards are `SKIPPED` (it touches nothing the perf check runs on), which is exactly the case that produced a page of HTTP 403 lines followed by an all-clear. Shards whose status means "no artifacts" (`SKIPPED`, `PENDING`, `RUNNING`, `DROPPED`) are now dropped up front, and when none remain the run stops with an error naming the statuses. `FAIL` and `ERROR` shards are kept: they normally still upload a report. `find_changed_queries` additionally reports how many reports it could read, so shards that ran but whose artifacts have expired stop the run too instead of contributing silence. The genuine all-clear now says how many shard reports were read. Verified against both PRs: #115278 (12 skipped) exits 1 naming `SKIPPED x12`, #112688 still resolves its 11 flagged queries and exits 0, an unreadable shard yields `read_ok=0`, and a live one `read_ok=1`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
A query flagged in `report.html` was dropped when `all-query-metrics.tsv` had no `client_time` row for it, and a shard whose TSV could not be read dropped all of its flagged queries. With every flagged query dropped the run ended with "the comparison ran and was clean" - a non-empty CI report turned into an all-clear. The cause is deliberate on CI's side: `compare.sh` retracts a query from the TSV when its confirmation rerun demoted it, while the report still lists it under both "Changes in Performance" and "Unconfirmed Changes". On PR #115255 that is `round_down` #2 and #3 and `and_compare_chain_derived` #2. Those rows carry their own numbers, so they are now read from `report.html` and marked `*` in the report - CI's verdict on them was already in doubt, which makes them the most interesting queries to rerun, not the ones to discard. A flagged query readable from neither source is reported as unresolved, and if that leaves nothing to rerun the run fails instead of reporting a clean comparison. The commit under test drove only the report and binary lookup; the XMLs, `perf.py`, its `stat_threshold`, and the configs still came from the working tree. Query indices are positional and substitutions expand them, so a tree that differs from the measured commit silently reruns a different query - on a checkout one commit behind master, `and_compare_chain_derived.xml` has no query #2 at all while CI flagged exactly that, and a `refs/pull/<n>/merge` checkout is never the commit CI measured. `tests/performance`, `programs/server` and `tests/config/top_level_domains` are now extracted from that commit into the work dir and everything runs from there, fetching the commit when the clone lacks it. `--use-working-tree-tests` opts out for iterating on a local test. Verified: all six flagged queries of PR #115255 are now kept, the three the TSV retracts carrying the report's numbers and flagged as unconfirmed; a dry run of PR #112688 recovers `date_time_64` #5, which had been dropped the same way, and runs against the extracted tree. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
…ve benchmarks Three defects in the previous commit. The `*` marker for a demoted query was inserted into the middle of the arch-selection if/elif/else, so the `else` bound to it instead: every ordinary row was relabelled `<arch>-only`, making the provenance column state the opposite of the truth for queries flagged on our own architecture, and a demoted row flagged only on the other architecture left `ci_at` unbound and raised `UnboundLocalError` - after the rerun had already finished. The chain is restored and the marker appended separately. Demoted queries reach the report without a `changed_threshold`, since compare.sh retracts them from the TSV along with that column, and they fell back to the bare 0.15 floor - a weaker gate than the one CI used to flag them, enough to call a historically noisy query CONFIRMED. The threshold is now rebuilt the way compare.sh builds it, `ceil(greatest(0.15, historical p99 x 1.5, max_ignored_relative_change), 2)`, by running CI's own `GET_HISTORICAL_TRESHOLDS_QUERY` against `play.clickhouse.com` with the window anchored on the day that run happened rather than today. When it cannot be recovered the query is reported with no verdict rather than judged by the floor. The archived tree omitted `tests/benchmarks`, which `tpch.xml`, `tpcds.xml` and the `tpch-join_algorithm-*` tests read their SQL and settings from through `file="..."`, so any CI row from those tests would have failed in `--print-queries` or in the rerun itself. Verified: all five CI@ cases render correctly (`amd`, `amd+arm`, `arm-only`, `amd*`, `arm-only*`) where the previous commit raised `UnboundLocalError` on the last; the recovered threshold reproduces the floor where no history exists and rises with it where it does (`file_table_function` #24 is 1360%), and honours a test's own threshold; and `tpch`, `tpcds` and `tpch-join_algorithm-partial_merge` all expand their queries from the archived tree. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
Both `query_metrics_v2` lookups - the reference SHA and the run day - matched on `new_sha` and `arch` alone, so any other run of the same commit was eligible and "newest row wins" could hand back a baseline from a different comparison than the report being checked. Both are now scoped to `pr_number` too, and the newest-row rule applies only within that run set. This one is defensive: over the last 45 days no `(new_sha, arch)` pair on play.clickhouse.com carries more than one `pr_number` (0 of 15407), since a merge produces a new commit rather than re-measuring the branch head. The clause costs nothing and the failure it rules out - silently comparing against the wrong binary - is not one this tool should be able to have. The recovered historical thresholds were keyed by `(test, query_index)` while compare.sh joins on the query display name as well. Query indices are positional, so an edited query body at the same index inherited the learned threshold of the query that used to be there; under CI's join it finds no historical row and falls back to the floor. The query now selects `any(query_display_name)` as CI's does and the map is keyed the same way. Threshold recovery was applied to every row with no `changed_threshold`, which also catches rows from shards predating that column. CI exported no threshold for those either, so reconstructing one - or refusing to judge them - is wrong where the documented 0.15 floor is right. Rows now record whether their numbers came from `report.html`, and only those take the recovery path. Verified: the scoped lookups still resolve PR #112688 (reference `b99a4b375e1d`, run day 2026-08-18) and refuse to answer for a wrong PR number; the largest learned threshold, `file_table_function` #24 at 1360%, applies with its display name and drops to the 15% floor with a different one; and of a report-only row, a pre-column TSV row and a normal row, only the first takes the recovery path. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
…to .git `report.py` writes cell values into `<td>` raw - it does not import `html`, let alone escape - so a query containing `<` and `>` puts them into the markup directly, and stripping tags inside a cell ate the text between them: `SELECT a < b AND c > d` became `SELECT a d`. That name is half the key of the historical-threshold lookup, so such a query missed its learned threshold and was judged by a weaker bar. 90 distinct queries measured in the last two weeks contain both characters. The name is now derived from the pinned test tree instead, where it has an exact source: perf.py builds `query_display_name` as `query_display(item)` trimmed to 1000 characters, which is what `--print-queries` prints and what reaches `query_metrics_v2`. Checked against CIDB, the derived name matches the recorded one byte for byte, including the leading newline the query text starts with. The report's query cell is no longer tag-stripped either, so the displayed text stays intact. Fetching a missing commit wrote to `.git` (`FETCH_HEAD` at least), which some sandboxes mount read-only - and a historical PR is exactly when the commit is missing. When the fetch into the clone fails, the commit is now fetched into a scratch repository under the work dir, which needs nothing from `.git` but the origin URL and yields the same archive. Verified: against a clone with a read-only `.git` and without the commit, the tree for PR #115255's head is still materialized - 558 perf XMLs plus `tests/benchmarks` and the configs - and the clone is left untouched, with no `FETCH_HEAD` created. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
…k checkout perf.py imports `clickhouse_driver` and `scipy` at module scope, before its `--print-queries` early exit, so listing queries needed packages only the benchmark itself uses and a dry run died on a machine without them. Since reimplementing the expansion would fork CI's query numbering - substitutions turn one `<query>` into several - perf.py is now run with stand-ins for whichever of the two is missing; the metadata path never touches them. On a bare interpreter the plain invocation fails with `ModuleNotFoundError` while this one prints the same queries as a fully equipped one, differing only in the timing values of the `stage` lines, which are discarded. The rerun does need both packages, and is now refused up front with a clear message instead of after the downloads. The scratch repository inherited only the local checkout's origin, so in a fork checkout `refs/pull/<n>/head` is a different pull request and the commit was never found. It now tries the canonical upstream as well - verified against a repository whose origin is `ClickHouse/clickhouse-docs`, where origin alone fails and upstream succeeds; the fetch is judged by the commit being present afterwards, so the wrong remote's pull request is never mistaken for it. Upstream is tried only in the scratch repository, with `--depth=1`: fetching it into someone's own clone is unbounded when the history is not already there, and shallow-fetching into a full clone would leave a `.git/shallow` behind. `test._populate_done` is removed rather than keyed by the populated table set. It could never have been read: `main` re-hardlinks each side's db from the dataset directory at the start of every run, which deletes the marker, so `--populate` already rebuilds unconditionally as intended. Keeping a marker that looks like a cross-run cache but cannot be one is the trap. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115278&sha=baefff6dcc4dbb3201337a52b5ca54453fb34562&name_0=PR&name_1=Style%20check Pull request: #115278 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GYYbBbrQpmi2zkYJ8LQw5Z
`PerfShard.baseline` was parsed out of the job name and then never used: shards were selected by architecture alone, rows were keyed by `(test, query_index)`, one `old_sha` was resolved per PR and architecture, and the left binary was always fetched from `REFs/master/<ref-sha>/`. A `release_base` shard is a different comparison. `performance_tests.py` picks its left binary with `find_base_release_build`, and replaces `tests/performance` with the release base's checkout before running, so its query indices are positional in another tree. Since rows from both baselines share the same `(test, query_index)` key, they would silently merge and be adjudicated against a binary and a numbering CI never used. Splitting rows per baseline would not be enough on its own: the reference-SHA lookup cannot discriminate either, because the `query_metrics_v2` table exposed on play.clickhouse.com has no `baseline_kind` column to filter on. So the report is refused instead. This is unreachable today -- only the master workflow schedules `release_base` (ARM only), and its reports live under `REFs/`, which this skill does not read -- so the check guards against that changing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
Three defects in the perf double-check script: An unreadable shard report contributed no changed queries, exactly like a shard that had none, and only the "not a single report could be read" case was caught. So a run where the readable shards were clean but one shard's `report.html` was missing still ended in "the comparison ran and was clean". `find_changed_queries` now reports which shards it could not read: that refuses the clean verdict outright, and marks a run that does have queries to rerun `INCOMPLETE` with a non-zero exit code. The cross-arch dedup keyed rows by `(test, query_index)` and kept one `ChangedQuery` per query, discarding the other architecture's numbers and direction. CI can call the same query slower on one arch and faster on the other, and the report could only show one of the two. Every arch's row is kept now, and a `CI split` line under the query prints both whenever the directions disagree. `--dry-run` returned only after the reference-SHA lookup, which dies when `clickhouse client` is not on PATH -- so the planning path was not the dependency-light one `SKILL.md` documents. The lookup is now advisory on that path: a warning, an `unresolved` line, and the plan still prints. The real run still refuses to start without it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
`fetch_historical_thresholds` keyed its rows on `query_display_name` exactly as `clickhouse client` printed it under `FORMAT TSV`, so newlines, tabs and backslashes stayed escaped. The other side of the join, `query_display_name_from_tree`, derives the name from the pinned test tree via `perf.py --print-queries` and holds the real characters. Most display names are multi-line: `query_display` joins statements with `;\n` and keeps the XML body's own newlines and indentation. So every multi-line query missed its historical row and fell back to the bare 0.15 floor -- a weaker gate than the one CI applied, which for a demoted historically noisy query is how the local report reaches a false CONFIRMED. JSON round-trips the raw string exactly, so the lookup is keyed the same way on both sides. Checked against play.clickhouse.com: the tree-derived name for `aggregating_merge_tree_simple_aggregate_function_string` #0 and `analyzer_nested_function_resolution` #0 equals the CIDB value, and both find their historical threshold now (0.102 and 0.0525) where before they found nothing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
`tmp/double_check_perf` is reused between invocations, but only the db copies
were recreated from `db0` -- `left/coordination`, `right/coordination` and
the preconfig server's `coordination0` carried the previous run's znodes into
a fresh dataset.
`alter_select.xml` is the one perf test that creates a
`ReplicatedMergeTree('/tables/{database}', '{table}')`. Reproduced with a
single-node server against `/usr/bin/clickhouse`: create the table, stop,
remove the db but keep the coordination dir, restart, and the same
`create_query` fails with
Code: 253. DB::Exception: Replica /tables/default/replicas/alter_select_rmt
already exists. (REPLICA_ALREADY_EXISTS)
which fails the whole test, so its queries are reported as not measured
rather than double-checked. Wiping the coordination dir as well makes the
create succeed again.
The coordination dirs are now removed next to the `hardlink_db` that wipes
the data they describe, and before the preconfig server starts.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
| # a same-direction delta — interesting, worth noting. | ||
| verdict = ( | ||
| f"CONFIRMED {ci_dir} " | ||
| f"(local mirrors {'/'.join(archs)} regression)" |
There was a problem hiding this comment.
This cross-arch CONFIRMED branch hardcodes regression, but ci_dir can also be faster. With an ARM-only improvement the report currently prints CONFIRMED faster (local mirrors arm regression), which contradicts the row's own verdict. Please make the parenthetical direction-aware or switch it to a neutral word like change.
|
|
||
| ### 1. Sanity checks | ||
|
|
||
| - `--dry-run` needs nothing but `python3` and `git`: the query expansion runs |
There was a problem hiding this comment.
This overstates what the planning path can do on a bare checkout. The default --dry-run still needs gh and network access to GitHub/S3 to resolve the PR/SHA and fetch result_pr.json / report.html; only the query-expansion sub-step works with just python3 and git. Please narrow this wording, or mention that a full SHA plus --pr avoids the gh lookup, so the documented contract matches the implementation.
The script refused a report with no Performance Comparison shard for the local architecture, which contradicts its own cross-arch rule: every flagged query is rerun locally regardless of which arch CI flagged it on, because "local AMD does not reproduce the ARM regression" is a useful verdict. That rule does not stop applying when the local arch happens to have zero shards -- and it usually does, since the AMD shards run only for a pull request labeled `pr-performance`, so an ARM-only report is the common case. Only the `play.clickhouse.com` lookups are keyed by architecture. What they return is a master *commit*, not a binary, and every master build publishes both arches, so the local-arch binaries for it exist anyway. Checked for PR 115465: the ARM run's baseline `8a4c746fd235` has a `build_amd_release` artifact, as does the pull request's own commit. So the lookups now use whichever arch CI actually measured, and the run proceeds with a warning up front and a line under the report table: the CI old/new/Δ columns are the other arch's timings, so NOT REPRODUCED means the local arch does not show the change, not that CI was wrong. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
Running the skill end to end on PR 115465 turned up three blockers, none of which the dry-run path reaches. `materialize_perf_tree` extracted `programs/server` and only `tests/config/top_level_domains`, but most of `programs/server/config.d` and `users.d` are symlinks into `tests/config` (`clusters.xml`, `keeper_port.xml`, `ext-en.txt`, ...). `prepare_configs` copies them dereferenced, the way the CI job does with `cp -r --dereference`, so every link dangled and both servers failed to be configured before anything ran. The whole `tests/config` directory is ~1 MB; extract it. The ports mirror `CHServer` in ci/jobs/performance_tests.py, which runs in a container with nothing else on the box. On a development machine the left side's values are just the ClickHouse defaults, so any local server owns them and the run is refused -- correctly, but with no way forward short of stopping someone else's server. `--port-offset` shifts the whole set instead. `perf.py` drops a query that failed on *every* server (`if len(no_errors) == 0: continue`) and still exits 0, writing only a traceback to the per-test stderr. That surfaced as the benign-looking `no local data`, the same string used when a query simply produced no row. Such a query is now reported as `ERRORED ... NOT MEASURED`, pointed at its stderr log, and makes the exit code non-zero. CI hit the same class of silent drop for shell queries and fixed it there with `run-error` lines; SQL queries failing everywhere were still silent. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
The perf drop-in removes `http_port`, `mysql_port`, `postgresql_port` and
`tcp_with_proxy_port`, and the preconfig command line overrides the TCP and
Keeper ports -- but `interserver_http_port` survives from
programs/server/config.xml at the default 9009, and nothing overrode or
reserved it. So on a development machine with a local server the temporary
preconfig server died before any rerun started, and `--port-offset` could not
help because there was no constant to shift.
Reproduced against the work dir's own config while another worktree's server
held 9009:
Code: 210. DB::Exception: Listen [::]:9009 failed: ... Address already in
use: [::]:9009 (NETWORK_ERROR)
exit 210, followed by "shutting down"; passing `--interserver_http_port`
reaches "Ready for connections" instead.
`PRECONFIG_INTERSERVER` is now a constant like the others, listed in
`PORT_NAMES` so `--port-offset` moves it, reserved by `ensure_ports_free`,
and passed on the command line. Audited the rest of the effective config for
listeners that stay unshifted: `mysql_port`/`postgresql_port`/
`tcp_with_proxy_port` are removed by the drop-in, `prometheus`, `https_port`,
`tcp_port_secure`, `grpc_port` and `interserver_https_port` are commented out
or live in `tests/config/config.d` files that are not linked into
`programs/server/config.d`. This was the only one left.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ABBcEvn43yngXJQfYgBUW9
Changelog category (leave one):
cc @nikitamikhaylov
Example of a local run:
Workflow [PR]
Sync PR [sync-upstream/pr/115278]
Version info
26.8.1.1773(included in26.8and later)