Skip to content

Report a tolerated do_not_check_in_pr setup failure on stdout, not the test's stderr - #122135

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-tolerated-setup-failure-must-not-fail-the-check
Sep 26, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:perf-tolerated-setup-failure-must-not-fail-the-check

Conversation

@groeneai

@groeneai groeneai commented Sep 25, 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):

Not required (CI fix).

Description

Related: #113575
Failing job: https://github.com/ClickHouse/ClickHouse/actions/runs/35807652672/job/107188619622

tests/performance/README.md:66: when a setup query marked do_not_check_in_pr fails on the
reference server, the test runs on the new server only and its queries go under
"Backward-incompatible queries" instead of failing the check.

perf.py writes that diagnostic to the test's stderr: in the tolerate branch, then once per
query, since every query inherits the connection's setup error. What it costs depends on the runner.
CI keeps a test's stderr only when perf.py exits non-zero (CHServer.run_test,
ci/jobs/performance_tests.py:1291-1293) and enters compare.sh at stage=get_profiles, whose
case fall-through skips run_tests, so a tolerated-only failure cannot fail the check there. The
standalone stage=run_tests flow, which is also the README's own, redirects unconditionally
(compare.sh:268-275, compare.sh:557), and there it does. Hence two defects:

  1. The tolerated text hides the real failure. On Add experimental Wallaby floating-point compression codec #113575, every run since 2026-09-17 shows the
    tolerated enable_wallaby_codec setting error in Run Errors for codecs_float_wallaby_insert,
    while the same -err.log also carries a 15 s Code: 159 Timeout exceeded on query2. The
    tolerated text is written first, at setup, and the sweep keeps only a log prefix (two rg matches,
    or head -10), so the timeout never reaches the table. This PR does not green that shard; the
    timeout is Add experimental Wallaby floating-point compression codec #113575's own.
  2. In the standalone flow a tolerated-only failure reds the run, contradicting README.md:66.

The diagnostic now goes to stdout once as a tolerated-setup-error tag, which survives in the
archived raw .tsv even for a failing run, and the per-query dump no longer repeats an error a
connection merely inherited.

Unchanged on purpose: a reference-only <query type="shell"> failure still raises, and an error a
query produced itself is still written to stderr and still reported by whichever runner persists
it. Pre-existing residual: compare.sh's head -10 fallback turns any non-empty test stderr into
Run Errors rows.


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

Version info

  • Merged into: 26.10.1.730-master (included in 26.10 and later)

…e test's stderr

tests/performance/README.md documents the reference-side opt-out for setup
queries: when a query marked do_not_check_in_pr fails on the reference server,
the remaining setup queries are skipped there, the test runs on the new server
only, and its queries are reported under "Backward-incompatible queries"
instead of failing the check.

perf.py writes the tolerated failure's diagnostic to the test's stderr twice:
once in the tolerate branch, and then once per query, because the prewarm loop
seeds query_error_on_connection from setup_error_on_connection so every query
of the test inherits that connection's error. Whichever runner persists that
stderr turns it into run-errors.tsv rows (compare.sh:1767-1777), which
report.py:396 counts into error_tests. The two runners differ, and the
difference decides what the bug is. The CI job keeps a test's stderr only when
perf.py exits non-zero, gated by if res != 0 in CHServer.run_test
(ci/jobs/performance_tests.py:1291-1293), and it enters compare.sh at
stage=get_profiles (performance_tests.py:2557, the only compare.sh invocation
in ci/), which the case fall-through at compare.sh:2010-2028 makes skip
run_tests entirely. So in CI a tolerated failure alone exits 0, writes no
*-err.log, and does not fail the check by itself; what it does instead is hide
the error that did: the tolerated diagnostic is written at setup, so it is
first in the log, and the sweep keeps only a prefix of that log -- the first
two rg --max-count=2 matches (compare.sh:1773-1774), or the first ten lines
when it falls back to head -10 (compare.sh:1775) -- while the real failure
sits far below it. The standalone stage=run_tests flow, which
compare.sh:268-275 names together with the manual README flow, redirects every
test's stderr unconditionally (compare.sh:557), and there a tolerated-only
failure does fail the run, contradicting README.md:66.

