wvanbergen / kafka

Load-balancing, resuming Kafka consumer for go, backed by Zookeeper.
MIT License
373 stars 141 forks source link

Complementary fix of partition rebalnce issue(#62) #93

Closed caihua-yin closed 8 years ago

caihua-yin commented 8 years ago

This is complementary fix for https://github.com/wvanbergen/kafka/pull/68 (issue: https://github.com/wvanbergen/kafka/issues/62), before the re-implementation (https://github.com/wvanbergen/kafka/pull/72) is ready.

In my use case, the message consuming logic is sometimes time consuming, even with 3 times retry as the fix in pull#68, it's still easy to have the issue#62. Furhter checking current logic in consumer_group.go:partitionConsumer(), it may take as many as cg.config.Offsets.ProcessingTimeout to ReleasePartition so that the partition can be claimed by new consumer during rebalance. So just simply set the max retry time same as cg.config.Offsets.ProcessingTimeout, which is 60s by default.

Verified this the system including this fix with frequent rebalance operations, the issue does not occur again.