Skip to content

[BP-2.2][FLINK-40227][core] Use readFully to read Variant value/metadata in VariantSerializer.deserialize - #28852

Merged
ferenc-csaky merged 1 commit into
apache:release-2.2from
avalonalex:FLINK-40227-2.2
Jul 31, 2026
Merged

[BP-2.2][FLINK-40227][core] Use readFully to read Variant value/metadata in VariantSerializer.deserialize#28852
ferenc-csaky merged 1 commit into
apache:release-2.2from
avalonalex:FLINK-40227-2.2

Conversation

@avalonalex

Copy link
Copy Markdown
Contributor

Backport of #28810

Was generative AI tooling used to co-author this PR?
  • Yes (Claude Code)

Generated-by: Claude Code (Anthropic Claude)

🤖 Generated with Claude Code

…ariantSerializer.deserialize

VariantSerializer.deserialize filled the value and metadata byte arrays with
DataInputView#read(byte[]) and ignored the returned count. That read is
permitted to return a partial (short) read when the array straddles a buffer or
compression-frame boundary in the source stream. A short read leaves the tail of
the array unfilled and desyncs the stream, and when restoring large Variant keys
from a checkpoint key-group stream on rescale it surfaces as MALFORMED_VARIANT (a
misaligned read lands on a bad metadata header) or an OutOfMemoryError (a
misaligned read lands on a length prefix). It is intermittent because whether an
array straddles a boundary varies between restore attempts.

Use readFully instead: it loops until each buffer is filled and throws
EOFException only on a genuine end-of-stream. The on-wire format is unchanged, so
this is fully snapshot-compatible and needs no state migration.
@flinkbot

flinkbot commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@ferenc-csaky
ferenc-csaky merged commit 2fbf699 into apache:release-2.2 Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants