From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Issue with pg_stat_subscription_stats |
Date: | 2022-07-05 21:52:45 |
Message-ID: | 20220705215245.dnj3ugvqvxfc4z4l@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2022-07-04 11:01:01 +0900, Masahiko Sawada wrote:
> I've attached the patch, fix_drop_subscriptions_stats.patch, to fix it.
LGTM. Unless somebody sees a reason not to, I'm planning to commit that to 15
and HEAD.
> I've also attached another PoC patch,
> poc_create_subscription_stats.patch, to create the stats entry when
> creating the subscription, which address the issue reported in this
> thread; the pg_stat_reset_subscription_stats() doesn't update the
> stats_reset if no error is reported yet.
It'd be good for this to include a test.
> diff --git a/src/backend/utils/activity/pgstat_subscription.c b/src/backend/utils/activity/pgstat_subscription.c
> index e1072bd5ba..ef318b7422 100644
> --- a/src/backend/utils/activity/pgstat_subscription.c
> +++ b/src/backend/utils/activity/pgstat_subscription.c
> @@ -47,8 +47,20 @@ pgstat_report_subscription_error(Oid subid, bool is_apply_error)
> void
> pgstat_create_subscription(Oid subid)
> {
> + PgStat_EntryRef *entry_ref;
> + PgStatShared_Subscription *shstatent;
> +
> pgstat_create_transactional(PGSTAT_KIND_SUBSCRIPTION,
> InvalidOid, subid);
> +
> + entry_ref = pgstat_get_entry_ref_locked(PGSTAT_KIND_SUBSCRIPTION,
> + InvalidOid, subid,
> + false);
> + shstatent = (PgStatShared_Subscription *) entry_ref->shared_stats;
> +
> + memset(&shstatent->stats, 0, sizeof(shstatent->stats));
> +
> + pgstat_unlock_entry(entry_ref);
> }
>
> /*
I think most of this could just be pgstat_reset_entry().
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Noah Misch | 2022-07-05 21:57:52 | Re: First draft of the PG 15 release notes |
Previous Message | Andrew Dunstan | 2022-07-05 21:25:43 | Re: [UNVERIFIED SENDER] Re: pg_upgrade can result in early wraparound on databases with high transaction load |