v1-0001-Keep-the-return-value-of-XLogInsertRecord-for-XLO.patch
application/octet-stream
Filename: v1-0001-Keep-the-return-value-of-XLogInsertRecord-for-XLO.patch
Type: application/octet-stream
Part: 0
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 v1-0001
Subject: Keep the return value of XLogInsertRecord() for XLOG_SWITCH record consistent with other records
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 2 | 12 |
From c4b5fce12a754b81b5860b6d8e3bfb455724d077 Mon Sep 17 00:00:00 2001
From: ChangAo Chen <cca5507@qq.com>
Date: Mon, 13 Apr 2026 16:24:51 +0800
Subject: [PATCH v1] Keep the return value of XLogInsertRecord() for
XLOG_SWITCH record consistent with other records
---
src/backend/access/transam/xlog.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index f85b5286086..4085d35d85a 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -1026,18 +1026,8 @@ XLogInsertRecord(XLogRecData *rdata,
* xlog-switch record.
*/
if (inserted)
- {
- EndPos = StartPos + SizeOfXLogRecord;
- if (StartPos / XLOG_BLCKSZ != EndPos / XLOG_BLCKSZ)
- {
- uint64 offset = XLogSegmentOffset(EndPos, wal_segment_size);
-
- if (offset == EndPos % XLOG_BLCKSZ)
- EndPos += SizeOfXLogLongPHD;
- else
- EndPos += SizeOfXLogShortPHD;
- }
- }
+ EndPos = XLogBytePosToEndRecPtr(XLogRecPtrToBytePos(StartPos) +
+ MAXALIGN(SizeOfXLogRecord));
}
#ifdef WAL_DEBUG
--
2.34.1