Re: Use WALReadFromBuffers in more places - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Use WALReadFromBuffers in more places
Date
Msg-id fa2e932eeff472250e2dbacb49d8c43ad282fea9.camel@j-davis.com
Whole thread Raw
In response to Re: Use WALReadFromBuffers in more places  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Sat, 2025-09-13 at 22:04 -0700, Bharath Rupireddy wrote:
> Thanks for looking at this. Yes, the WAL writers can zero out flushed
> buffers before WALReadFromBuffers gets to them. However,
> WALReadFromBuffers was intentionally designed as an opportunistic
> optimization - it's a "try this first, quickly" approach before
> falling back to reading from WAL files.

IIRC, one motivation (perhaps the primary motivation?) was to make it
possible to read buffers before they are flushed. It was always
possible to read already-flushed buffers.

The benefit of reading unflushed buffers is that we can replicate the
WAL sooner (though it can't be replayed until the primary flushes it).
Is that right?

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: waiteventset.c XXX
Next
From: Álvaro Herrera
Date:
Subject: Re: Having postgresql.org link to cgit instead of gitweb