Repository navigation
Conversation
`SnapshotSummary::fromJSON` must return an error instead of throwing when a summary counter is serialized negative (an underflowed total such as `total-files-size = -924`). Otherwise the exception escapes `IcebergMetadata::getHistory` and `system.iceberg_history` reports the whole table as broken rather than a single UNKNOWN snapshot. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [1a047b8] Summary: ❌
AI ReviewSummaryThis PR changes Findings
Tests
Final VerdictStatus: Minimum required action: narrow the catch boundary in |
|
|
||
| return result; | ||
| } | ||
| catch (const std::exception & error) |
There was a problem hiding this comment.
SnapshotSummary::fromJSON is now a tolerant parser, but this function-wide catch (const std::exception &) also converts resource/control exceptions raised while building parsed, copying Strings, or filling extra_fields into a malformed-summary result. In particular MemoryTracker throws MEMORY_LIMIT_EXCEEDED from allocations, and the existing try-deserialize helpers explicitly rethrow non-parse errors for this reason. With this catch, a query on system.iceberg_history can log UNKNOWN for one snapshot and keep going after a query memory limit or std::bad_alloc instead of failing the query. Please only turn data/JSON parse failures into std::unexpected (for example CANNOT_PARSE_NUMBER plus the relevant Poco::Exceptions), and rethrow MEMORY_LIMIT_EXCEEDED, CANNOT_ALLOCATE_MEMORY, std::bad_alloc, and other non-parse exceptions.
|
|
||
| return result; | ||
| } | ||
| catch (const std::exception & error) |
There was a problem hiding this comment.
Why do we need to catch std::exception? If it's only because a key might be missing from the JSON, let's check for that explicitly.
There was a problem hiding this comment.
it is checked, this is protection from a malformed json, like negative totals (CANNOT_PARSE_NUMBER) or smth like that. Maybe std::exception is too broad, but I don't know what is better. It might be a poco exception or our parser exception and i'm not sure that it is worth it to write a logic which picking errors. WDYT?
Also, the problem with this exceptions that SELECT * FROM system.iceberg_history will ruin whole request, even if just one table is broken (or even one metadata json in its history was broken). Selects with filters by table/database are less affected by this because the table is smarter now #108492
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 16/16 (100.00%) | Lost baseline coverage: none · Uncovered code |
|
waits for #109288 |
Make
SnapshotSummary::fromJSONreturn an error instead of throwing when a snapshot summary cannot be parsed. Previously the exception escapedIcebergMetadata::getHistory, so a query onsystem.iceberg_historyfailed for the whole table instead of reporting the affected snapshot with anUNKNOWNsummary. Includes a regression unit test.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Queries to
system.iceberg_historyno longer fail when an Iceberg table has a snapshot whose summary cannot be read. Such snapshots are now shown with anUNKNOWNsummary instead.