On Fri, Sep 10, 2021 at 7:21 AM Michael Paquier <mich...@paquier.xyz> wrote: > > On Thu, Sep 09, 2021 at 10:49:46PM +0000, Bossart, Nathan wrote: > > +1 > > A backend approach has the advantage that you can use the proper locks > to make sure that a segment is not recycled or removed by a concurrent > checkpoint, so that would be reliable.
Thanks for sharing your thoughts. IMO, using locks for showing WAL stats isn't a good way, because these new functions may block the checkpointer from removing/recycling the WAL files. We don't want to do that. If at all, user has asked stats of an LSN/range of LSNs if it is/they are available in the pg_wal directory, we provide the info otherwise we can throw warnings/errors. This behaviour is pretty much in sycn with what pg_waldump does right now. And, some users may not need these new functions at all, so in such cases going with an extension way makes it more usable. Regards, Bharath Rupireddy.