Skip to content

Propagate decompressor errors when reading compressed blocks - #46

Merged
alexey-milovidov merged 2 commits into
masterfrom
avro-codec-errors
Oct 28, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
avro-codec-errors

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

readCompressedBlock left the filtering_istream with its default exception mask, so a decompressor exception only set badbit, which IStreamBufferCopyIn::read treats as the end of data. When the decoded records fill the input buffer exactly, the error of a truncated or corrupted block happened during the drain in hasMore and was discarded, so the block was read successfully. This affects the deflate, zstd, bzip2 and xz codecs.

Now the exception mask includes badbit, so the original decompressor exception propagates.

Related: ClickHouse/ClickHouse#127774
Related: #45

🤖 Generated with Claude Code

`readCompressedBlock` left the `filtering_istream` with its default exception mask, so a
decompressor exception only set `badbit`, which `IStreamBufferCopyIn::read` treats as the end of
data. When the decoded records fill the input buffer exactly, the error of a truncated or corrupted
block happened during the drain in `hasMore` and was discarded, and the block was read successfully.

Related: ClickHouse/ClickHouse#127774

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit to ClickHouse/ClickHouse that referenced this pull request Oct 26, 2026
Update the `avro` submodule, which now propagates decompressor errors instead of treating them as
the end of data. Previously, a truncated `bzip2` or `xz` block was read successfully when the
decoded records filled the input buffer exactly.

Address review: #127774
Related: ClickHouse/avro#46

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With `badbit` in the exception mask of the decompressing stream, its read rethrows the error of
the decompressor, e.g. `boost::iostreams::zlib_error`, which is not an `avro::Exception`, so
ClickHouse reported a corrupted `deflate` block as `STD_EXCEPTION` instead of `AVRO_EXCEPTION`.
Wrap it in `IStreamBufferCopyIn`.

Related: ClickHouse/ClickHouse#127774

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit to ClickHouse/ClickHouse that referenced this pull request Oct 27, 2026
Update the `avro` submodule: after the previous change, a decompressor error of a corrupted
`deflate` block propagated as `boost::iostreams::zlib_error` and was reported as `STD_EXCEPTION`,
which broke `04947_avro_count_from_files_forward_progress`. The decompressor errors are now
wrapped in `avro::Exception`.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127774&sha=latest&name_0=PR&name_1=Stateless%20tests%20(amd_debug%2C%20parallel)
Related: ClickHouse/avro#46

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Oct 28, 2026
@alexey-milovidov
alexey-milovidov merged commit de3b240 into master Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant