Repository navigation
Do not record handled Values parse exceptions in system error tables - #111141
Conversation
The `Values` streaming parser uses parse exceptions to fall back to SQL expression parsing. Those handled exceptions were recorded in `system.errors` and `system.error_log` even when the insert succeeded. Add a thread-local scope that suppresses system error accounting around the two speculative parses. Exceptions that propagate, including `Decimal` overflow, are recorded explicitly before they leave the parser. Related: ClickHouse/support-escalation#8208 Alternative to: #109981
…tem-errors-minimal
|
Workflow [PR], commit [4073dff] Summary: ❌
AI ReviewSummaryThis PR suppresses Findings
Tests
Final Verdict
|
There was a problem hiding this comment.
Pull request overview
This PR prevents handled Values-format parse exceptions (used for speculative streaming parsing before falling back to SQL expression parsing) from being counted in system.errors / system.error_log, while still ensuring that exceptions which propagate (including Decimal overflow) are explicitly recorded.
Changes:
- Add
Exception::SuppressErrorCodesScope(thread-local) to suppresssystem.errorsaccounting during speculative parsing, plusException::recordToSystemErrorsto explicitly record propagated exceptions. - Apply suppression scopes in
ValuesBlockInputFormat’s two speculative parse paths and explicitly record/rethrow non-parse-error exceptions andDecimaloverflow. - Add a stateless query test verifying: (1) successful fallback doesn’t attribute errors to the async flush query, and (2)
ARGUMENT_OUT_OF_BOUNDoverflow is still recorded.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/Common/Exception.h |
Adds RAII suppression scope API and an explicit “record to system errors” method. |
src/Common/Exception.cpp |
Implements thread-local suppression and explicit recording via ErrorCodes::increment. |
src/Processors/Formats/Impl/ValuesBlockInputFormat.cpp |
Suppresses accounting for speculative parses; explicitly records exceptions that will propagate. |
tests/queries/0_stateless/04613_values_expression_fallback_no_system_errors.sh |
New regression test covering fallback behavior and overflow accounting. |
tests/queries/0_stateless/04613_values_expression_fallback_no_system_errors.reference |
Expected output for the new test. |
Drop fixed-name test tables before and after the test so interrupted runs do not leave state behind.
Map each asynchronous insert request to its flush query and check errors for that context. Enable immediate failure for unexpected shell command errors.
Apply system-error suppression to expression-template probes as well as direct deserialization. Record exceptions explicitly only when they propagate instead of falling back to another parser.
Cover the complete template-deduction attempt so unsupported AST nodes can fall back without recording handled exceptions. Initialize the template parse result for clang-tidy.
Use named states for exceptions that were never recorded and exceptions whose accounting was suppressed. Only the latter may be recorded explicitly when it propagates.
…tem-errors-minimal
Document the preferred narrow scope and that explicit recording bypasses active suppression. Cover active-scope recording in the unit test.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 90/98 (91.84%) · Uncovered code |
|
Ignoring the Bugfix validation job because the old code didn't have the |
…system-errors-minimal Do not record handled `Values` parse exceptions in system error tables
The
Valuesstreaming parser intentionally catches parse exceptions and falls back to SQLexpression parsing. Those handled exceptions were still recorded in
system.errorsandsystem.error_log, so a successful asynchronous insert could attribute errors to itsAsyncInsertFlushquery.Add
Exception::SuppressErrorCodesScopeas a reusable thread-local RAII mechanism for code pathsthat intentionally construct and handle exceptions without increasing the system error counters.
It can be used anywhere an expected or speculative failure should not be recorded in
system.errorsor consequentlysystem.error_log. An exception that leaves such a scope must berecorded explicitly with
recordToSystemErrorsbefore it propagates.Apply the scope to the speculative direct and expression-template parsing paths in the
Valuesformat. Propagated exceptions, including
Decimaloverflow, continue to be recorded.Related: #109981
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
Valuesformat no longer records parse errors insystem.errorsandsystem.error_logwhen streaming parsing successfully falls back to SQL expression parsing.