-
Notifications
You must be signed in to change notification settings - Fork 74
Decide on pubsub topic and sub deletion strategy for Broker and Trigger #832
Comments
In my opinion, we should aim for the same behavior as pubsub. In this context the Broker is equivalent to the topic and the Trigger is equivalent to the pull subscription. Deleting a broker means no more ingress, but any accepted events are still delivered to existing triggers. If a trigger is deleted, no more events will be delivered to the subscriber, and any undelivered events will be dropped. In concrete terms this could be implemented like this:
Delete Trigger:
The data plane will need to expect that pubsub resources may be deleted at any time and handle that gracefully. |
@yolocs notes that when the broker is deleted, reply is no longer supported. |
Because support for reply is necessary for the Broker to remain conformant, it seems that the decoupling topic must remain available for publish as long as triggers are delivering events. But triggers aren't required to continue delivering events, since the conformance spec doesn't specify what happens to triggers when a broker is deleted. This seems like a gap in the spec. If we do want to support pubsub-like behavior for triggers, I can think of a couple strategies:
These are just initial thoughts; I may be completely wrong about all of this. 😁 |
We talked a bit more about this recently. Notes: One use case for triggers continuing to operate after a broker is deleted is drain: similar to graceful shutdown, we want to stop accepting new events and process any events that were already accepted. If we force-delete triggers when a broker is deleted, that could be a surprising experience for users who created the triggers. Brokers are intended to be mostly behind the scenes. If the broker/trigger has a dead letter queue, we could dead-letter replies instead of attempting to deliver them, but this would also be a surprising experience for users. We agreed that the broker should not accept new events while it is being deleted (allowing for eventual consistency, since this is Kubernetes). If we block broker deletion until all triggers are deleted AND wait for users to delete the triggers or for the triggers to become idle, then the broker might be blocked on deletion for a long time. Combining that with the above decision means that a broker blocked on deletion will also make that broker's address unable to receive events until all triggers are deleted. Is this acceptable to operators? Is there an operator use case for replacing an existing broker with a new one with the same name relatively quickly? |
Current strategy for R1 is to delete all pubsub resource on broker deletion. |
When a Broker or Trigger is deleted, we also need to clean up their pubsub resources. Deleting immediately may not be the best approach for the user, since they may lose messages that were already acknowledged by the Broker.
This issue is about deciding what the deletion strategy is. We can create a new issue for implementation.
Pubsub deletion scenarios
In pubsub, the deletion scenarios work like this:
Delete a topic, sub still exists: sub continues delivering events until deleted, references
_deleted-topic_
.Create sub with name of previously deleted topic: ? Haven't tried this yet, but probably fails
Create a topic with same name as deleted topic: A new topic is created. Any subs to the deleted topic continue delivering events from the deleted topic. Internally the sub is still attached to the deleted topic.
Create sub with name of recreated topic: sub attaches to new topic, not deleted topic.
Set sub expiration policy: Set a ttl (1-31 days). The sub is automatically deleted by PubSub when there is no "activity" for ttl period.
The text was updated successfully, but these errors were encountered: