Skip to content

Commit 7b64e4b

Browse files
committed
pgstat: drop subscription stats without slot as well, fix comment
There's no reason anymore to only drop subscription stats if associated with a slot, now that stats drops are transactional. And since there's now no other cleanup of stats, this would lead to stats for slot-less subscriptions to get leaked (however most slot-less subs won't have stats). Additionally, the comment referring to autovacuum cleaning up stats was clearly outdated. Author: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/CAD21AoAwiby3HeJE7vJe16Gr75RFfJ640dyHqvsiUhyKJTXPtw@mail.gmail.com Backpatch: 15-
1 parent b0a55e4 commit 7b64e4b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/backend/commands/subscriptioncmds.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,15 +1578,9 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
15781578

15791579
/*
15801580
* Tell the cumulative stats system that the subscription is getting
1581-
* dropped. We can safely report dropping the subscription statistics here
1582-
* if the subscription is associated with a replication slot since we
1583-
* cannot run DROP SUBSCRIPTION inside a transaction block. Subscription
1584-
* statistics will be removed later by (auto)vacuum either if it's not
1585-
* associated with a replication slot or if the message for dropping the
1586-
* subscription gets lost.
1581+
* dropped.
15871582
*/
1588-
if (slotname)
1589-
pgstat_drop_subscription(subid);
1583+
pgstat_drop_subscription(subid);
15901584

15911585
table_close(rel, NoLock);
15921586
}

0 commit comments

Comments
 (0)