RE: Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Masahiko Sawada' <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases
Date: 2023-05-09 04:51:05
Message-ID: TYAPR01MB5866DD8D8DED33F45688E1D5F5769@TYAPR01MB5866.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Sawada-san,

Thank you for giving the patch! I confirmed that the problem you raised could be
occurred on the HEAD, and the test you added could reproduce that. When the stats
entry has been removed but pg_stat_get_subscription_stats() is called, the returned
values are set as 0x0.
Additionally, I have checked other pgstat_drop_* functions, and I could not find
any similar problems.

A comment:

```
+ /*
+ * Tell the cumulative stats system that the subscription is getting
+ * dropped.
+ */
+ pgstat_drop_subscription(subid);
```

Isn't it better to write down something you said as comment? Or is it quite trivial?

> There is a chance the
> transaction dropping the subscription fails due to network error etc
> but we don't need to worry about it as reporting the subscription drop
> is transactional.

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-05-09 05:10:20 Re: WAL Insertion Lock Improvements
Previous Message Michael Paquier 2023-05-09 04:17:25 Re: WAL Insertion Lock Improvements