RE: Subscription statistics are not dropped at DROP SUBSCRIPTION in some cases
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Masahiko Sawada' <sawada.mshk@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-05-09T04:51:05Z
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
Commits
-
Stabilize subscription stats test.
- 28ed5ecbe071 17.0 landed
- 1b95c8d85fa6 16.0 landed
- 461a7fad7c67 15.5 landed
-
pgstat: fix subscription stats entry leak.
- be8cae7e2f03 16.0 landed
- 66f8a1397319 15.4 landed
- 68a59f9e9983 17.0 landed
-
Create subscription stats entry at CREATE SUBSCRIPTION time
- e0b014295906 16.0 cited
-
pgstat: drop subscription stats without slot as well, fix comment
- 7b64e4b3fa04 16.0 cited