Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Deletion of PubSub topic with subscription

Hi,

As per Google Doc reference .  It looks like if we delete topic-1 with subscription topic-1-sub subscription will show error only for brief interval if we recreate the topic with same name.

 

When you delete a topic, its subscriptions are not deleted. The message backlog from the subscription is available for subscribers. After a topic is deleted, its subscriptions have the topic name _deleted-topic_. If you try to create a topic with the same name as the one you had just deleted, expect an error for a brief period.

 

But when I recreated the topic topic-1 with same name even after couple of hours it is still giving the same error.

ankitpradhan_0-1721127407046.png

So looks like documentation is not very clear what will happen in such scenario. Can you guys mention here more clearly or update the docs so that people get the true picture ?

Regards,
Ankit Pradhan



 
0 4 609
4 REPLIES 4

Hi @ankit-pradhan 

Welcome to Google Cloud Community!

Screenshot 2024-07-19 1.09.55 AM.png

Based on my understanding, the error shown under the subscription represents the _deleted-topic_. This error occurs only if you have deleted the associated topic to that specific subscription. Recreating the topic with the same name after deletion will not impact the subscription.

The document also emphasizes that once you delete the topic, it becomes permanent.

Screenshot 2024-07-19 1.23.16 AM.png

To ensure no errors occur, you should first delete the subscription under the deleted topic. Then, create a topic with the same name and configure your subscription accordingly.

Note: It is highly recommended not to recreate subscriptions and topics with the same name after deleting them, as this may cause delays.

I hope the above information is helpful.

Hi @caryna ,

Below reference to google docs talks about subscription deletion instead of topic deletion which we are discussing here.


@caryna wrote:

The document also emphasizes that once you delete the topic, it becomes permanent.



It will be very helpful if you can share some info on expect an error for a brief period as mentioned in below Google Doc reference. 

As mentioned by you in below comments I think it's little confusing with the Google doc reference where it says about brief period.


@caryna wrote:

Recreating the topic with the same name after deletion will not impact the subscription.



@ankit-pradhan wrote:

As per Google Doc reference .  It looks like if we delete topic-1 with subscription topic-1-sub subscription will show error only for brief interval if we recreate the topic with same name.


 

 

Hi @ankit-pradhan ,

I apologize for any confusion caused. I realize I provided the wrong link earlier. The Delete topics document emphasizes that once you delete the topic, it becomes permanent, as illustrated below:

Screenshot 2024-07-24 9.51.47 PM.png

The "expect an error for a brief period" implies that if you attempt to create a new topic with the same name right after deleting the old one, you will probably receive an error message as the cached information about the deleted topic might still exist.

Alternatively, you can submit a feature request to include additional details about "expect an error for a brief period" in the documentation. Please note that I cannot specify when this enhancement will be implemented. For future updates, I recommend monitoring the issue tracker.

I hope the above information is helpful. 

Hi @caryna ,

As mentioned below if you guys can update this document so that it clearly says that even if we create new topic with same name, subscriptions will never point to this new topic and will always remain orphaned.
Then all lot of confusion can be avoided.


@caryna wrote:

The "expect an error for a brief period" implies that if you attempt to create a new topic with the same name right after deleting the old one, you will probably receive an error message as the cached information about the deleted topic might still exist.