Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KafkaConsumer does not revoke deleted partitions when using a ConsumerRebalanceListener #120

Open
wbarnha opened this issue Mar 8, 2024 · 0 comments

Comments

@wbarnha
Copy link
Owner

wbarnha commented Mar 8, 2024

In my system, a KafkaConsumer uses a regex subscription to subscribe to topics in the form of <user_id>.<topic>. A ConsumberRebalanceListener is used to write topic offsets and the aggregated topic states into a local cache. Automated tests create and delete users (i.e. topics).

When new topics are created, everything works fine. The logs show that the subscription changed, currently subscribed partitions are revoked and the partitions of the created topics are added to the set of previously assigned TopicsPartitions.

When a topic is deleted (via a DeleteTopicsRequest), the log shows that the subscription changes ("Updatding subscribed topics to: …"). The subscription no longer contains the deleted topics, which is correct. Afterwards the currently assigned partitions are revoked in ConsumerCoordinator._on_join_prepare ("Revoking previously assigned partitions …"). However, the set of revoked partitions no longer contains the partitions of the deleted topic, because the subscription was already updated.

I would expect that deleted TopicPartitions are also passed to ConsumerRebalanceListener.on_partitions_revoked. Is my expectation wrong or is this a bug?

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

No branches or pull requests

1 participant