Re: Replication slot stats misgivings
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Date: 2021-05-03T13:20:54Z
Lists: pgsql-hackers
On Mon, May 3, 2021 at 5:48 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > On Mon, May 3, 2021 at 2:27 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > On Thu, Apr 29, 2021 at 10:37 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > On Wed, Apr 28, 2021 at 7:43 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > > > > > On Wed, Apr 28, 2021 at 3:25 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > > > > > > > > > I am not sure if any of these alternatives are a good idea. What do > > > > > you think? Do you have any other ideas for this? > > > > > > > > I've been considering some ideas but don't come up with a good one > > > > yet. It’s just an idea and not tested but how about having > > > > CreateDecodingContext() register before_shmem_exit() callback with the > > > > decoding context to ensure that we send slot stats even on > > > > interruption. And FreeDecodingContext() cancels the callback. > > > > > > > > > > Is it a good idea to send stats while exiting and rely on the same? I > > > think before_shmem_exit is mostly used for the cleanup purpose so not > > > sure if we can rely on it for this purpose. I think we can't be sure > > > that in all cases we will send all stats, so maybe Vignesh's patch is > > > sufficient to cover the cases where we avoid losing it in cases where > > > we would have sent a large amount of data. > > > > > > > Sawada-San, any thoughts on this point? > > before_shmem_exit is mostly used to the cleanup purpose but how about > on_shmem_exit()? pgstats relies on that to send stats at the > interruption. See pgstat_shutdown_hook(). > Yeah, that is worth trying. Would you like to give it a try? I think it still might not cover the cases where we error out in the backend while decoding via APIs because at that time we won't exit, maybe for that we can consider Vignesh's patch. -- With Regards, Amit Kapila.
Commits
-
Doc: Update logical decoding stats information.
- 0c6b92d9c6fb 14.0 landed
-
Fix tests for replication slots stats.
- fc69509131c3 14.0 landed
-
Update replication statistics after every stream/spill.
- 592f00f8dec6 14.0 landed
-
Fix the computation of slot stats for 'total_bytes'.
- 205f466282be 14.0 landed
-
Another try to fix the test case added by commit f5fc2f5b23.
- 51ef9173030c 14.0 landed
-
Use HTAB for replication slot statistics.
- 3fa17d37716f 14.0 landed
-
Fix test case added by commit f5fc2f5b23.
- c64dcc7fee5f 14.0 landed
-
Add information of total data processed to replication slot stats.
- f5fc2f5b23d1 14.0 landed
-
Use NameData datatype for slotname in stats.
- cca57c1d9bf7 14.0 landed