Repository navigation
Report execution errors in clickhouse-local --ignore-error and align the exit code of clickhouse-client with it - #119572
Conversation
`LocalServer::processError` returned early whenever `ignore_error` was set, so `clickhouse-local --ignore-error` printed nothing at all for a statement that failed at execution: no message and no exception code, which made a broken multi-statement script indistinguishable from a working one. Parse errors were still reported, because those are printed by `ClientBase::parseQuery` and never reach `processError`. `--ignore-error` asks to carry on with the next statement, not to hide what went wrong, so the exception is now reported instead of rethrown - rethrowing it would end the run. `Client::processError` has always reported it this way, including the `(query: ...)` line that identifies the failing statement in a batch. The interactive branch is reached now as well: `ignore_error` is set for `delayed_interactive` too, so the print of an interactive session was unreachable whenever `--ignore-error` was passed. Closes: #119529 Co-authored-by: yakov <[email protected]>
`Client::main` returned the code of the exception left behind by the last statement of the batch. The per-statement state is reset in `processParsedSingleQuery`, so that was the code of whichever error the final statement happened to hit and nothing else: the same batch exited with a failure or a success depending only on the position of the failing statement in it. `clickhouse-local --ignore-error` returned success in every one of those cases. Align the client with it: `--ignore-error` has already reported every failed statement and elected to carry on, so the run is not a failure. BuzzHouse keeps the error code, because it stops the run on an error anyway - the same exception it already makes in `ClientBase::executeMultiQuery`. Co-authored-by: yakov <[email protected]>
`clickhouse-test` fails a shell test on any non-empty stderr, so the three tests that run `clickhouse-local --ignore-error` over a failing statement without redirecting stderr passed only because the error was swallowed. They discard the report now; the comment of 05042 said outright that the error text is swallowed, which is no longer the case. The new test covers both programs, with the failure placed before and after a working statement, so the exit code no longer depends on that position. Co-authored-by: yakov <[email protected]>
Neither page said what `--ignore-error` does with the error itself or with the exit code, and the client had no entry for it at all. Co-authored-by: yakov <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
Workflow [PR], commit [691aaf8] Summary: ✅
AI ReviewSummaryThis PR makes Missing context / blind spots
Final Verdict✅ No new findings. LLVM Coverage ReportMeasured on commit 691aaf8.
Changed lines: Changed C/C++ lines covered: 24/31 (77.42%) · Uncovered code |
`ClientEmbedded::processError` is a copy of `LocalServer::processError` and had the same early return, so the embedded client swallowed execution errors under `--ignore-error` too. Its exit code already matches `clickhouse-local`: `ClientEmbedded::run` returns zero unless an exception propagates out of it. Co-authored-by: yakov <[email protected]>
The test harness runs the client with `--send_logs_level=warning`, so the server log of the failing query reaches the client's stderr and the error name appears there a second time. Silence the forwarded log, the way other tests that read stderr do. Co-authored-by: yakov <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 30 s compile time in total, 9 of them have a recent master baseline. |
`Client::processConfig` read `ignore-error` only in its non-interactive branch, and a delayed-interactive run on a terminal (`--interactive` together with `--query` or `--queries-file`) takes the other one. The option was dropped there, even though the given queries are executed as a batch by `runNonInteractive` before the prompt is entered: the prelude stopped at its first failing statement and `Client::main` returned the code of that statement, ending the run before `runInteractive`. `clickhouse-local` and the embedded client already load the option for `delayed_interactive`; take the same condition. The reported exception still ends such a run when `--ignore-error` is not given, which is unchanged and outside of the option's contract. Co-authored-by: yakov <[email protected]>
The option is only dropped when stdin is a terminal, because that is what makes `is_interactive` true for a delayed-interactive run, so the test needs a pty. Both spellings of the prelude are covered, `--query` and `--queries-file`. Co-authored-by: yakov <[email protected]>
`ignore_error` does not say who asked for it. Besides the user's `--ignore-error`, `Client::processOptions` turns it on for `--query-fuzzer-runs`, `--create-query-fuzzer-runs` and BuzzHouse, so that they tolerate unparseable input, and the success exit code of an ignored batch was handed to those modes as well. The AST fuzzer reports an early stop through that exit code and through nothing else. When `tryToReconnect` fails in `processWithASTFuzzer`, the step returns `false` with `have_error` and the exception still set - it skips the reset that every completed step does - and `runNonInteractive" just returns, so `Client::main` is the only place left to report it. Granting it success ends a fuzzer run that lost the server after a handful of queries with `Fuzzer exited with success` in `ast_fuzzer_job`, which reads `fuzzer_exit_code` 0 as OK. Exclude the fuzzing modes the same way BuzzHouse already was, so only a user-supplied `--ignore-error` gets the success exit. Co-authored-by: yakov <[email protected]>
`--create-query-fuzzer-runs` is the mode that can be pinned down without taking the server away mid-run: it turns `ignore_error` on but never enters the fuzz loop, which is what discards the error of every step, so the exception of the last statement reaches `Client::main` just like in a plain batch. The AST fuzzer's own early stop needs the server to disappear, which does not belong in a stateless test, but it shares this root cause. Co-authored-by: yakov <[email protected]>
|
@yakov-olkhovskiy @alexey-milovidov — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
…he Join mutation tests Since #119572 (#119572), `clickhouse-local --ignore-error` reports execution errors on stderr, so the fail-point errors of the five Join mutation tests made `Fast test` red ("having stderror"). Redirect stderr of those runs to a file and print the count of `FAULT_INJECTED` errors, which also proves the injected failures happened. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=119196&sha=b253202e872a1f42851bbb312007c0e8e33040ae&name_0=PR&name_1=Fast%20test PR: #119196 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
26.8 `clickhouse-local` does not print errors under `--ignore-error` (changed in #119572), so run each query separately. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=128063&sha=445a346409e70a7a13c660be6b8cb22ec8f0e3e9&name_0=BackportPR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29 #128063 Co-Authored-By: Claude Opus 5.5 <[email protected]>
26.9 `clickhouse-local` does not print errors under `--ignore-error` (changed in #119572), so run each query separately. #128064 Co-Authored-By: Claude Opus 5.5 <[email protected]>
On this release branch `clickhouse-local --ignore-error` drops the exception of a failed statement without printing it (`LocalServer::processError` returns early). Printing it came with #119572, which is in 26.10 and later only. The four failed updates still happen, but nothing reached stderr, so the test printed 0 instead of 4. With `--send_logs_level=error` each failed query is logged once by `executeQuery`, which restores the count. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On this release branch `clickhouse-local --ignore-error` drops the exception of a failed statement without printing it (`LocalServer::processError` returns early). Printing it came with #119572, which is in 26.10 and later only. The four failed updates still happen, but nothing reached stderr, so the test printed 0 instead of 4. With `--send_logs_level=error` each failed query is logged once by `executeQuery`, which restores the count. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit ec6408d)
On this release branch `clickhouse-local --ignore-error` drops the exception of a failed statement without printing it (`LocalServer::processError` returns early). Printing it came with #119572, which is in 26.10 and later only. The four failed updates still happen, but nothing reached stderr, so the test printed 0 instead of 4. With `--send_logs_level=error` each failed query is logged once by `executeQuery`, which restores the count. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit ec6408d)
On this release branch `clickhouse-local --ignore-error` drops the exception of a failed statement without printing it (`LocalServer::processError` returns early). Printing it came with #119572, which is in 26.10 and later only. The four failed updates still happen, but nothing reached stderr, so the test printed 0 instead of 4. With `--send_logs_level=error` each failed query is logged once by `executeQuery`, which restores the count. Co-Authored-By: Claude Opus 5.5 <[email protected]>
26.8 `clickhouse-local` does not print errors under `--ignore-error` (changed in #119572), so run each query separately. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=128063&sha=445a346409e70a7a13c660be6b8cb22ec8f0e3e9&name_0=BackportPR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29 #128063 Co-Authored-By: Claude Opus 5.5 <[email protected]>
On this release branch `clickhouse-local --ignore-error` drops the exception of a failed statement without printing it (`LocalServer::processError` returns early). Printing it came with #119572, which is in 26.10 and later only. The four failed updates still happen, but nothing reached stderr, so the test printed 0 instead of 4. With `--send_logs_level=error` each failed query is logged once by `executeQuery`, which restores the count. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit ec6408d)
26.9 `clickhouse-local` does not print errors under `--ignore-error` (changed in #119572), so run each query separately. #128064 Co-Authored-By: Claude Opus 5.5 <[email protected]>
On this release branch `clickhouse-local --ignore-error` drops the exception of a failed statement without printing it (`LocalServer::processError` returns early). Printing it came with #119572, which is in 26.10 and later only. The four failed updates still happen, but nothing reached stderr, so the test printed 0 instead of 4. With `--send_logs_level=error` each failed query is logged once by `executeQuery`, which restores the count. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit ec6408d)
Closes: #119529
Related: #105480
Related: #106523
clickhouse local --ignore-errorprinted nothing at all for a statement that failed at execution — no message, no exception code — and exited with a success code, so a broken multi-statement script was indistinguishable from a working one:LocalServer::processErroropened withif (ignore_error) return;, so neither the interactive print nor the non-interactive rethrow ran.Client::processErrorhas no such gate, which is whyclickhouse-client --ignore-errorreported the same failure all along. Parse errors survived even inclickhouse-local, because those are printed byClientBase::parseQueryand never reachprocessError— only execution errors vanished. The gate dates back to theclickhouse-localinteractive-mode work in 615dbd4 (2021-09-05), which replaced an even broaderif (!is_interactive) return;.--ignore-errorasks to carry on with the next statement, not to hide what went wrong, so the exception is now reported instead of rethrown — rethrowing it would end the run. The report follows whatClient::processErroralready does, including the(query: ...)line that identifies the failing statement in a batch. The interactive branch becomes reachable as well:ignore_erroris set fordelayed_interactivetoo, so an interactive session silently swallowed its errors whenever--ignore-errorwas passed.ClientEmbedded::processErroris a copy of the same function and had the same early return, so the embedded client is fixed along with it.The exit code
Client::mainreturned the code of the exception left behind by the last statement of the batch. Per-statement state is reset at the top ofprocessParsedSingleQuery, so that was the code of whichever error the final statement happened to hit and nothing else — the same batch exited with a failure or a success depending only on where in it the failing statement sat:clickhouse-local --ignore-errorreturned success in both. The client is aligned with it: the errors have been reported and the run elected to carry on, so it is not a failure. BuzzHouse keeps the error code, because it stops the run on an error anyway — the same exception it already makes inClientBase::executeMultiQuery. This also generalizes what 04318_client_query_fuzzer_runs_ignore_parse_error already asserts, that a stale ignored exception must not decide the exit code.Delayed-interactive runs
Client::processConfigreadignore-erroronly in its non-interactive branch, and--interactivetogether with--queryor--queries-filetakes the other one when stdin is a terminal. The option was dropped there, even though those queries are executed as a batch byrunNonInteractivebefore the prompt is entered: the prelude stopped at its first failing statement and the code of that statement ended the run beforerunInteractive, so--ignore-errorhad no effect at all.clickhouse-localand the embedded client already load the option fordelayed_interactive; the client now takes the same condition. Without--ignore-errorsuch a run still ends at the reported exception, which is unchanged.Tests
clickhouse-testfails a shell test on any non-empty stderr, so the three tests that driveclickhouse-local --ignore-errorover a failing statement without redirecting stderr passed only because the error was swallowed; they discard the report now. The comment of 05042_local_system_database_deferred_populate_error said outright that--ignore-error"swallows the error text", which is no longer true.Two tests are added. 05182_local_ignore_error_reports_execution_errors covers both programs with the failure placed before and after a working statement, so the exit code no longer depends on that position. 05183_client_delayed_interactive_ignore_error covers the delayed-interactive prelude for both
--queryand--queries-file; it needs a pty, because the option is only dropped when stdin is a terminal, so it is an expect test.Verified against a local Release build. Both new tests fail on a binary built without the corresponding fix and pass with it. Every existing test that uses
--ignore-erroror--interactivepasses, 26 in total, including 04650_geoparquet_wkt_empty_and_case and 03212_thousand_exceptions (formatting the 1000 reports it now emits costs about 5% of its runtime, with byte-identical stdout). As a regression check, all 317localandclientstateless tests were run twice with identical non-randomized settings, once with this branch and once with the unmodified master build: no test fails only with the change, and the one difference is the new test, which fails on the unmodified binary as intended. The failures common to both runs are the missing ZooKeeper, object storage and CI test configs of the local environment.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
clickhouse-local --ignore-errornow reports a statement that failed at execution instead of skipping it silently: previously it printed no message and no exception code, so a failing multi-statement script looked exactly like a passing one, whileclickhouse-client --ignore-errorreported every error all along.clickhouse-clientalso ignored the option entirely when it was combined with--interactiveand--query/--queries-fileon a terminal, and now applies it to those queries too. The exit code ofclickhouse-client --ignore-errorchanges accordingly: it used to be the code of whichever error the last statement of the batch happened to hit, which made the result depend on the position of the failing statement rather than on the batch as a whole, and it is now a success code, matching whatclickhouse-local --ignore-errorhas always returned. Scripts that relied on the old exit code to detect failures should drop--ignore-errorso that the run stops and fails at the first error, or check the reported errors onstderr.Workflow [PR]
Sync PR [sync-upstream/pr/119572]
Version info
26.10.1.879-master(included in26.10and later)