zio / zio-kafka

A Kafka client for ZIO and ZIO Streams
https://zio.dev/zio-kafka
Apache License 2.0
337 stars 138 forks source link

Track latest completed commit offset per partition #1097

Closed erikvanoosten closed 11 months ago

erikvanoosten commented 11 months ago

By tracking these offsets we can skip awaiting already completed commits from the rebalance listener in #1098.

To prevent unbounded memory usage, after a rebalance we remove the committed offset for partitions that are no longer assigned to this consumer.

Note that a commit might complete just after a partition was revoked. This is not a big issue; the offset will still be removed in the next rebalance. When the rebalanceSafeCommits feature is available (see #1098) commits will complete in the rebalance listener and this cannot happen anymore.