Skip to content

KAFKA-20193: Remove static <T> T value(...) method from ValueTimestampHeadersDeserializer if not needed#21539

Open
asknishant wants to merge 1 commit intoapache:trunkfrom
asknishant:asknishant/KAFKA-20193
Open

KAFKA-20193: Remove static <T> T value(...) method from ValueTimestampHeadersDeserializer if not needed#21539
asknishant wants to merge 1 commit intoapache:trunkfrom
asknishant:asknishant/KAFKA-20193

Conversation

@asknishant
Copy link
Copy Markdown

@asknishant asknishant commented Feb 22, 2026

PR: Remove static T value(...) method

The method acted as a utility to extract only the original payload value out of a serialized ValueTimestampHeaders byte array without needing to deserialize the entire object.

According to KIP-1271, the objects are serialized in this format: [headersSize (varint)] + [headersBytes...] + [timestamp (8 bytes)] + [actual value payload]

The value(...) method performed an optimized shortcut by:

Wrapping the bytes in a ByteBuffer.
Peeking at the headersSize to know how long the headers sequence was.
Repositioning its pointer (skipping over the headersBytes and skipping the 8-byte timestamp).

Taking the rest of the bytes at the end of the array and passing them straight to the nested deserializer.
It essentially allowed grabbing the inner value payload while ignoring the headers and timestamp overhead, but since this specific read pattern wasn't actively needed in the Kafka Streams codebase anymore, removing it avoided maintaining unused code.

Reviewers: @aliehsaeedii @bbejeck @mjsax

@github-actions github-actions bot added triage PRs from the community streams labels Feb 22, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

@github-actions github-actions bot added small Small PRs and removed small Small PRs labels Mar 31, 2026
@asknishant asknishant closed this Mar 31, 2026
@asknishant asknishant force-pushed the asknishant/KAFKA-20193 branch from 13fbd76 to b974ccd Compare March 31, 2026 17:28
@github-actions github-actions bot added the small Small PRs label Mar 31, 2026
@asknishant asknishant reopened this Mar 31, 2026
@asknishant asknishant closed this Mar 31, 2026
@asknishant asknishant force-pushed the asknishant/KAFKA-20193 branch from 76da708 to e2154fe Compare March 31, 2026 19:08
@asknishant asknishant reopened this Mar 31, 2026
}
return deserializer.deserialize("", Utils.rawPlainValue(rawValueTimestampHeaders));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

accidental newline? :). Should be okay though as checkstyle doesn't pick on it.

Copy link
Copy Markdown
Contributor

@zheguang zheguang left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @asknishant . It looks good to me.

@github-actions github-actions bot removed needs-attention triage PRs from the community labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants