Repository navigation
Perf CI: do not judge a shard on the 0.15/0.25 floors when no learned thresholds were fetched - #121189
Perf CI: do not judge a shard on the 0.15/0.25 floors when no learned thresholds were fetched#121189groeneai wants to merge 7 commits into
Conversation
The "Select historical data" step fetched the learned per-query performance thresholds from play.clickhouse.com with a hardcoded 10 s read timeout. That query aggregates five weeks of query_metrics_v2 and takes 8 to 10 s in CI, so the bar sat inside the latency distribution and the fetch failed often: nine successful steps sampled from their own job-log timestamps took 8, 8, 8, 8, 9, 9, 9, 9 and 10 s, and the same query measured 8.7 s from outside CI. On failure the step warns, touches an empty historical-thresholds.tsv and reports success. That fail-open is deliberate and is kept. What made it costly is that an empty file is indistinguishable from a clean history downstream: compare.sh LEFT JOINs it and computes ceil(greatest(0.15, historical_thresholds.max_diff, report_threshold), 2), and with join_use_nulls=0 a join miss is 0.0, so greatest(0.15, 0, 0) is 0.15. An absent history therefore reads exactly like a rock-steady query, and every query of the shard is judged against the bare 0.15/0.25 floors instead of its own learned bar. The only trace was one WARNING line in an 80 MB job log. Measured over 40 distinct master runs of Performance Comparison (arm_release, master_head, 6/6) started between 2026-09-16 and 2026-09-20, classified from each run's own job log: 22 applied the thresholds, 17 dropped them on the 10 s timeout, and 1 dropped them when the readiness probe hit TOO_MANY_SIMULTANEOUS_QUERIES. 18 of 40. On PR 120488 at 3ac0adb that accounts for the whole red: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120488&sha=3ac0adba968efdf04b768ba39c687690be44e86c&name_0=PR&name_1=Performance%20Comparison%20%28arm_release%2C%20master_head%2C%206%2F6%29 Replaying compare.sh's changed_fail rule over the shard's 574 client_time rows yields 4 blocking rows with the shipped thresholds, exactly the four reported "has slowed down" errors on timeseries_to_grid_aggregation_functions 1, 16, 21 and 23, and 0 rows once the learned thresholds are restored. Each of those queries sat far below its own learned bar: 0.694 against 1.20, 0.169 against 0.48, 0.194 against 0.35 and 0.151 against 0.31. Settings.CI_DB_QUERY_TIMEOUT_SEC is 60, already the timeout praktika's own CIDB reader uses, and it sits beside CI_DB_INSERT_TIMEOUT_SEC which this file already uses for its inserts, so no new number is introduced. retries=3 is unchanged. Worst-case step time rises from 3x10 s to 3x60 s on a job that runs about 80 minutes, while the runs that fail today stop spending 30 s to produce nothing. Both fail-open branches now also post one info.add_workflow_warning, so a run judged on the floors says so on the job and workflow report pages instead of only in the log. The check for a missing result is not result rather than is None, because do_select_query returns the response body for any 2xx and a zero-row SELECT answers 200 with an empty body, which produced the same empty file with no warning. The warning text carries no sha or shard, so the report's grouping collapses the six shards of one commit into a single entry. Nothing is appended to results, deliberately: res = results[-1].is_ok() immediately below must keep inspecting the step itself. A cheaper query was measured and rejected: the t-digest quantile in place of quantileExact saves about 1.5 s of 9 s, because the cost is the 371 GB scan rather than the aggregation, and it would move the threshold values. Caching the file between runs is not possible, since every job's env preparation removes ci/tmp and that is where perf_wd lives. The readiness-probe drop mode is left alone: it is in shared code with a second consumer and outside do_select_query's retry loop, and it is now visible. Related: ClickHouse#120488 Related: ClickHouse#102543 Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex), 3 rounds, each one a cold pass
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260920-120200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260920-100800 |
|
Workflow [PR], commit [74be7c0] Summary: ❌
AI ReviewSummaryThis PR fixes the main CI path that was wrongly grading an entire perf shard against the fallback floors when the learned thresholds fetch failed, and it mostly carries the new "not judged" state through the helper tooling. I still do not think it is ready to merge because one helper path still mishandles non-run shard statuses, and the helper readers can still collapse "CI had no verdict" into a clean answer when the metrics TSV is unreadable. Findings
Final VerdictRequest changes. |
CI finish ledger - 01ef7a2Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260920-160237 |
…etched compare.sh LEFT JOINs the learned per-query thresholds from historical-thresholds.tsv, and a miss yields 0, so greatest(0.15, 0, test_threshold) is the bare floor. The fetch step is fail-open: when CIDB is unreachable or the query fails it writes an empty table and reports success, and every query of the shard is then judged against the floors as if it had been measured as rock steady. An empty table is indistinguishable from a successful fetch in which a query has no row of its own, which is why this was invisible to every consumer. The two cases need opposite treatment. A query that was never measured has nothing better than the floors, so it keeps them. A shard that obtained no thresholds at all is not a comparable run, and grading it against a bar it was never measured against is how one slow CIDB query becomes a red on an unrelated pull request. So the fetch step now records that it obtained nothing, in a marker beside the empty table, and clears the marker first because the step is not stage guarded and its workspace is reused. With the marker present no query produces changed_fail or unstable_fail, the way the confirmation rerun demotes a change that does not reproduce; the *_show flags and every measured number stay, so the rows remain in the report. The per-test confirmed counts drop the unjudged queries, the exported per-query bars say inf rather than 0.15 so a consumer reproducing the gate reaches the gate's answer, and the per-query CIDB rows say SKIPPED rather than success. times_speedup keeps every row: it is a measurement, not a verdict, and an empty average would report a fabricated 1.00x for every test. The measurements are also not retracted from report/all-query-metrics.tsv, which is the data of the query_metrics_v2 insert the thresholds are learned from. The shard reports SKIPPED instead of OK, which praktika keeps green on GitHub, so a run nobody could judge cannot fail an unrelated pull request while still reading as unjudged. A status that is already FAIL is left alone, and the result is not cached, since nothing in the job digest captures whether CIDB answered. The release_base delta walk treats such a predecessor as unusable rather than as a zero, because a shard that judged nothing has no count a delta can be taken against. That walk keeps its whole extraction inside the one guard that already reports a malformed body, so a result artifact which is valid JSON but not an object still falls back to no baseline instead of raising and failing the check. The two readers of the perf job status inside this repository learn the new state as well. A shard that abstained publishes its measurements and only withholds a verdict, so the double-check skill now counts it apart from a shard that never ran, whose message says CI never measured the commit, and the report fetcher downloads it and labels it as not judged rather than dropping it as a job with no artifacts. Both tell the two apart by the published metrics artifact, which praktika records whatever the status is, so neither has to read the status message or the exported thresholds. Recognising the state is not enough on its own: each tool's reporting path still equated not judged with nothing to report, so an abstaining shard read as a clean comparison. Both now report the distinction too. The double-check skill refuses to call a comparison clean while a shard abstained, marks the printed report INCOMPLETE, lists those shards in result.json and exits non-zero, the way it already does for a shard whose report could not be read; the fetcher labels the shard in its per-shard line and in its JSON, and says the comparison is not clean on every run rather than only when nothing else was flagged, since a mixed run where one shard abstains and another flags a query is the shape this started from. When all queries are shown the abstaining shard's own rows do reach the detail list, where the inf bars leave them neither changed nor unstable, so they are listed apart from the judged ones and marked in the JSON instead of being counted as unchanged, which is a verdict they never got. The named TSV output has no shard level line to carry that, so there the marker rides on the row itself, as a not_judged column appended after the existing ones so that a positional reader of the older columns is unaffected. Nothing else in those rows says it: the detail projection selects stat_threshold and not the two bars that abstention sets to inf, so an unjudged row is otherwise identical to one that was measured and found steady. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review of the abstention commit (click to expand)An independent cold review plus a second-model pass over this commit only, repeated on every round
Residuals from the final round, not fixed in this commit. All three are in the
|
CI finish ledger - c93560aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The three flagged queries are 82-192 ms timers; the family is non- Session id: cron:our-pr-ci-monitor:20260922-220237 |
CI finish ledger - c93560aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only
Detail on the one red. The shard's own summary is #121090 is the causal owner, not a coincidental same-area PR: it gates a dashboard Session id: cron:our-pr-ci-monitor:20260922-215433 |
…atus Both report readers decided "this shard judged nothing" from the praktika status alone. performance_tests.py only turns the shard SKIPPED when the abstention is its only problem: a shard that fetched no learned thresholds and then failed for an unrelated reason keeps that failure, and the readers then treated it as an ordinary judged shard. Its rows are still visible, because compare.sh's changed_perf_report selects `from queries where changed_show` and abstain_all does not gate changed_show, but they carry the infinite bars the abstention exports. Read as a numeric bar, inf makes `abs(diff) > changed_threshold` unsatisfiable for every row, so fetch_perf_report.py reported no changes and double_check_perf.py confirmed none of them and exited 0 -- a clean verdict over data CI never judged, which is the failure this abstention exists to prevent. So classify from the bars, which are the same artifact the verdict comes from. The sentinel is BOTH bars infinite, matching the partition perf_api.py already uses: one infinite bar is a zero baseline in eqmed.sql and NaN is a missing one, and such a row keeps its own verdict. In fetch_perf_report.py the TSVs are already downloaded where not_judged is built. In double_check_perf.py the partition runs before any download, so find_changed_queries reports the shards whose bars show they judged nothing and main() adds them to the abstained set, which already suppresses the clean verdict and forces a non-zero exit. The most common perf-shard failure is a report carrying "N errors" (428 shard rows over 274 pull requests in the last 14 days), so this is the reachable half of the mixed case rather than a theoretical one.
CI finish ledger - 74be7c0Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Measured at this head rather than inherited: the failing shard carries 1198 This PR's own diff cannot have produced the verdict either. It changes the perf harness only to Merge order still matters for a green re-run here: #121090 first, then this PR, because CI builds Session id: cron:our-pr-ci-monitor:20260923-073136 |
`Select historical data` used a 10 s timeout for a query that takes 8 to 10 s, so many runs lost their per-query thresholds and judged every query against the 0.15 floor. Use `Settings.CI_DB_QUERY_TIMEOUT_SEC` (60 s) and post a workflow warning when the thresholds are missing. Taken from #121189.
|
Closing in favor of #121847, which takes the threshold-fetch timeout fix and warnings from #121189. Noisy queries are handled in the dashboard's confidence scoring instead: https://github.com/ClickHouse/performance-comparison/pull/5 |
|
Thanks for taking the timeout fix and the warnings. No objection to the closure: the UTC Flagging the one piece that did not come across, so it is a decision and not an oversight: the abstention itself. #121847 keeps both fail-open branches writing an empty I checked what that still costs, and in the jobs that run today it cannot red a check. What is left is report quality rather than a false red: a shard that fetched nothing still publishes per-query verdicts and an Provenance in case you want it anyway: @ alexey-milovidov asked for it in #120111 (comment). The other half he raised there, history unusable because it sits under a different |
Related: #120488
Related: #102543
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fetch the learned per-query performance thresholds with the standard CIDB query timeout, and stop judging a performance comparison against the 0.15/0.25 floors when no learned thresholds could be fetched at all.
Description
Requested on #120488.
The fetch.
Select historical dataused a hardcoded 10 s timeout for a query taking 8 to 10 s in CI, so 18 of 40 sampled master runs of shard 6/6 lost their thresholds. It now usesSettings.CI_DB_QUERY_TIMEOUT_SEC(60 s, praktika's CIDB constant), and each fail-open branch posts a workflow warning.The gate. A failed fetch writes an empty
historical-thresholds.tsvand returns success (the deliberate #98448 fail-open, kept).compare.shLEFT JOINs it and a miss is0, sogreatest(0.15, 0, 0)makes a missing history indistinguishable from a rock-steady query. A shard that obtained none now abstains: nochanged_fail, nounstable_fail, every measurement kept, the exported barsinfinstead of0.15, and the checkSKIPPED, which praktika keeps green, so the floors can no longer red an unrelated PR. An already-FAIL status is untouched and the result is not cached. A query with no history keeps the floors, its designed default.In
master_headmode the dashboard gate decides the status and ignores thresholds, so an abstaining shard skips it too; my #121090 makes the report agree.Not fixed here: when a fixture's query text changes, its history stays under the old
query_display_nameand the query drops to the floor. My #121278 keys the thresholds by display name; a renamed slot is still on the floors until its new text reaches 100 samples (10 days, measured).double_check_perf.pyandfetch_perf_report.pyread the exported bars, not that status alone: a shard that abstained and then failed for another reason keepsFAIL, and both would otherwise have called itsinf-barred rows clean. Theperf-comparisonhelper takes the same per-row marker.Tests: seven arms in the two helpers with test files, two wired end to end; throwaway harnesses for the
ci/scripts, perAGENTS.md, since nothing runsci/tests/.Measured detail: the failing shard run, the 40-run classification and the four flagged queries
On that run that is the entire failure: replaying
compare.sh's rule over the shard's 574client_timerows gives 4 blocking rows with the shipped thresholds, exactly the four reportedhas slowed downerrors, and 0 with the history restored.40 distinct master shas with an
arm_release master_head 6/6run started between 2026-09-16 and 2026-09-20, each classified from its whole job log. All 40 containStart execution for [Select historical data], so none is scored as applied for lack of the step.read timeout=10CIDB is not ready(Code: 202 TOO_MANY_SIMULTANEOUS_QUERIES)The four queries the shipped floors flagged, all in
timeseries_to_grid_aggregation_functions, against the thresholds the framework had already learned for them:changed_thresholdwas0.15andunstable_threshold0.25for all 164164 rows of that shard'sall-query-metrics.tsv, the empty-file fingerprint. Nine successful steps, timed from their own job logs, took 8, 8, 8, 8, 9, 9, 9, 9 and 10 s; the same query from outside CI took 8.7 s.retries=3is unchanged, and a cheaper query is not the lever: the cost is its 371 GB scan.Workflow [PR]
Sync PR [sync-upstream/pr/121189]