pgsql: pgstat: fix subscription stats entry leak.

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pgstat: fix subscription stats entry leak.
Date: 2023-07-05 05:54:15
Message-ID: E1qGvSx-001z1o-Pn@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pgstat: fix subscription stats entry leak.

Commit 7b64e4b3 taught DropSubscription() to drop stats entry of
subscription that is not associated with a replication slot for apply
worker at DROP SUBSCRIPTION but missed covering the case where the
subscription is not associated with replication slots for both apply
worker and tablesync worker.

Also add a test to verify that the stats for slot-less subscription is
removed at DROP SUBSCRIPTION time.

Backpatch down to 15.

Author: Masahiko Sawada
Reviewed-by: Nathan Bossart, Hayato Kuroda, Melih Mutlu, Amit Kapila
Discussion: https://postgr.es/m/CAD21AoB71zkP7uPT7JDPsZcvp0749ExEQnOJxeNKPDFisHar+w@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/66f8a139731957a7d516ade70cd3aa43d12d3c4f

Modified Files
--------------
src/backend/commands/subscriptioncmds.c | 12 ++++++------
src/test/subscription/t/026_stats.pl | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2023-07-05 05:54:29 pgsql: pgstat: fix subscription stats entry leak.
Previous Message Peter Eisentraut 2023-07-05 05:21:00 pgsql: Clean up command argument assembly