Re: Issue with pg_stat_subscription_stats - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Issue with pg_stat_subscription_stats
Date
Msg-id CAAKRu_aqA13caKQpNyEZXnGveX88+Mowk_n2oRj-Chtm-Pdavw@mail.gmail.com
Whole thread Raw
In response to Re: Issue with pg_stat_subscription_stats  (Andres Freund <andres@anarazel.de>)
Responses Re: Issue with pg_stat_subscription_stats
List pgsql-hackers
On Sat, Mar 12, 2022 at 3:15 PM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2022-03-12 08:28:35 +0530, Amit Kapila wrote:
> > On Sat, Mar 12, 2022 at 2:14 AM Melanie Plageman
> > <melanieplageman@gmail.com> wrote:
> > >
> > > So, I noticed that pg_stat_reset_subscription_stats() wasn't working
> > > properly, and, upon further investigation, I'm not sure the view
> > > pg_stat_subscription_stats is being properly populated.
> > >
> >
> > I have tried the below scenario based on this:
> > Step:1 Create some data that generates conflicts and lead to apply
> > failures and then check in the view:
>
> I think the problem is present when there was *no* conflict
> previously. Because nothing populates the stats entry without an error, the
> reset doesn't have anything to set the stats_reset field in, which then means
> that the stats_reset field is NULL even though stats have been reset.

Yes, this is what I meant. stats_reset is not initialized and without
any conflict happening to populate the stats, after resetting the stats,
the field still does not get populated. I think this is a bit
unexpected.

psql (15devel)
Type "help" for help.

mplageman=# select * from pg_stat_subscription_stats ;
 subid | subname | apply_error_count | sync_error_count | stats_reset
-------+---------+-------------------+------------------+-------------
 16398 | mysub   |                 0 |                0 |
(1 row)

mplageman=# select pg_stat_reset_subscription_stats(16398);
 pg_stat_reset_subscription_stats
----------------------------------

(1 row)

mplageman=# select * from pg_stat_subscription_stats ;
 subid | subname | apply_error_count | sync_error_count | stats_reset
-------+---------+-------------------+------------------+-------------
 16398 | mysub   |                 0 |                0 |
(1 row)

- Melanie



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Tab completion not listing schema list for create/alter publication for all tables in schema
Next
From: Tomas Vondra
Date:
Subject: Re: Column Filtering in Logical Replication