FEAT: Add client_rack field to kafka task#75
Merged
Shivang Nagta (ShivangNagta) merged 2 commits intoJun 12, 2026
Merged
Conversation
Copilot started reviewing on behalf of
Shivang Nagta (ShivangNagta)
June 11, 2026 19:42
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for configuring Kafka rack-awareness for consumers by introducing a client_rack task field that maps through to librdkafka’s client.rack, enabling rack-aware partition assignment and follower fetching when broker-side rack settings are present.
Changes:
- Add optional
client_rackfield to the Kafka task configuration struct. - Propagate
client_rackinto both group and standalone consumer librdkafka config maps when set. - Document the new field and provide an example configuration for rack-aware consumption.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/pkg/pipeline/task/kafka/README.md | Documents client_rack and adds a rack-aware consumer example. |
| internal/pkg/pipeline/task/kafka/kafka.go | Adds ClientRack config field and sets client.rack for consumer configs when non-empty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Divyanshu Tiwari (divyanshu-tiwari)
approved these changes
Jun 12, 2026
prasadlohakpure
approved these changes
Jun 12, 2026
ff2a71a
into
patterninc:main
7 checks passed
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.
Description
Adds an optional
client_rackfield to the kafka task that sets librdkafka'sclient.rackon the consumer. This lets a consumer take advantage of Kafka'srack-aware features like fetch-from-follower (KIP-392) and rack-aware partition
assignment (KIP-881), so it reads from a replica in its own availability zone
instead of the (possibly cross-AZ) leader, reducing inter-AZ data transfer cost.
The value is passed through to both the group consumer and standalone consumer
configs, and is omitted entirely when unset.
Note: this is the client-side requirement only. The benefit is realized when the
brokers are configured with
broker.rack(and, for fetch-from-follower, arack-aware
replica.selector.classsuch asRackAwareReplicaSelector).Test
My tests were performed locally with 3 brokers (podman containers), with a single partition in a topic called
t392(replication set to 3, leader on broker-1)Before
Without client_rack (consumer fetches from the leader broker (broker - 1))
Example yaml used:
After
With client_rack set to
rack-c(same as broker -3) andreplica.selector.classset toRackAwareReplicaSelectorfor brokers (consumer sends the initial request to leader broker (broker - 1), subsequent fetches migrate to broker - 3)Example yaml used:
Types of changes
Checklist