pgstat: drop subscription stats regardless of slot, fix comment
authorAndres Freund
Wed, 6 Jul 2022 15:46:04 +0000 (08:46 -0700)
committerAndres Freund
Wed, 6 Jul 2022 15:49:33 +0000 (08:49 -0700)
There's no reason anymore to only drop subscription stats if associated with a
slot, now that stats drops are transactional. Additionally, the comment
referring to autovacuum cleaning up stats was clearly outdated.

Author: Masahiko Sawada 
Discussion: https://postgr.es/m/CAD21AoAwiby3HeJE7vJe16Gr75RFfJ640dyHqvsiUhyKJTXPtw@mail.gmail.com
Backpatch: 15-

src/backend/commands/subscriptioncmds.c

index 83e6eae855f9891026cc12979e87ee426a1f933b..3842a4fd445be7e225809e567636ceaedfe25d6b 100644 (file)
@@ -1579,15 +1579,9 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
 
    /*
     * Tell the cumulative stats system that the subscription is getting
-    * dropped. We can safely report dropping the subscription statistics here
-    * if the subscription is associated with a replication slot since we
-    * cannot run DROP SUBSCRIPTION inside a transaction block.  Subscription
-    * statistics will be removed later by (auto)vacuum either if it's not
-    * associated with a replication slot or if the message for dropping the
-    * subscription gets lost.
+    * dropped.
     */
-   if (slotname)
-       pgstat_drop_subscription(subid);
+   pgstat_drop_subscription(subid);
 
    table_close(rel, NoLock);
 }