Sarama v1.61.0 released: Enhancements for consumer support and integration, including the new KIP-848 ConsumerGroupDescribe API.

Sarama v1.61.0 released: Enhancements for consumer support and integration, including the new KIP-848 ConsumerGroupDescribe API.

1 month ago
duguying
37 views
Source: GitHub Discussions

IBM's Go Kafka client library, Sarama, has released version 1.61.0, which includes the new cooperative-sticky rebalancing allocator (KIP-848 ConsumerGroupDescribe API with key 69) and fixes for several stability issues, such as broker disconnections, round-robin deadlocks, and asynchronous producer race conditions.

Related tags

#Sarama#Kafka#Go#IBM

Release Overview

IBM's Go Kafka client library, Sarama, version v1.61.0 (released on 2026-09-22), is now available. This release focuses primarily on the cooperative rebalancing feature: it introduces support for cooperative rebalancing, implements the KIP-848 defined ConsumerGroupDescribe API, and fixes several stability issues related to producers, consumers, and the protocol layer.

This version incorporates 18 PRs, with 8 new contributors.

Key Highlights

1. Support for Cooperative Rebalancing

feat(consumer): support cooperative rebalancing (#3696, submitted by dnwe) introduces a new cooperative-sticky partitioner to the consumer group. The key difference between the two approaches is how sessions are handled during rebalancing:

  • Eager (Existing Behavior): Each rebalance terminates the current session and all associated Consume calls, redistributing partitions entirely before a new session can be established. This requires repeated Consume calls within an infinite loop to obtain a new session.
  • Cooperative (New): Rebalancing becomes an incremental update of the existing session – retained claims continue consuming messages, while reclaimed partitions close their Messages() channels; Setup() is executed only once upon joining, and Cleanup() when a member leaves the group. The Consume calls maintain their context across multiple rebalances.

In terms of implementation details, the new consumeCooperative / reconcileAssignment function compares the old and new assignments using a difference operation (diffClaims), only revoking reclaimed claims. Subsequently, it waits for the corresponding ConsumeClaim to return within the Consumer.Group.Rebalance.Timeout limit; if this timeout is reached, an ErrRebalanceTimedOut error is triggered. If a claim is revoked, and it’s necessary to rejoin the group again, this will happen automatically within the same session.

An example program (#3760) supports both new values, using cooperative-sticky-upgrade for a safe transition: first, provide both partitioners simultaneously to allow older and newer instances to negotiate during the transition period, and then switch to pure cooperative mode after the full upgrade:


config.Consumer.Group.Rebalance.GroupStrategies = []sarama.BalanceStrategy{
    sarama.NewBalanceStrategyCooperativeSticky(),
}

config.Consumer.Group.Rebalance.GroupStrategies = []sarama.BalanceStrategy{
    sarama.NewBalanceStrategyCooperativeSticky(),
    sarama.NewBalanceStrategyRange(),
}

The example also introduces the -assignor parameter: <code class="language-go">range, roundrobin, sticky, cooperative-sticky-upgrade</code>.

2. New KIP-848 ConsumerGroupDescribe API (API key 69)

feat: support KIP-848 ConsumerGroupDescribe API (#3748, first contributor shilohlee98) implements the consumer group description interface defined in Kafka's next-generation consumer rebalancing protocol, KIP-848:

  • Adds the v0 / v1 request and response encoding/decoding for API key 69;
  • Adds the Broker.ConsumerGroupDescribe method, along with version negotiation, mocks, and unit tests;
  • Supports Kafka 3.7+ and v1 members in Kafka 4.0+.

This functionality addresses the needs described in issue #3747. For users who need to directly observe consumer membership, status, and assignments on the client side, this is a more aligned approach than relying on fields from the older DescribeGroups API.

3. Stability Fixes

Several stability issues have been fixed on both the consumer and producer sides:

  • Broker Deregistration Boundary: fix(client): only deregister the broker registered under that ID (#3752) – When deregistering by ID, it no longer mistakenly removes other broker registrations, preventing connection leaks and metadata inconsistencies.
  • RoundRobin Infinite Loop: fix(consumer): stop roundrobin balancer looping on an unsubscribed topic (#3740) – When the subscription relationship changes, the roundrobin partitioner no longer enters an infinite loop.
  • Producer Response Handling: fix(producer): drain pending responses immediately once channel closes (#3729) – Pending responses are drained immediately when the channel is closed, preventing the closing process from hanging.
  • Async Producer Race Condition: fix: prevent race in asyncProducer retryHandler (#3733) – Eliminates a data race in the retry handler, which is a significant improvement even when enabled with -race.
  • More Explicit Protocol Errors: fix(protocol): return ErrUnsupportedVersion for absent broker API keys (#3741) – When a broker does not expose the corresponding API key, it explicitly returns ErrUnsupportedVersion instead of throwing vague errors.

4. Dependencies and Code Quality

  • Dependency updates: klauspost/compress 1.19.2 → 1.20.0, pierrec/lz4/v4 4.1.29 → 4.1.30, golangci-lint v2.13.2, vearutop/teststat v0.1.29, and 3 updates from the

More News

Want to see more quality content?

Browse all news