Re: Use WALReadFromBuffers in more places

2025-09-24 Thread Bharath Rupireddy
Hi, On Wed, Sep 24, 2025 at 11:27 AM Jeff Davis wrote: > > On Wed, 2025-09-24 at 07:26 -0700, Bharath Rupireddy wrote: > > Right. Reading unflushed WAL buffers for replication was one of the > > motivations. But, in general, WALReadFromBuffers has more benefits > > since it lets WAL buffers act a

Re: Use WALReadFromBuffers in more places

2025-09-24 Thread Jeff Davis
On Wed, 2025-09-24 at 07:26 -0700, Bharath Rupireddy wrote: > Right. Reading unflushed WAL buffers for replication was one of the > motivations. But, in general, WALReadFromBuffers has more benefits > since it lets WAL buffers act as a cache for reads, avoiding the need > to re-read WAL from disk f

Re: Use WALReadFromBuffers in more places

2025-09-24 Thread Bharath Rupireddy
Hi, On Mon, Sep 22, 2025 at 8:26 AM Jeff Davis wrote: > > 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 des

Re: Use WALReadFromBuffers in more places

2025-09-23 Thread Rahila Syed
Hi, On Mon, Sep 22, 2025 at 8:56 PM Jeff Davis wrote: > 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 desi

Re: Use WALReadFromBuffers in more places

2025-09-22 Thread Jeff Davis
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,

Re: Use WALReadFromBuffers in more places

2025-09-20 Thread Rahila Syed
Hi Bharath, Hi, > > Commit 91f2cae7a4e that introduced WALReadFromBuffers only used it for > physical walsenders. It can also be used in more places benefitting > logical walsenders, backends running pg_walinspect and logical > decoding functions if the WAL is available in WAL buffers. I'm > atta

Re: Use WALReadFromBuffers in more places

2025-09-20 Thread Jingtang Zhang
Hi~ > 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 fro

Re: Use WALReadFromBuffers in more places

2025-09-13 Thread Bharath Rupireddy
Hi, On Tue, Oct 15, 2024 at 1:22 AM Jingtang Zhang wrote: > > I've been back to this patch for a while recently. I witness that if a WAL > writer works fast, the already flushed WAL buffers will be zeroed out and > re-initialized for future use by AdvanceXLInsertBuffer in > XLogBackgroundFlush, s

Re: Use WALReadFromBuffers in more places

2024-10-15 Thread Jingtang Zhang
Hi all. I've been back to this patch for a while recently. I witness that if a WAL writer works fast, the already flushed WAL buffers will be zeroed out and re-initialized for future use by AdvanceXLInsertBuffer in XLogBackgroundFlush, so that WALReadFromBuffers will miss even though the space of

Re: Use WALReadFromBuffers in more places

2024-06-12 Thread Bharath Rupireddy
12 Jun 2024 14:46:16 +0000 Subject: [PATCH v2 1/2] Use WALReadFromBuffers in more places Commit 91f2cae introduced WALReadFromBuffers, and used it only for physical replication walsenders. There are couple of other callers that use read_local_xlog_page page_read callback and logical replication walsenders can a

Re: Use WALReadFromBuffers in more places

2024-06-08 Thread Nitin Jadhav
Hi Bharath, I spent some time examining the patch. Here are my observations from the review. - I believe there’s no need for an extra variable ‘nbytes’ in this context. We can repurpose the ‘count’ variable for the same function. If necessary, we might think about renaming ‘count’ to ‘nbytes’. -

Re: Use WALReadFromBuffers in more places

2024-05-12 Thread Bharath Rupireddy
On Wed, May 8, 2024 at 9:51 AM Jingtang Zhang wrote: > > Hi, Bharath. I've been testing this. It's cool. Is there any way we could > monitor the hit rate about directly reading from WAL buffers by exporting > to some views? Thanks for looking into this. I used purpose-built patches for verifying

Re: Use WALReadFromBuffers in more places

2024-05-07 Thread Jingtang Zhang
Hi, Bharath. I've been testing this. It's cool. Is there any way we could monitor the hit rate about directly reading from WAL buffers by exporting to some views? --- Regards, Jingtang

Use WALReadFromBuffers in more places

2024-04-24 Thread Bharath Rupireddy
Hi, Commit 91f2cae7a4e that introduced WALReadFromBuffers only used it for physical walsenders. It can also be used in more places benefitting logical walsenders, backends running pg_walinspect and logical decoding functions if the WAL is available in WAL buffers. I'm attaching a 0001 patch for th