v2-0002-Fix-XLOG-buffers-auto-tune-for-different-XLOG_BLC.patch

application/octet-stream

Filename: v2-0002-Fix-XLOG-buffers-auto-tune-for-different-XLOG_BLC.patch
Type: application/octet-stream
Part: 1
Message: Re: Lowering the default wal_blocksize to 4K

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v2-0002
Subject: Fix XLOG buffers auto-tune for different XLOG_BLCKSZ
File+
src/backend/access/transam/xlog.c 1 1
From 72a70460d6966f9895ea874514c77a9405859057 Mon Sep 17 00:00:00 2001
From: Andrew Pogrebnoi <absourd.noise@gmail.com>
Date: Tue, 17 Feb 2026 21:12:21 +0200
Subject: [PATCH v2 2/2] Fix XLOG buffers auto-tune for different XLOG_BLCKSZ

Before this change, XLOG buffers calculation in relation to
shared_buffers made sense only if XLOG_BLCKSZ the same as BLCKSZ
---
 src/backend/access/transam/xlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 13ec6225b85..d37e85a4077 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4694,7 +4694,7 @@ XLOGChooseNumBuffers(void)
 {
 	int			xbuffers;
 
-	xbuffers = NBuffers / 32;
+	xbuffers = ((NBuffers * BLCKSZ) / XLOG_BLCKSZ) / 32;
 	if (xbuffers > (wal_segment_size / XLOG_BLCKSZ))
 		xbuffers = (wal_segment_size / XLOG_BLCKSZ);
 	if (xbuffers < 8)
-- 
2.43.0