v60-0013-Fixed-the-error-that-occurred-when-parsing-an-XL.patch

text/x-patch

Filename: v60-0013-Fixed-the-error-that-occurred-when-parsing-an-XL.patch
Type: text/x-patch
Part: 12
Message: Re: Add 64-bit XIDs into PostgreSQL 15

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 v60-0013
Subject: Fixed the error that occurred when parsing an XLog record in the DecodeUpdate function. The error occurred when XLOG_HEAP_INIT_PAGE flag was set.
File+
src/backend/replication/logical/decode.c 1 1
From 4c88c52ea5d6e300163544f3be85a84067433e82 Mon Sep 17 00:00:00 2001
From: Evgeny Voropaev <evorop@gmail.com>
Date: Mon, 16 Dec 2024 18:13:41 +0800
Subject: [PATCH v60 13/15] Fixed the error that occurred when parsing an XLog
 record in the DecodeUpdate function. The error occurred when
 XLOG_HEAP_INIT_PAGE flag was set.

Author: Eduard Stepanov <eduard.stepanov@tantorlabs.com>
Author: Evgeny Voropaev <evgeny.voropaev@tantorlabs.com> <evorop@gmail.com>

TO-DO: add TAP-test revealing the problem
---
 src/backend/replication/logical/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 63d115a6eb8..e63063807ec 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -1002,7 +1002,7 @@ DecodeUpdate(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 		Size		tuplelen;
 
 		/* caution, remaining data in record is not aligned */
-		data = XLogRecGetData(r) + SizeOfHeapUpdate;
+		data = rec_data + SizeOfHeapUpdate;
 		datalen = XLogRecGetDataLen(r) - SizeOfHeapUpdate;
 		tuplelen = datalen - SizeOfHeapHeader;
 
-- 
2.48.1