Serve consumer offset reads from the partition primary

Open
#4,409 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@numinnex is already working on this.

Since Oct 8, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Start in core/server/src/dispatch/partition.rs at handle_get_consumer_offset and read the TODO above it; compare the offset-write routing via GET_CONSUMER_OFFSET_ROUTING_CODE and the auto-commit path’s is_caught_up_primary check. Trace the related SDK behavior in ConsumerOffsetClient::get_consumer_offset and the Kafka gateway’s OffsetFetch/OffsetCommit flow. Done when a read immediately after a commit returns the committed offset rather than a stale replica value.

Written by the indexing model from the issue text.

Description

rust server
Description

handle_get_consumer_offset answers from the local replica of the partition (see the TODO above it in core/server/src/dispatch/partition.rs). The SDK sends the read to the node it is connected to, and that node can be a backup that lags the partition's primary. A read right after a store can then return the previous offset. #4392 documents this on ConsumerOffsetClient::get_consumer_offset. The Kafka gateway needs read-your-commits: an OffsetFetch right after an OffsetCommit must return the committed offset. Raised in the review of #4392.

Affected area / component

Iggy server, Rust SDK

Proposed solution

Route the read to the partition primary, the way GET_CONSUMER_OFFSET_ROUTING_CODE routes offset writes. Gate it on the server with is_caught_up_primary, as the auto-commit path does.

Alternatives considered

Define a follower-read contract, and let a caller that needs read-your-commits route the read itself.

Dominant language
Rust
Stars
5.3k
Forks
548
Avg merge
2d 20h
Merged PRs (30d)
194

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/iggy

All issues in apache/iggy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.