v8-0003-Don-t-clear-the-WAL-buffers-in-XLogBackgroundFlush.patch

application/octet-stream

Filename: v8-0003-Don-t-clear-the-WAL-buffers-in-XLogBackgroundFlush.patch
Type: application/octet-stream
Part: 0
Message: Re: Improve WALRead() to suck data directly from WAL buffers when possible
From c9fba2b1525282770825b4082104486b2f475158 Mon Sep 17 00:00:00 2001
From: Nitin Jadhav <nitinjadhav@microsoft.com>
Date: Sat, 11 Mar 2023 23:42:44 +0530
Subject: [PATCH 3/4] Don't clear the WAL buffers in XLogBackgroundFlush()

The no-longer-needed WAL data present in WAL buffers gets
cleared in XLogBackgroundFlush() which is called based
wal_writer_delay config value. As we are trying to read
as much as data from WAL buffer instead of fetching it from
disk, the no-longer-needed WAL data is in need now. Hence
trying to keep the WAL data in WAL buffers as long as
possible so that all the readers take the advantage of it.
---
 src/backend/access/transam/xlog.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9dd97a66d3..6b0974b750 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -2964,12 +2964,6 @@ XLogBackgroundFlush(void)
 	/* wake up walsenders now that we've released heavily contended locks */
 	WalSndWakeupProcessRequests();
 
-	/*
-	 * Great, done. To take some work off the critical path, try to initialize
-	 * as many of the no-longer-needed WAL buffers for future use as we can.
-	 */
-	AdvanceXLInsertBuffer(InvalidXLogRecPtr, insertTLI, true);
-
 	/*
 	 * If we determined that we need to write data, but somebody else
 	 * wrote/flushed already, it should be considered as being active, to
-- 
2.34.1