Re: Improve WALRead() to suck data directly from WAL buffers when possible
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: Andres Freund <andres@anarazel.de>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Alvaro
Herrera <alvherre@alvh.no-ip.org>, 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: 2024-02-12T20:46:00Z
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
On Mon, 2024-02-12 at 12:18 -0800, Andres Freund wrote: > + upto = Min(startptr + count, LogwrtResult.Write); > + nbytes = upto - startptr; > > Shouldn't it pretty much be a bug to ever encounter this? In the current code it's impossible, though Bharath hinted at an extension which could reach that path. What I committed was a bit of a compromise -- earlier versions of the patch supported reading right up to the Insert pointer (which requires a call to WaitXLogInsertionsToFinish()). I wasn't ready to commit that code without seeing a more about how that would be used, but I thought it was reasonable to have some simple code in there to allow reading up to the Write pointer. It seems closer to the structure that we will ultimately need to replicate unflushed data, right? Regards, Jeff Davis [1] https://www.postgresql.org/message-id/CALj2ACW65mqn6Ukv57SqDTMzAJgd1N_AdQtDgy+gMDqu6v618Q@mail.gmail.com