Skip to content

scope cancellation watermarks per consumer#24

Merged
lesnik512 merged 1 commit intomainfrom
per-consumer-cancellation-watermarks
May 4, 2026
Merged

scope cancellation watermarks per consumer#24
lesnik512 merged 1 commit intomainfrom
per-consumer-cancellation-watermarks

Conversation

@lesnik512
Copy link
Copy Markdown
Member

The watermark dict was keyed by TopicPartition only. When a single KafkaConcurrentHandler is shared across subscribers in different consumer groups subscribing to the same topic, a cancelled task on one group blocks commits on the other for the same partition.

Re-key _cancellation_watermarks as dict[(id(consumer), TopicPartition)] and track a _partition_owner: dict[TopicPartition, int] inside the streaming loop so clear_cancellation_watermarks(partitions) can resolve which consumer's entry to drop on rebalance — listener API stays the same. Adds a focused regression test that fails under the old keying.

The watermark dict was keyed by TopicPartition only. When a single
KafkaConcurrentHandler is shared across subscribers in different
consumer groups subscribing to the same topic, a cancelled task on
one group blocks commits on the other for the same partition.

Re-key _cancellation_watermarks as dict[(id(consumer), TopicPartition)]
and track a _partition_owner: dict[TopicPartition, int] inside the
streaming loop so clear_cancellation_watermarks(partitions) can resolve
which consumer's entry to drop on rebalance — listener API stays the
same. Adds a focused regression test that fails under the old keying.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lesnik512 lesnik512 self-assigned this May 4, 2026
@lesnik512 lesnik512 merged commit 691adcd into main May 4, 2026
@lesnik512 lesnik512 deleted the per-consumer-cancellation-watermarks branch May 4, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant