v60-0015-Fixed-the-error-An-unsaved-xmax-at-a-freezing-du.patch

text/x-patch

Filename: v60-0015-Fixed-the-error-An-unsaved-xmax-at-a-freezing-du.patch
Type: text/x-patch
Part: 14
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-0015
Subject: Fixed the error "An unsaved xmax at a freezing during a replication."
File+
src/backend/access/heap/heapam_xlog.c 4 6
From eb46db7878169499968e090326fa58b744edbf81 Mon Sep 17 00:00:00 2001
From: Evgeny Voropaev <evorop@gmail.com>
Date: Thu, 30 Jan 2025 14:53:27 +0800
Subject: [PATCH v60 15/15] Fixed the error "An unsaved xmax at a freezing
 during a replication."

---
 src/backend/access/heap/heapam_xlog.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/backend/access/heap/heapam_xlog.c b/src/backend/access/heap/heapam_xlog.c
index 819f59dcf7c..e3b7da99915 100644
--- a/src/backend/access/heap/heapam_xlog.c
+++ b/src/backend/access/heap/heapam_xlog.c
@@ -129,15 +129,13 @@ heap_xlog_prune_freeze(XLogReaderState *record)
 			{
 				OffsetNumber offset = *(frz_offsets++);
 				ItemId		lp;
-				HeapTupleData tp;
+				HeapTupleHeader tuple;
 
 				lp = PageGetItemId(page, offset);
-				tp.t_data = (HeapTupleHeader) PageGetItem(page, lp);
-				tp.t_len = ItemIdGetLength(lp);
-				HeapTupleCopyXidsFromPage(buffer, &tp, page,
-											(xlrec.flags & XLHP_ON_TOAST_RELATION) != 0);
-				heap_execute_freeze_tuple(&tp, &frz);
+				tuple = (HeapTupleHeader) PageGetItem(page, lp);
+				heap_execute_freeze_tuple_page(page, tuple, &frz, (xlrec.flags & XLHP_ON_TOAST_RELATION) != 0);
 			}
+
 		}
 
 		/* There should be no more data */
-- 
2.48.1