From e49ef681d5e67cb0aa2c3fb22fe94311c7684e08 Mon Sep 17 00:00:00 2001
From: reshke <reshke@double.cloud>
Date: Mon, 6 Oct 2025 17:07:13 +0000
Subject: [PATCH v1 3/4] Remove block field from gistxlogPageReuse walrecord.

remove unused field, reduce wal footprint
---
 src/backend/access/gist/gistutil.c     | 2 +-
 src/backend/access/gist/gistxlog.c     | 4 +---
 src/backend/access/rmgrdesc/gistdesc.c | 4 ++--
 src/include/access/gist_private.h      | 2 +-
 src/include/access/gistxlog.h          | 1 -
 5 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index cdc4ab3151b..3c057879519 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -864,7 +864,7 @@ gistNewBuffer(Relation r, Relation heaprel)
 				 * page's deleteXid.
 				 */
 				if (XLogStandbyInfoActive() && RelationNeedsWAL(r))
-					gistXLogPageReuse(r, heaprel, blkno, GistPageGetDeleteXid(page));
+					gistXLogPageReuse(r, heaprel, GistPageGetDeleteXid(page));
 
 				return buffer;
 			}
diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c
index afbe4dbb274..51db4a0744e 100644
--- a/src/backend/access/gist/gistxlog.c
+++ b/src/backend/access/gist/gistxlog.c
@@ -588,8 +588,7 @@ gistXLogAssignLSN(void)
  * Write XLOG record about reuse of a deleted page.
  */
 void
-gistXLogPageReuse(Relation rel, Relation heaprel,
-				  BlockNumber blkno, FullTransactionId deleteXid)
+gistXLogPageReuse(Relation rel, Relation heaprel, FullTransactionId deleteXid)
 {
 	gistxlogPageReuse xlrec_reuse;
 
@@ -602,7 +601,6 @@ gistXLogPageReuse(Relation rel, Relation heaprel,
 	/* XLOG stuff */
 	xlrec_reuse.isCatalogRel = RelationIsAccessibleInLogicalDecoding(heaprel);
 	xlrec_reuse.locator = rel->rd_locator;
-	xlrec_reuse.block = blkno;
 	xlrec_reuse.snapshotConflictHorizon = deleteXid;
 
 	XLogBeginInsert();
diff --git a/src/backend/access/rmgrdesc/gistdesc.c b/src/backend/access/rmgrdesc/gistdesc.c
index 3e9eba01eb9..24332bb8b95 100644
--- a/src/backend/access/rmgrdesc/gistdesc.c
+++ b/src/backend/access/rmgrdesc/gistdesc.c
@@ -47,9 +47,9 @@ out_gistxlogPageUpdate(StringInfo buf, XLogReaderState *record, gistxlogPageUpda
 static void
 out_gistxlogPageReuse(StringInfo buf, gistxlogPageReuse *xlrec)
 {
-	appendStringInfo(buf, "rel %u/%u/%u; blk %u; snapshotConflictHorizon %u:%u, isCatalogRel %c",
+	appendStringInfo(buf, "rel %u/%u/%u; snapshotConflictHorizon %u:%u, isCatalogRel %c",
 					 xlrec->locator.spcOid, xlrec->locator.dbOid,
-					 xlrec->locator.relNumber, xlrec->block,
+					 xlrec->locator.relNumber,
 					 EpochFromFullTransactionId(xlrec->snapshotConflictHorizon),
 					 XidFromFullTransactionId(xlrec->snapshotConflictHorizon),
 					 xlrec->isCatalogRel ? 'T' : 'F');
diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h
index 39404ec7cdb..0a38d1ea4dc 100644
--- a/src/include/access/gist_private.h
+++ b/src/include/access/gist_private.h
@@ -440,7 +440,7 @@ extern XLogRecPtr gistXLogPageDelete(Buffer buffer,
 									 FullTransactionId xid, Buffer parentBuffer,
 									 OffsetNumber downlinkOffset);
 
-extern void gistXLogPageReuse(Relation rel, Relation heaprel, BlockNumber blkno,
+extern void gistXLogPageReuse(Relation rel, Relation heaprel,
 							  FullTransactionId deleteXid);
 
 extern XLogRecPtr gistXLogUpdate(Buffer buffer,
diff --git a/src/include/access/gistxlog.h b/src/include/access/gistxlog.h
index d551c0a19d4..717ac790b7c 100644
--- a/src/include/access/gistxlog.h
+++ b/src/include/access/gistxlog.h
@@ -99,7 +99,6 @@ typedef struct gistxlogPageDelete
 typedef struct gistxlogPageReuse
 {
 	RelFileLocator locator;
-	BlockNumber block;
 	FullTransactionId snapshotConflictHorizon;
 	bool		isCatalogRel;	/* to handle recovery conflict during logical
 								 * decoding on standby */
-- 
2.43.0