Both halves are live on PR ClickHouse#113575, a do_not_check_in_pr user. On its 09-17,
09-18 and 09-23 runs the Run Errors table for codecs_float_wallaby_insert
shows the deliberately tolerated Code: 115 "Setting enable_wallaby_codec is
neither a builtin setting ..." from perf.py:827 in do_create, while the
failure that actually ended the run sits in the same err.log: Code: 159,
"Timeout exceeded" on codecs_float_wallaby_insert.query2.run0, about 15.1 s
against the 15 s limit on each of the three runs, from the measured-run loop.
The author is shown the one thing the harness decided to tolerate and not the
timeout that needs the attention.

The diagnostic now goes to stdout once, emitted from the main thread after
the create threads are joined, as a structured tolerated-setup-error line.
Every thread is joined before that line is emitted, even when one of them
fails, so a fatal setup failure on a non-reference connection no longer
discards the tolerated connection's queued diagnostic. It is printed from
the main thread on purpose: do_create runs in SafeThreads, a print of a long
string is more than one write, and a torn line would corrupt the raw .tsv
that compare.sh parses by leading tag. The reason therefore survives in the
archived per-test raw .tsv, which is the artifact that is uploaded, and it
survives a failing run too, since performance_tests.py:1294-1295 writes
stdout to that .tsv unconditionally. The affected queries remain visible
under "Backward-incompatible queries", the destination both READMEs name.
The tag is additive: every existing reader of the raw .tsv is a tag-keyed
filter, so none of them matches it, and an older compare.sh paired with this
perf.py simply ignores the line.

The per-query dump no longer repeats an error a connection merely inherited
from a tolerated setup query. setup_error_on_connection[i] is None is exact
rather than a heuristic: a connection carrying a tolerated setup error is never
retried by the prewarm loop, so that entry can never be overwritten by a
different error, and a non-None value there means precisely "this is the
tolerated setup error". An error a query produced itself still goes to stderr,
where whichever runner persists it reports it; only the shell arm raises.

Deliberately unchanged, each an alternative that was considered and rejected:
a reference-only <query type="shell"> failure stays fatal, because it is not
provably version skew (a timeout or a killed process group arrives through the
same channel) and do_not_check_in_pr is already refused on tests containing
shell queries; a generic reference-only SQL prewarm failure is still written
to stderr, since reporting every prewarm error is long-standing and
deliberate; no new report table is added, because the documented destination
for these rows already exists and already renders them correctly; and
compare.sh's stderr sweep is left alone, since it correctly reports genuine
errors and the fix removes the tolerated text from its input instead.

Validated against two servers built from one binary, made asymmetric by a
user-defined function created only on the new one, which is the case the
README describes, with compare.sh's own Run Errors construction applied
verbatim, so the numbers below describe the standalone flow. Running the same
test with the pre-change and post-change perf.py takes the test's stderr from
9312 bytes and error_tests=1 to 0 bytes and error_tests=0, while the exit code
stays 0 and both queries keep their partial rows. In the CI runner the effect
is different in kind: a run whose only stderr was the tolerated diagnostic
already exits 0 and is already green, so no shard turns green, and what
changes is that the Run Errors row for a test that failed for another reason
now carries that reason. Six mutation arms confirm the narrowing: an
untolerated setup failure, a non-matching --pr-number, a failure on a
non-reference server and a reference-only shell failure all still fail the
check in either runner; a query's own reference-only failure still reaches
stderr and still reds the standalone run; and an ordinary healthy test is
undisturbed.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 25, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review

An independent model reviewed this change cold, without the author's evidence, and a gate re-reviewed it
across five rounds. Rounds 2, 3 and 5 changed no code. The reviewer never edits the diff.

