Re: Improve WALRead() to suck data directly from WAL buffers when possible
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>, Dilip Kumar <dilipbalaut@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@lists.postgresql.org, Nathan Bossart <nathandbossart@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>
Date: 2023-11-03T23:58:18Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add XLogCtl->logInsertResult
- f3ff7bf83bce 17.0 cited
-
Add assert to WALReadFromBuffers().
- 9ecbf54075a9 17.0 landed
-
Read WAL directly from WAL buffers.
- 91f2cae7a4e6 17.0 landed
-
Additional write barrier in AdvanceXLInsertBuffer().
- 766571be1659 17.0 landed
-
Use 64-bit atomics for xlblocks array elements.
- c3a8e2a7cb16 17.0 landed
-
Don't trust unvalidated xl_tot_len.
- bae868caf222 17.0 cited
Hi, On 2023-11-03 20:23:30 +0530, Bharath Rupireddy wrote: > On Fri, Nov 3, 2023 at 12:35 PM Jeff Davis <pgsql@j-davis.com> wrote: > > > > On Thu, 2023-11-02 at 22:38 +0530, Bharath Rupireddy wrote: > > > > I suppose the question is: should reading from the WAL buffers an > > > > intentional thing that the caller does explicitly by specific > > > > callers? > > > > Or is it an optimization that should be hidden from the caller? > > > > > > > > I tend toward the former, at least for now. > > > > > > Yes, it's an optimization that must be hidden from the caller. > > > > As I said, I tend toward the opposite: that specific callers should > > read from the buffers explicitly in the cases where it makes sense. > > How about adding a bool flag (read_from_wal_buffers) to > XLogReaderState so that the callers can set it if they want this > facility via XLogReaderAllocate()? That seems wrong architecturally - why should xlogreader itself know about any of this? What would it mean in frontend code if read_from_wal_buffers were set? IMO this is something that should happen purely within the read function. Greetings, Andres Freund