Skip to content

Commit 41f0269

Browse files
authored
Merge pull request #673 from twmb/patch
v1.16.1 patches
2 parents a2d69ce + 20867cd commit 41f0269

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
v1.16.1
2+
===
3+
4+
This patch release fixes one bug and un-deprecates SaramaHasher.
5+
6+
SaramaHasher, while not identical to Sarama's partitioner, actually _is_
7+
identical to some other partitioners in the Kafka client ecosystem. So, the old
8+
function is now un-deprecated, but the documentation correctly points you to
9+
SaramaCompatHasher and mentions why you may still want to use SaramaHasher.
10+
11+
For the bug: if you tried using CommitOffsetsSync during a group rebalance, and
12+
you canceled your context while the group was still rebalancing, then
13+
CommitOffsetsSync would enter a deadlock and never return. That has been fixed.
14+
15+
- [`cd65d77`](https://github.com/twmb/franz-go/commit/cd65d77) kgo: fix bug
16+
- [`d40ac19`](https://github.com/twmb/franz-go/commit/d40ac19) kgo: un-deprecate SaramaHasher and add docs explaining why
17+
118
v1.16.0
219
===
320

Diff for: pkg/kgo/consumer_group.go

+1
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,7 @@ func (g *groupConsumer) commitOffsetsSync(
25842584

25852585
if err := g.waitJoinSyncMu(ctx); err != nil {
25862586
onDone(g.cl, kmsg.NewPtrOffsetCommitRequest(), kmsg.NewPtrOffsetCommitResponse(), err)
2587+
close(done)
25872588
return
25882589
}
25892590
unblockCommits := func(cl *Client, req *kmsg.OffsetCommitRequest, resp *kmsg.OffsetCommitResponse, err error) {

Diff for: pkg/kgo/partitioner.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,16 @@ func KafkaHasher(hashFn func([]byte) uint32) PartitionerHasher {
487487
}
488488
}
489489

490-
// Deprecated: SaramaHasher is not compatible with Sarama's default partitioner
491-
// and only remains to avoid re-keying records for existing users of this API. See
492-
// [SaramaCompatHasher] for a correct partitioner.
490+
// SaramaHasher is a historical misnamed partitioner. This library's original
491+
// implementation of the SaramaHasher was incorrect, if you want an exact
492+
// match for the Sarama partitioner, use the [SaramaCompatHasher].
493+
//
494+
// This partitioner remains because as it turns out, other ecosystems provide
495+
// a similar partitioner and this partitioner is useful for compatibility.
496+
//
497+
// In particular, using this function with a crc32.ChecksumIEEE hasher makes
498+
// this partitioner match librdkafka's consistent partitioner, or the
499+
// zendesk/ruby-kafka partitioner.
493500
func SaramaHasher(hashFn func([]byte) uint32) PartitionerHasher {
494501
return func(key []byte, n int) int {
495502
p := int(hashFn(key)) % n

0 commit comments

Comments
 (0)