Re: Don't keep closed WAL segment in page cache after replay - Mailing list pgsql-hackers

From Anthonin Bonnefoy
Subject Re: Don't keep closed WAL segment in page cache after replay
Date
Msg-id CAO6_Xqric0=7TVC-dLySU6_mtG3ie8kJY=87EjDeYjqGc3uNNA@mail.gmail.com
Whole thread
In response to Re: Don't keep closed WAL segment in page cache after replay  (Kirill Reshke <reshkekirill@gmail.com>)
Responses Re: Don't keep closed WAL segment in page cache after replay
List pgsql-hackers
Thanks for the review!

On Tue, Feb 17, 2026 at 9:38 AM Kirill Reshke <reshkekirill@gmail.com> wrote:
> This does not immediately strike me as good reasoning. We have, for
> example, pg_stat_get_wal_senders (or WalSndInitStopping from
> walsenders.h) function which accesses exactly WalSndCtl->walsnds.
> Why don't we simply have another utility function that will return the
> number of active walsenders?

That's true it is an option. I've switched to this approach and
created a WalSndRunning. We only need to know if there's at least one
wal sender running, no need to have a precise number.

I've also added StandbyMode as a condition to restrict this to
replicas. XLogPageRead may be used by the primary when starting up,
and will likely re-read the WAL so releasing cached pages should be
avoided on the primary.

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Use LOCKMODE in parse_relation.c/.h
Next
From: Nicolas Adenis-Lamarre
Date:
Subject: Re: Convert coalesce to or/and