feat(fetch): add full Fetch v10 support #1111
Open
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.
feat: add FetchRequest v10 support (Kafka ≥ 2.6, KIP-110/320)
What this PR adds
FetchRequest_v10
/FetchResponse_v10
• Set
rack_id
capability bit → declares Zstd support• Add per-partition
current_leader_epoch
&log_start_offset
• Introduce top-level
responses
arrayApiVersion ≥ 2.1.0
(Kafka 2.6+)• Inject
leader_epoch
(-1 fallback) per partition• Parse v10 responses and decode Zstd batches
• Treat error codes 74 / 75 (FENCED / UNKNOWN_LEADER_EPOCH) as retriable → triggers metadata refresh
test_fetch_v10_format
covers request/response round-trip and happy-path fetch with ZstdResult
aiokafka
consumers now fetch successfully from Kafka 2.6+ clusters where Zstandard is enabled at broker or topic level-no more silent hangs.For older brokers (
ApiVersion < 2.1.0
) the client keeps using v4, so behaviour remains backward-compatible.Checklist
fetch_v10.feature