feat(gateways): map Kafka records to Iggy messages and back - #4229
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4229 +/- ##
============================================
- Coverage 87.64% 86.43% -1.21%
Complexity 1575 1575
============================================
Files 1284 1283 -1
Lines 225457 217064 -8393
Branches 188820 180429 -8391
============================================
- Hits 197593 187611 -9982
- Misses 23135 24512 +1377
- Partials 4729 4941 +212
🚀 New features to boost your workflow:
|
ryerraguntla
self-requested a review
September 20, 2026 23:17
ryerraguntla
previously requested changes
Sep 20, 2026
ryerraguntla
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Fix the header_count cap and few other minors.
Contributor
|
Mention the issue it is trying to fix and close. Also PR needs to be in the expected format with the required details. |
numinnex
reviewed
Sep 21, 2026
Produce and Fetch both sit on this, so it lands as one pure module with no Iggy calls.
krishvishal
force-pushed
the
kafka-record-codec
branch
from
September 21, 2026 12:47
c33ca55 to
74cafa9
Compare
numinnex
reviewed
Sep 21, 2026
numinnex
approved these changes
Sep 22, 2026
hubcio
approved these changes
Sep 22, 2026
krishvishal
dismissed
ryerraguntla’s stale review
September 22, 2026 11:53
All review comments addressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3560. This is the record codec that #3535 (Produce) and #3536 (Fetch) both sit on, and it writes the mapping document that was the last open scope item of #3533.
to_iggytakes one Kafka record and returns one Iggy message. The value becomes the payload. The key and each header becomekafka.user headers. A null or empty value is stored as a single placeholder byte plus a marker that says which of the two it was, so a tombstone stays on the fast path. Kafka counts timestamps in milliseconds and Iggy counts them in microseconds, so the value is multiplied by 1000 on the way in and divided on the way out.Some records do not fit. Iggy rejects an empty header value, caps a name and a value at 255 bytes, and caps all headers of one message at 100 KB. A record that trips any of those is written into an envelope instead, at the byte layout the document fixes.
from_iggyreads both forms, and a caller cannot tell them apart.A message that no Kafka producer wrote is handled too. If it carries no
kafka.headers, an Iggy client wrote it, so it becomes a record with a null key and its own headers.The batch layer sits on top.
decode_batchesdrains a whole partition blob, because one blob holds several batches back to back.encode_batchwrites one uncompressed batch for Fetch. Reading a compressed batch needs the four codecs, sogzip,lz4,snappyandzstdare turned back on forkafka-protocol.Compressed input needs a limit.
max_frame_sizeonly bounds the compressed bytes, andzstdreaches 1000 to 1 on repetitive input without being asked. One frame also holds up to 4096 partition entries, so a limit applied to each batch on its own still admits 4096 times that much. The budget therefore covers the whole request.