Repository navigation
Fix the dead is_fast_build check so limits_fast.yaml is actually installed on Fast test - #112387
Conversation
…alled is_fast_build only returned an exit code and printed nothing, while the call site consumed stdout via [[ $(is_fast_build) == 1 ]]. The command substitution was therefore always empty, the branch never taken, and tests/config/users.d/limits_fast.yaml never installed on any job - fast build or not. So max_execution_time / max_execution_time_leaf have never been in effect in CI. One consequence is that the CancellationChecker watchdog, which is only armed when max_execution_time > 0, never ran on these jobs, so a query waiting inside the server had no timeout. Make the function a predicate and call it as one. This re-lands ClickHouse#97823, which fixed the same thing and was reverted by ClickHouse#98026 because the LLVM coverage build passes the "fast build" predicate while being 2-3x slower. That objection was correct, so the coverage exclusion is included - but not the probe the revert suggested: coverage flags are applied per directory via add_compile_options and never reach CMAKE_CXX_FLAGS, so they cannot be seen in the CXX_FLAGS row. Use the dedicated WITH_COVERAGE build option instead, which is what tests/clickhouse-test and tests/integration/helpers/cluster.py already read. Putting the check in the predicate rather than in the caller also covers tests/docker_scripts/stress_tests.lib, which invokes install.sh without --llvm-coverage. Two deliberate differences from ClickHouse#97823: its USE_ENCRYPTED_STORAGE=0 default line is not re-landed, because it clobbers the export in stress_runner.sh and would silently disable the encrypted-storage guard on the one job that sets the variable; and the environment checks use == rather than -eq, matching what install.sh already does for these same variables. ClickHouse#97823 was live on master for 6h43m, which measures this change without a coverage exclusion: all 19 TIMEOUT_EXCEEDED rows in that window were on amd_llvm_coverage, while the arm_binary stateless jobs ran with the symlink installed and had no failures.
…with a test The gate is a conjunction of two independent decisions, and only the first was addressed by the previous commit. Which build kinds can take a 60 second per-query cap is what is_fast_build answers. Which jobs should get the profile at all is a separate question that the original one-line gate never asked. Measured over 7 days of master, three tests that run on jobs satisfying is_fast_build exceed 60 seconds in a single server-side query, so enabling the profile for all of them would redden currently green runs. 03988_cached_read_big_at on Stateless tests (arm_binary, sequential) is the clearest: its whole body is one SELECT over test.hits_parquet, and its 139 runs are 139/139 above the cap with a minimum of 320970 ms, so it would fail deterministically on every PR and every master commit. Rather than weaken or tag those tests to fit a CI config change, gate the symlink on FAST_TEST, which has one setter and one caller, so the affected set is closed by construction: Fast test and Fast test (arm_darwin), nothing else. There the exposure is zero out of 52201028 OK rows, and structurally so, because the runner already kills a test file after 60 seconds of wall clock (--timeout 60) and skips the long and stateful tests entirely, so a per-query cap of the same value cannot fire on a healthy test. The three guards inside is_fast_build are kept on top of the job scope, so a future Fast test flavour built with sanitizers, coverage or object storage still would not get the profile. Add ci/tests/test_install_sh_fast_limits.py, run by the existing CI Tests job. Nothing asserted on this symlink before, which is how the dead branch survived from ClickHouse#98026 until now: reverting the fix passed CI. The test drives the real install.sh with a stub clickhouse earlier on PATH answering the system.build_options probes, and asserts on the resulting symlink rather than on trace text. The shell function under test is not stubbed. Each guard is separately load-bearing: reverting the call site, dropping the FAST_TEST condition, and removing any one of the three guards each fails the suite. Also compare the build kind probe as a string instead of with -eq. The result is empty when the CXX_FLAGS row is absent, which is reachable because upgrade_runner.sh runs the install with a previous-release binary on PATH, and -eq on an empty string makes bash print "integer expression expected" and return 2. That is fail-open by accident rather than by construction, and == is what install.sh already uses for these same variables.
…test The stub `clickhouse` matched on query text and re-implemented the `is_fast_build` predicate in Python, so the SQL that `install.sh` actually sends was never evaluated. Four wrong versions of that SQL left all ten tests green: dropping `upper` from the coverage check, reducing it to a row-presence check, dropping the `-DNDEBUG` conjunct so a debug build looks like a fast build, and weakening the conjunction to a disjunction. That is the same defect class this change exists to fix, an assertion that cannot fail, which matters because the point of the test is to stop the branch going dead again. The stub now models the `system.build_options` rows instead of the answers: it rewrites `system.build_options` to a synthetic table built from raw row values and hands the rest of the query text, unchanged, to a real `clickhouse local`. The `CI Tests` job already puts a binary on PATH before pytest starts, and a missing binary fails the tests rather than skipping them, so the suite cannot go silently vacuous. The build-kind case is split into separate sanitizer and debug tests, each driving a real `CXX_FLAGS` string, and the positive cases now assert the symlink target rather than only that a symlink exists. The mutation matrix grows from six to eleven; all eleven fail the suite. `tests/config/install.sh` is unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]>
… scheduled Two review findings on the limits_fast.yaml gate. The WITH_COVERAGE guard inside is_fast_build failed OPEN: when the probe could not answer (a binary without that row returns zero rows, so the substitution is empty) the `if [[ "$x" == "1" ]]` fell through and the predicate proceeded toward installing the profile. That direction is wrong specifically for coverage, because the guard exists precisely because coverage flags are applied per directory and never reach CXX_FLAGS, so the build-kind check cannot compensate: a coverage build carries -DNDEBUG and no -fsanitize=, would report "fast", and would get the 60 s cap, which is the regression ClickHouse#98026 reverted ClickHouse#97823 for. Inverting the probe to `NOT IN ('ON', '1')` and comparing `!= "1"` makes an unanswerable probe decline, degrading to the previous no-symlink behaviour. Every answerable state keeps its verdict, verified against a real server for OFF, ON, on and 1. The test that had asserted the fail-open direction now asserts the decline, and a new mutation reverts only the direction so nothing else has to pin it. The new gate test also could not protect the file it guards. JobConfigs.ci_tests had digest_config include_paths=["./ci"], which drives both is_affected_by and calc_job_digest, and cache records are keyed only on (job_name, job_digest). A later PR editing only tests/config/install.sh therefore left the CI Tests digest byte-identical and resolved a cached success, so the test would never run -- the same defect class as the bug this fixes, one level up. Measured: the digest was identical across a mutation of the gate line before this change and differs after it, while is_affected_by stays false for unrelated paths. Also reworded the call-site comment: the runner gives each test file a 60 second wall-clock budget rather than killing it promptly at 60 seconds, since clickhouse-test waits on the timeout and kills the process group later.
Internal second-model review (4 rounds, 22 findings, 18 AGREE / 1 DISAGREE / 3 recorded-only)Each round is an independent cold review of the resulting code plus a separate second-model pass; r1 (1 blocker, 2 major, 2 nits)
r2 (2 major, 5 nits)
r3 (2 major, 2 nits)
r4 (2 major, 4 nits); the second-model pass returned zero findings
Validation carried forward: 11 tests, all passing; 12 production mutations, each caught by a named |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-review-slot-48:20260729-025400 |
|
Workflow [PR], commit [bb14a17] Summary: ✅ AI ReviewSummaryThis PR fixes the dead Findings
Tests
Final Verdict |
| @@ -0,0 +1,266 @@ | |||
| """ | |||
There was a problem hiding this comment.
Please remove this test, it's useless
There was a problem hiding this comment.
Removed in bb14a17. The ci_tests digest entries for install.sh and limits_fast.yaml only existed to schedule that test, so they went with it and the PR is now just the install.sh fix. That leaves the gate with no automated coverage; let me know if you want any replacement.
CI finish ledger - f51e578Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260729-120000 |
Reviewer asked to drop ci/tests/test_install_sh_fast_limits.py as not useful. The ci_tests digest entries for install.sh and limits_fast.yaml existed only to schedule that test, so they go with it and ci_tests returns to its master configuration. The fix itself, the is_fast_build correction and the FAST_TEST scoping of the limits_fast.yaml symlink in tests/config/install.sh, is unchanged.
| # Only the Fast test job, whose runner already gives each test file a 60 second wall-clock | ||
| # budget, so a 60 second per-query limit cannot be the first thing to fire on a healthy | ||
| # test there. Other jobs that satisfy is_fast_build run the long tests that Fast test skips. | ||
| if [ "$FAST_TEST" == "1" ] && is_fast_build; then |
There was a problem hiding this comment.
The safety argument for narrowing this to Fast test does not actually hold in code. fast_test.py passes clickhouse-test --timeout 60, but clickhouse-test turns that into signal.alarm(int(args.timeout * 1.1) + 60) (tests/clickhouse-test:4637-4638, option at tests/clickhouse-test:6180-6183), so a test file gets about 126 seconds before the runner aborts it.
Once limits_fast.yaml is linked here, any healthy fast-test query in the 60-126s range will now fail with TIMEOUT_EXCEEDED even though the runner would still have kept the test alive. That means the comment above this if is incorrect, and the new gate is relying on a stale invariant rather than something the code actually enforces.
Please either justify the 60-second server-side cap with evidence that tracks per-query runtimes, or set the cap above the runner's real deadline if the invariant you want is "the runner fires first."
There was a problem hiding this comment.
The 126 second figure is the outer watchdog, not the per-test deadline.
clickhouse-test bounds each test file twice. The inner bound is proc.wait(args.timeout) at tests/clickhouse-test:3516 in run_single_test; process_result_impl then marks the file FAIL / Timeout! because that wait left proc.returncode is None (:3149, :3158, :1297). With --timeout 60 that is 60 seconds per test file, and args.timeout is never reassigned in the file. The signal.alarm(int(args.timeout * 1.1) + 60) you quote (:4630-4631, run_tests_array) wraps test_case.run plus process_result, so it covers that inner wait plus stdout post-processing, _cleanup (up to another 60 seconds, :3822) and the stacktrace dumps. It fires only if the Python side hangs.
A query therefore cannot outlive the file issuing it: the query reaches 60 seconds at file_start + d + 60 with d >= 0, while the wait expires at file_start + 60. The runner fires first, so the profile can only change the reported reason of an already-failing test, never turn a passing one red.
Runtimes agree. Over 30 days of Fast test%, 214M test runs: p99 4.3 s, p999 9.7 s, 488 runs at or above 60 s, 437 of those in the 60-126 s band, and exactly 1 of the 437 is OK (01824_prefer_global_in_and_join, Fast test (arm_darwin), 60060 ms, a boundary race). Bucketed over 50-200 s: 50 s 179/172 OK, 60 s 436/1, 80 s 1/0, 120 s 7/0, 130 s 2/0. Durations pile up against the 60 s wall, not 126 s. Fast test also passes --no-long.
Keeping the cap. The comment's "60 second wall-clock budget" is that proc.wait, so it is accurate as written; happy to reword it to name proc.wait explicitly if that reads better.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
tests/config/users.d/limits_fast.yamlhas never been installed on any CI job.is_fast_build(tests/config/install.sh:74-77) onlyreturns an exit code and prints nothing,while the call site read stdout:
if [[ $(is_fast_build) == 1 ]]. The substitution is alwaysempty, so the branch was never taken. Any job's
set -xtrace shows it (++ return 1,+ [[ '' == 1 ]],grep -c limits_fast job.log= 0), somax_execution_time: 60has never beenin effect, and the
CancellationCheckerit arms (ProcessList.cpp:381) has never run here.The fix makes both halves agree on one convention:
is_fast_buildstays a predicate, the callsite becomes a plain
if.This re-lands #97823, reverted by #98026 because the LLVM coverage build passes the predicate
(
-DNDEBUG, no-fsanitize=) while being ~2-3x slower. That objection was correct, so thecoverage exclusion is included, keyed on the
WITH_COVERAGErow rather than onCXX_FLAGS, whichcannot see coverage flags (applied per directory, while
CXX_FLAGSrenders@FULL_CXX_FLAGS_NORMALIZED@).tests/clickhouse-testreads the same row for the same reason.An unanswerable probe declines; the guards compare strings, so an empty result is not a shell error.
Impact is limited to
Fast test, because the gate now also requires--fast-test, whose onlycaller is
ci/jobs/fast_test.py:330. Over 7 days of CIDB, 0 of 53 243 160 passing test rows onthat job exceeded 60 s (slowest 57 840 ms), and structurally so: the runner already gives each
test file a 60 s budget (
--timeout 60, the only one inci/). I did not widen it, because otherjobs satisfying
is_fast_builddo run single queries past 60 s.ci/tests/test_install_sh_fast_limits.py(new) drives the realinstall.shand asserts on theresulting symlink; nothing previously did, which is how the dead branch survived.
ci/defs/job_configs.pyadds both files to theCI Testsdigest, so that test is scheduledwhen the gate it guards changes.
Version info
26.8.1.510(included in26.8and later)