-
Notifications
You must be signed in to change notification settings - Fork 5
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
Purge topics using Kafkactl #121
Comments
@nil-malh https://github.com/michelin/kafkactl?tab=readme-ov-file#delete-records ? 😄 Maybe the |
I was already aware of this however, it's only reserved for topics that are a cleanup-policy set to
We could add this, but this still limits the scope for topics with a This is why I suggested another command like |
Records deletion has been deactivated on purpose for compacted topics. The Admin Client is throwing The records deletion for compacted topics should take place in the The only option that comes to mind is actually deleting the topic on the broker (if it's a compacted one), and let the Ns4Kafka sync recreates it (Ns4Kafka stores every resource actually). But we need to warn the user that connected Kafka clients are going to be disrupted waiting for the topic being recreated. I'm thinking about 2 options:
|
Fair enough, the goal of creating a new command was to avoid to have two different logics behind the delete-records but this makes sense, as well !
I was thinking almost the same. Currently when I want to delete a topic that's not a kafkactl get topic <topicName> -o yaml # I am storing the output in a variable
kafactl delete topic <topicName>
kafkactl apply -o <topic.yaml> I was actually unaware that NS4Kafka was storing resources thanks ! 😄 But this approach does not use the NS4Kafka ability as you've mentioned ! Will it be faster than waiting for NS4Kafka to spot that a resources is missing and then recreate it ?
I was thinking about it as well this is the best bet IMO to avoid unexpected deletions of records 😄 Let me know what you think and what should we do moving forward I am keen to any suggestions that you might want to see |
You do use it. That's done under the hood.
So deleting the compact topic from the cluster and let the next synchronization recreates it sticks to the overall Ns4Kafka design, and is the same thing that running
Topic deletion should just be declined as long as any consumer group is active for that topic. As done for reset-offsets. If no more consumer group is active, then the warning and the |
Problem
There's no simple way to purge a topic that's by using
kafkactl
orkafka-admin
. The goal is to be able to easily purge a topic from all the records it contains !Suggestion
The user should be able to do :
Alternatives Considered
There's two way that could be used to purge a topic from its content one being easier to execute that the other
Store in memory the topic.yaml, delete the topic, re-apply the topic.yaml in memory (this avoids a lot of overhead with the other method)
Set the topic retention.ms temporarily to a low value like 10ms to delete all records that are older than the retention.ms value, but this implies that the user needs to reset the offsets of all the consumer groups subscribed to the topics that will purged
While the second way requires a bit more of setting up, it could offer more than purging a whole topic we could imagine that this could be used to purge only old message from a topic while keeping the more recent records unscathed !
What are your thoughts on this ? I'll contribute if the issue is deems useful :)
The text was updated successfully, but these errors were encountered: