Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/producer-response-batch-matching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Notes on ProduceResponse → ProducerBatch matching

While reading `Sender.handleProduceResponse`, I wanted to write down a few questions
before making any code changes.

The response-to-batch lookup currently relies on:
- topicId when present (newer protocol versions)
- falling back to topic name + partition otherwise
- a snapshot of topicId → name mapping taken before send

Given that metadata can change while a produce request is in flight (topic recreation,
leader changes, protocol differences), I wanted to confirm the guarantees here.

In particular:
- Are we assuming that a response with a non-zero topicId can always be resolved
using the topic-name snapshot taken before sending?
- In what cases (if any) can `batch == null` occur, and is that considered an
impossible state or a deliberate hard failure?

This is just a note for now — no behavior change proposed yet.