From 101b8469dff3f35c9c3bcd24f1bcfff740f3a622 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Fri, 17 Jan 2025 13:56:40 +0900
Subject: [PATCH] Remove XLogRecGetFullXid()

---
 src/include/access/xlogreader.h         |  8 ------
 src/include/storage/standby.h           |  1 +
 src/backend/access/transam/xlogreader.c | 34 -------------------------
 3 files changed, 1 insertion(+), 42 deletions(-)

diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h
index 9738462d3c..18a67acf42 100644
--- a/src/include/access/xlogreader.h
+++ b/src/include/access/xlogreader.h
@@ -34,10 +34,6 @@
 #ifndef XLOGREADER_H
 #define XLOGREADER_H
 
-#ifndef FRONTEND
-#include "access/transam.h"
-#endif
-
 #include "access/xlogrecord.h"
 #include "storage/buf.h"
 
@@ -427,10 +423,6 @@ extern bool DecodeXLogRecord(XLogReaderState *state,
 #define XLogRecHasBlockData(decoder, block_id)		\
 	((decoder)->record->blocks[block_id].has_data)
 
-#ifndef FRONTEND
-extern FullTransactionId XLogRecGetFullXid(XLogReaderState *record);
-#endif
-
 extern bool RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page);
 extern char *XLogRecGetBlockData(XLogReaderState *record, uint8 block_id, Size *len);
 extern void XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id,
diff --git a/src/include/storage/standby.h b/src/include/storage/standby.h
index 24e2f5082b..995d3c365d 100644
--- a/src/include/storage/standby.h
+++ b/src/include/storage/standby.h
@@ -14,6 +14,7 @@
 #ifndef STANDBY_H
 #define STANDBY_H
 
+#include "access/transam.h"
 #include "datatype/timestamp.h"
 #include "storage/lock.h"
 #include "storage/procsignal.h"
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 3596af0617..12d5175dc3 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -2157,37 +2157,3 @@ RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
 
 	return true;
 }
-
-#ifndef FRONTEND
-
-/*
- * Extract the FullTransactionId from a WAL record.
- */
-FullTransactionId
-XLogRecGetFullXid(XLogReaderState *record)
-{
-	TransactionId xid,
-				next_xid;
-	uint32		epoch;
-
-	/*
-	 * This function is only safe during replay, because it depends on the
-	 * replay state.  See AdvanceNextFullTransactionIdPastXid() for more.
-	 */
-	Assert(AmStartupProcess() || !IsUnderPostmaster);
-
-	xid = XLogRecGetXid(record);
-	next_xid = XidFromFullTransactionId(TransamVariables->nextXid);
-	epoch = EpochFromFullTransactionId(TransamVariables->nextXid);
-
-	/*
-	 * If xid is numerically greater than next_xid, it has to be from the last
-	 * epoch.
-	 */
-	if (unlikely(xid > next_xid))
-		--epoch;
-
-	return FullTransactionIdFromEpochAndXid(epoch, xid);
-}
-
-#endif
-- 
2.47.1