❌ Blocker (agreed, fixed): the stated failure mechanism did not hold in the CI path. The change was
first described as stopping a tolerated do_not_check_in_pr setup failure from failing the check; it
cannot, because CI keeps a test's stderr only when perf.py exits non-zero
(ci/jobs/performance_tests.py:1291-1293) and enters compare.sh at stage=get_profiles, whose case
fall-through skips the unconditional stderr redirect (compare.sh:557). Title, description and one comment
were rewritten around what is measured: the tolerated text masks the failure that actually ended the run,
and reds the run on its own only in the standalone stage=run_tests flow, contradicting
tests/performance/README.md:66.

⚠️ Major (agreed, fixed): a fatal setup failure on the patched server discarded the tolerated diagnostic.
SafeThread.join() re-raises the worker's exception (perf.py:43-46) inside the join loop, and the queued
lines were written only after it, so the diagnostic reached neither stream on exactly the failing run that is
the only one keeping stderr. Every thread is now joined while the first exception is retained, the
diagnostics are emitted, then the same exception is re-raised with its original traceback: measured on a
two-server rig, zero tag rows before, exactly one after, non-zero exit on both.

⚠️ Majors (agreed, fixed): four public claims were narrower than written. (1) An error a query produced
itself does not "fail the check" in the CI runner: it is emitted as a partial row and perf.py exits 0
(perf.py:1020-1024, :1073), so error_tests is unchanged; only the shell arm raises (:1064). (2) The
masking was credited to rg --max-count=2 truncation, but on two of the three runs the rows are
byte-identical to head -10 of the log (compare.sh:1775); the conclusion held on all three, and the
replacement mechanism is run-independent, since the tolerated diagnostic is line 1 and every branch of the
sweep keeps only a prefix. (3) The live example was dated from a different signature, and is now the three
runs whose signature is provable. (4) The stderr-writer census said "exactly three" while accounting for
four: four before this change and three after.

✅ Disagreed, with evidence, no change made. The new print does not flush like its sibling does:
interpreter finalization flushes on both exit paths and the runner captures stdout through a pipe. The query
text is escaped twice
: no consumer parses that tag, so the effect is confined to how the line reads. except BaseException also catches a Ctrl-C delivered to the main thread: the workers are non-daemon threads the
interpreter joins at shutdown anyway, and the broad clause is load-bearing because SafeThread.run captures
with a bare except:, so except Exception would let a worker-raised KeyboardInterrupt escape the loop.

Checked and found sound. The suppression predicate is exact rather than heuristic, because the prewarm
loop seeds itself from that list and never re-enters a connection already carrying an error
(perf.py:991-993); at most one tolerated diagnostic can exist per run and is printed once from the main
thread, so a long line cannot be torn across writes; do_not_check_in_pr is refused outright on any test
containing a shell query (:631-635); the documented destination is untouched, since
"Backward-incompatible Queries" is built from the partial rows (report.py:405-406), not from stderr; and
every file:line citation in the commit message was re-resolved against the tree.

Residual, pre-existing, not addressed here: compare.sh's head -10 fallback turns any non-empty test
stderr into Run Errors rows, and the error_tests count itself is inflated by a ripgrep-dialect issue owned
elsewhere. Neither is this change's to fix.

@groeneai
groeneai requested a review from maxknv September 25, 2026 02:18
@clickhouse-gh

clickhouse-gh Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c7e16e7]

Summary: ✅


AI Review

Summary

This PR moves tolerated do_not_check_in_pr setup diagnostics off stderr and suppresses the inherited per-query repeats so reference-only setup failures no longer pollute Run Errors. I reviewed the current diff, the existing PR discussion, and the downstream consumers of perf.py raw output, and I did not find a remaining correctness or reporting regression in the current code.

Final Verdict

✅ No new findings.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Sep 25, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 26, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 26, 2026
Merged via the queue into ClickHouse:master with commit 3512daa Sep 26, 2026
176 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 26, 2026
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-own-pr PR origin: CI on a groeneai PR exposed a separate defect pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants