v3-0001-Keep-the-return-value-of-XLogInsertRecord-for-XLO.patch

application/octet-stream

Filename: v3-0001-Keep-the-return-value-of-XLogInsertRecord-for-XLO.patch
Type: application/octet-stream
Part: 1
Message: Re: Return value of XLogInsertRecord() for XLOG_SWITCH record

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 v3-0001
Subject: Keep the return value of XLogInsertRecord() for XLOG_SWITCH record consistent with other records patch v3
File+
src/backend/access/transam/xlog.c 1 2
From 217f186fd816c741cb4f93b19ec0e8d2f971d6f2 Mon Sep 17 00:00:00 2001
From: "ZizhuanLiu(X-MAN)" <44973863@qq.com>
Date: Mon, 15 Jun 2026 08:14:42 +0800
Subject: [PATCH v3] Keep the return value of XLogInsertRecord() for
 XLOG_SWITCH record consistent with other records patch v3

---
 src/backend/access/transam/xlog.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 8617f53..d01161d 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -1034,8 +1034,7 @@ XLogInsertRecord(XLogRecData *rdata,
 			 * a part on the next page, we need to consider the page header. This
 			 * is consistent with XLogBytePosToEndRecPtr().
 			 */
-			if (StartPos / XLOG_BLCKSZ != EndPos / XLOG_BLCKSZ &&
-				EndPos % XLOG_BLCKSZ != 0)
+			if (StartPos / XLOG_BLCKSZ != (EndPos - 1) / XLOG_BLCKSZ)
 			{
 				uint64		offset = XLogSegmentOffset(EndPos, wal_segment_size);
 
-- 
2.43.0