On Fri, Oct 10, 2025 at 9:47 AM Michael Paquier <[email protected]> wrote:
>
> On Thu, Oct 09, 2025 at 03:15:11PM +0700, John Naylor wrote:
> > Leaving that up to the rmgr makes sense. One consideration I didn't
> > mention was for xlogstats.c -- "record_stats[rmid][recid]" would get
> > 16x larger if recid could take up the full byte. Maybe that's
> > harmless, but I didn't want to assume. Any thoughts on that?
>
> I've missed this interaction, thanks for mentioning it.  XLogStats is
> a local state that's only used by pg_walinspect and pg_waldump, so
> this extra memory consumed does worry me much; this stuff interacts
> with no critical paths.

Okay, v2 gets rid of the general info mask (split out into 0002 for
readability) and leaves alone the RMGR-specific masks (i.e. leaves out
v1 0002/3). It runs fine with installcheck while streaming to a
standby with wal_consistency_checking. I've also left out the removal
of HEAP2 for now. Giving existing RMGRs more breathing room seems like
a better motivator, going by Nathan's comment and yours.

It's worth thinking about backward compatibility if we did go as far
as a 2-byte xl_info (upthread: to allow more RMGR-specific flags, so
e.g. XACT wouldn't need xl_xact_info) In that case, we'd probably
still want a convention that only the lowest byte can contain the
record type. XLogStats could simply assume that in most cases. For
XACT 8 flags in the upper byte still won't be enough, and it will
still need to have its own opcode mask, but that's no worse than the
situation we have already.

--
John Naylor
Amazon Web Services
From b58209171b2f81470f6a1c4f0529767a72cda1d2 Mon Sep 17 00:00:00 2001
From: John Naylor <[email protected]>
Date: Wed, 1 Oct 2025 17:09:06 +0700
Subject: [PATCH v2 1/2] Split XLogRecord.xl_info into separate members

"xl_info" is for use by the RMGR only. Each RMGR now has the full
byte available and can decide how to specify record type and how to
store any optional flags. This should prevent RMGRs from ever again
needing to spill over into a separate RMGR ID. It is now possible to
get rid of HEAP2, but that is left for possible future work.

"xl_geninfo" is the home for XLR_SPECIAL_REL_UPDATE,
XLR_CHECK_CONSISTENCY, and anything reserved internally by
XLogInsertExtended.

XLogInsert is now a thin wrapper around XLogInsertExtended, The
latter only needs to be called when pasing xl_geninfo flags.

The idea has been proposed in the past by Andres Freund, Robert Haas,
and Matthias van de Meent. Credit to Matthias van de Meent for
XLogInsertExtended.

Bump XLOG_PAGE_MAGIC

Reviewed-by: Michael Paquier <[email protected]>
---
 contrib/pg_visibility/pg_visibility.c     |  4 +--
 contrib/pg_walinspect/pg_walinspect.c     |  5 ++--
 src/backend/access/transam/xact.c         | 10 ++++---
 src/backend/access/transam/xloginsert.c   | 34 +++++++++++++++--------
 src/backend/access/transam/xlogrecovery.c |  4 +--
 src/backend/access/transam/xlogstats.c    | 13 ++++-----
 src/backend/catalog/storage.c             |  6 ++--
 src/backend/commands/dbcommands.c         | 16 +++++------
 src/bin/pg_resetwal/pg_resetwal.c         |  1 +
 src/bin/pg_rewind/parsexlog.c             |  7 +++--
 src/bin/pg_waldump/pg_waldump.c           |  5 ++--
 src/include/access/xact.h                 |  2 +-
 src/include/access/xlog_internal.h        |  2 +-
 src/include/access/xloginsert.h           |  1 +
 src/include/access/xlogreader.h           |  1 +
 src/include/access/xlogrecord.h           | 17 ++++++------
 src/include/access/xlogstats.h            |  2 +-
 17 files changed, 71 insertions(+), 59 deletions(-)

diff --git a/contrib/pg_visibility/pg_visibility.c b/contrib/pg_visibility/pg_visibility.c
index d79ef35006b..3c5ff6be79e 100644
--- a/contrib/pg_visibility/pg_visibility.c
+++ b/contrib/pg_visibility/pg_visibility.c
@@ -429,8 +429,8 @@ pg_truncate_visibility_map(PG_FUNCTION_ARGS)
 		XLogBeginInsert();
 		XLogRegisterData(&xlrec, sizeof(xlrec));
 
-		lsn = XLogInsert(RM_SMGR_ID,
-						 XLOG_SMGR_TRUNCATE | XLR_SPECIAL_REL_UPDATE);
+		lsn = XLogInsertExtended(RM_SMGR_ID,
+								 XLOG_SMGR_TRUNCATE, XLR_SPECIAL_REL_UPDATE);
 		XLogFlush(lsn);
 	}
 
diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c
index 501cea8fc1a..21444bc5bc3 100644
--- a/contrib/pg_walinspect/pg_walinspect.c
+++ b/contrib/pg_walinspect/pg_walinspect.c
@@ -717,10 +717,9 @@ GetXLogSummaryStats(XLogStats *stats, ReturnSetInfo *rsinfo,
 
 				old_cxt = MemoryContextSwitchTo(tmp_cxt);
 
-				/* the upper four bits in xl_info are the rmgr's */
-				id = desc.rm_identify(rj << 4);
+				id = desc.rm_identify(rj);
 				if (id == NULL)
-					id = psprintf("UNKNOWN (%x)", rj << 4);
+					id = psprintf("UNKNOWN (%x)", rj);
 
 				FillXLogStatsRow(psprintf("%s/%s", desc.rm_name, id), count,
 								 total_count, rec_len, total_rec_len, fpi_len,
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 2cf3d4e92b7..fc06474fc75 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -5842,6 +5842,7 @@ XactLogCommitRecord(TimestampTz commit_time,
 	xl_xact_twophase xl_twophase;
 	xl_xact_origin xl_origin;
 	uint8		info;
+	uint8		geninfo = 0;
 
 	Assert(CritSectionCount > 0);
 
@@ -5892,7 +5893,7 @@ XactLogCommitRecord(TimestampTz commit_time,
 	{
 		xl_xinfo.xinfo |= XACT_XINFO_HAS_RELFILELOCATORS;
 		xl_relfilelocators.nrels = nrels;
-		info |= XLR_SPECIAL_REL_UPDATE;
+		geninfo |= XLR_SPECIAL_REL_UPDATE;
 	}
 
 	if (ndroppedstats > 0)
@@ -5985,7 +5986,7 @@ XactLogCommitRecord(TimestampTz commit_time,
 	/* we allow filtering by xacts */
 	XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN);
 
-	return XLogInsert(RM_XACT_ID, info);
+	return XLogInsertExtended(RM_XACT_ID, info, geninfo);
 }
 
 /*
@@ -6012,6 +6013,7 @@ XactLogAbortRecord(TimestampTz abort_time,
 	xl_xact_origin xl_origin;
 
 	uint8		info;
+	uint8		geninfo = 0;
 
 	Assert(CritSectionCount > 0);
 
@@ -6041,7 +6043,7 @@ XactLogAbortRecord(TimestampTz abort_time,
 	{
 		xl_xinfo.xinfo |= XACT_XINFO_HAS_RELFILELOCATORS;
 		xl_relfilelocators.nrels = nrels;
-		info |= XLR_SPECIAL_REL_UPDATE;
+		geninfo |= XLR_SPECIAL_REL_UPDATE;
 	}
 
 	if (ndroppedstats > 0)
@@ -6131,7 +6133,7 @@ XactLogAbortRecord(TimestampTz abort_time,
 	/* Include the replication origin */
 	XLogSetRecordFlags(XLOG_INCLUDE_ORIGIN);
 
-	return XLogInsert(RM_XACT_ID, info);
+	return XLogInsertExtended(RM_XACT_ID, info, geninfo);
 }
 
 /*
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c
index 496e0fa4ac6..89fdf45ebb6 100644
--- a/src/backend/access/transam/xloginsert.c
+++ b/src/backend/access/transam/xloginsert.c
@@ -134,7 +134,7 @@ static bool begininsert_called = false;
 /* Memory context to hold the registered buffer and data references. */
 static MemoryContext xloginsert_cxt;
 
-static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info,
+static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info, uint8 geninfo,
 									   XLogRecPtr RedoRecPtr, bool doPageWrites,
 									   XLogRecPtr *fpw_lsn, int *num_fpi,
 									   bool *topxid_included);
@@ -472,7 +472,7 @@ XLogSetRecordFlags(uint8 flags)
  * WAL rule "write the log before the data".)
  */
 XLogRecPtr
-XLogInsert(RmgrId rmid, uint8 info)
+XLogInsertExtended(RmgrId rmid, uint8 info, uint8 geninfo)
 {
 	XLogRecPtr	EndPos;
 
@@ -481,14 +481,14 @@ XLogInsert(RmgrId rmid, uint8 info)
 		elog(ERROR, "XLogBeginInsert was not called");
 
 	/*
-	 * The caller can set rmgr bits, XLR_SPECIAL_REL_UPDATE and
-	 * XLR_CHECK_CONSISTENCY; the rest are reserved for use by me.
+	 * The caller can set XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY;
+	 * the rest are reserved for use by me.
 	 */
-	if ((info & ~(XLR_RMGR_INFO_MASK |
-				  XLR_SPECIAL_REL_UPDATE |
-				  XLR_CHECK_CONSISTENCY)) != 0)
-		elog(PANIC, "invalid xlog info mask %02X", info);
+	if ((geninfo & ~(XLR_SPECIAL_REL_UPDATE |
+					 XLR_CHECK_CONSISTENCY)) != 0)
+		elog(PANIC, "invalid xlog geninfo mask %02X", geninfo);
 
+	/* WIP: need geninfo here? */
 	TRACE_POSTGRESQL_WAL_INSERT(rmid, info);
 
 	/*
@@ -518,7 +518,7 @@ XLogInsert(RmgrId rmid, uint8 info)
 		 */
 		GetFullPageWriteInfo(&RedoRecPtr, &doPageWrites);
 
-		rdt = XLogRecordAssemble(rmid, info, RedoRecPtr, doPageWrites,
+		rdt = XLogRecordAssemble(rmid, info, geninfo, RedoRecPtr, doPageWrites,
 								 &fpw_lsn, &num_fpi, &topxid_included);
 
 		EndPos = XLogInsertRecord(rdt, fpw_lsn, curinsert_flags, num_fpi,
@@ -530,6 +530,15 @@ XLogInsert(RmgrId rmid, uint8 info)
 	return EndPos;
 }
 
+/* Convenience wrapper for callers that don't pass "geninfo" */
+/*  WIP: should this be an inline function in xloginsert.h? */
+XLogRecPtr
+XLogInsert(RmgrId rmid, uint8 info)
+{
+	return XLogInsertExtended(rmid, info, 0);
+}
+
+
 /*
  * Simple wrapper to XLogInsert to insert a WAL record with elementary
  * contents (only an int64 is supported as value currently).
@@ -558,7 +567,7 @@ XLogSimpleInsertInt64(RmgrId rmid, uint8 info, int64 value)
  * current subtransaction.
  */
 static XLogRecData *
-XLogRecordAssemble(RmgrId rmid, uint8 info,
+XLogRecordAssemble(RmgrId rmid, uint8 info, uint8 geninfo,
 				   XLogRecPtr RedoRecPtr, bool doPageWrites,
 				   XLogRecPtr *fpw_lsn, int *num_fpi, bool *topxid_included)
 {
@@ -591,7 +600,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
 	 * a record.
 	 */
 	if (wal_consistency_checking[rmid])
-		info |= XLR_CHECK_CONSISTENCY;
+		geninfo |= XLR_CHECK_CONSISTENCY;
 
 	/*
 	 * Make an rdata chain containing all the data portions of all block
@@ -657,7 +666,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
 		 * If needs_backup is true or WAL checking is enabled for current
 		 * resource manager, log a full-page write for the current block.
 		 */
-		include_image = needs_backup || (info & XLR_CHECK_CONSISTENCY) != 0;
+		include_image = needs_backup || (geninfo & XLR_CHECK_CONSISTENCY) != 0;
 
 		if (include_image)
 		{
@@ -939,6 +948,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
 	rechdr->xl_xid = GetCurrentTransactionIdIfAny();
 	rechdr->xl_tot_len = (uint32) total_len;
 	rechdr->xl_info = info;
+	rechdr->xl_geninfo = geninfo;
 	rechdr->xl_rmid = rmid;
 	rechdr->xl_prev = InvalidXLogRecPtr;
 	rechdr->xl_crc = rdata_crc;
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 52ff4d119e6..3e3aae0e47c 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -2006,7 +2006,7 @@ ApplyWalRecord(XLogReaderState *xlogreader, XLogRecord *record, TimeLineID *repl
 	 * record are consistent with the existing pages. This check is done only
 	 * if consistency check is enabled for this record.
 	 */
-	if ((record->xl_info & XLR_CHECK_CONSISTENCY) != 0)
+	if ((record->xl_geninfo & XLR_CHECK_CONSISTENCY) != 0)
 		verifyBackupPageConsistency(xlogreader);
 
 	/* Pop the error context stack */
@@ -2483,7 +2483,7 @@ verifyBackupPageConsistency(XLogReaderState *record)
 	if (!XLogRecHasAnyBlockRefs(record))
 		return;
 
-	Assert((XLogRecGetInfo(record) & XLR_CHECK_CONSISTENCY) != 0);
+	Assert((XLogRecGetGeninfo(record) & XLR_CHECK_CONSISTENCY) != 0);
 
 	for (block_id = 0; block_id <= XLogRecMaxBlockId(record); block_id++)
 	{
diff --git a/src/backend/access/transam/xlogstats.c b/src/backend/access/transam/xlogstats.c
index 85963a6ac29..07bb1f00cc6 100644
--- a/src/backend/access/transam/xlogstats.c
+++ b/src/backend/access/transam/xlogstats.c
@@ -74,18 +74,15 @@ XLogRecStoreStats(XLogStats *stats, XLogReaderState *record)
 
 	/*
 	 * Update per-record statistics, where the record is identified by a
-	 * combination of the RmgrId and the four bits of the xl_info field that
-	 * are the rmgr's domain (resulting in sixteen possible entries per
-	 * RmgrId).
+	 * combination of the RmgrId and the record type.
 	 */
 
-	recid = XLogRecGetInfo(record) >> 4;
+	recid = XLogRecGetInfo(record);
 
 	/*
-	 * XACT records need to be handled differently. Those records use the
-	 * first bit of those four bits for an optional flag variable and the
-	 * following three bits for the opcode. We filter opcode out of xl_info
-	 * and use it as the identifier of the record.
+	 * XACT records need to be handled differently. Those records use three
+	 * bits for the opcode and the rest for optional flag variables. We filter
+	 * opcode out of xl_info and use it as the identifier of the record.
 	 */
 	if (rmid == RM_XACT_ID)
 		recid &= 0x07;
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index c58e9418ac3..829506296ed 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -196,7 +196,7 @@ log_smgrcreate(const RelFileLocator *rlocator, ForkNumber forkNum)
 
 	XLogBeginInsert();
 	XLogRegisterData(&xlrec, sizeof(xlrec));
-	XLogInsert(RM_SMGR_ID, XLOG_SMGR_CREATE | XLR_SPECIAL_REL_UPDATE);
+	XLogInsertExtended(RM_SMGR_ID, XLOG_SMGR_CREATE, XLR_SPECIAL_REL_UPDATE);
 }
 
 /*
@@ -400,8 +400,8 @@ RelationTruncate(Relation rel, BlockNumber nblocks)
 		XLogBeginInsert();
 		XLogRegisterData(&xlrec, sizeof(xlrec));
 
-		lsn = XLogInsert(RM_SMGR_ID,
-						 XLOG_SMGR_TRUNCATE | XLR_SPECIAL_REL_UPDATE);
+		lsn = XLogInsertExtended(RM_SMGR_ID,
+								 XLOG_SMGR_TRUNCATE, XLR_SPECIAL_REL_UPDATE);
 
 		/*
 		 * Flush, because otherwise the truncation of the main relation might
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 4d65e8c46c2..9ed7266b9b3 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -630,8 +630,8 @@ CreateDatabaseUsingFileCopy(Oid src_dboid, Oid dst_dboid, Oid src_tsid,
 			XLogRegisterData(&xlrec,
 							 sizeof(xl_dbase_create_file_copy_rec));
 
-			(void) XLogInsert(RM_DBASE_ID,
-							  XLOG_DBASE_CREATE_FILE_COPY | XLR_SPECIAL_REL_UPDATE);
+			(void) XLogInsertExtended(RM_DBASE_ID,
+									  XLOG_DBASE_CREATE_FILE_COPY, XLR_SPECIAL_REL_UPDATE);
 		}
 		pfree(srcpath);
 		pfree(dstpath);
@@ -2213,8 +2213,8 @@ movedb(const char *dbname, const char *tblspcname)
 			XLogRegisterData(&xlrec,
 							 sizeof(xl_dbase_create_file_copy_rec));
 
-			(void) XLogInsert(RM_DBASE_ID,
-							  XLOG_DBASE_CREATE_FILE_COPY | XLR_SPECIAL_REL_UPDATE);
+			(void) XLogInsertExtended(RM_DBASE_ID,
+									  XLOG_DBASE_CREATE_FILE_COPY, XLR_SPECIAL_REL_UPDATE);
 		}
 
 		/*
@@ -2309,8 +2309,8 @@ movedb(const char *dbname, const char *tblspcname)
 		XLogRegisterData(&xlrec, sizeof(xl_dbase_drop_rec));
 		XLogRegisterData(&src_tblspcoid, sizeof(Oid));
 
-		(void) XLogInsert(RM_DBASE_ID,
-						  XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE);
+		(void) XLogInsertExtended(RM_DBASE_ID,
+								  XLOG_DBASE_DROP, XLR_SPECIAL_REL_UPDATE);
 	}
 
 	/* Now it's safe to release the database lock */
@@ -3067,8 +3067,8 @@ remove_dbtablespaces(Oid db_id)
 		XLogRegisterData(&xlrec, MinSizeOfDbaseDropRec);
 		XLogRegisterData(tablespace_ids, ntblspc * sizeof(Oid));
 
-		(void) XLogInsert(RM_DBASE_ID,
-						  XLOG_DBASE_DROP | XLR_SPECIAL_REL_UPDATE);
+		(void) XLogInsertExtended(RM_DBASE_ID,
+								  XLOG_DBASE_DROP, XLR_SPECIAL_REL_UPDATE);
 	}
 
 	list_free(ltblspc);
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 7a4e4eb9570..ac4a7a7fe71 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -1132,6 +1132,7 @@ WriteEmptyXLOG(void)
 	record->xl_xid = InvalidTransactionId;
 	record->xl_tot_len = SizeOfXLogRecord + SizeOfXLogRecordDataHeaderShort + sizeof(CheckPoint);
 	record->xl_info = XLOG_CHECKPOINT_SHUTDOWN;
+	record->xl_geninfo = 0;
 	record->xl_rmid = RM_XLOG_ID;
 
 	recptr += SizeOfXLogRecord;
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index 8f4b282c6b1..953ca8a1a8d 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -392,6 +392,7 @@ extractPageInfo(XLogReaderState *record)
 	RmgrId		rmid = XLogRecGetRmid(record);
 	uint8		info = XLogRecGetInfo(record);
 	uint8		rminfo = info & ~XLR_INFO_MASK;
+	uint8		geninfo = XLogRecGetGeninfo(record);
 
 	/* Is this a special record type that I recognize? */
 
@@ -451,7 +452,7 @@ extractPageInfo(XLogReaderState *record)
 		 * source.
 		 */
 	}
-	else if (info & XLR_SPECIAL_REL_UPDATE)
+	else if (geninfo & XLR_SPECIAL_REL_UPDATE)
 	{
 		/*
 		 * This record type modifies a relation file in some special way, but
@@ -459,9 +460,9 @@ extractPageInfo(XLogReaderState *record)
 		 * track that change.
 		 */
 		pg_fatal("WAL record modifies a relation, but record type is not recognized:\n"
-				 "lsn: %X/%08X, rmid: %d, rmgr: %s, info: %02X",
+				 "lsn: %X/%08X, rmid: %d, rmgr: %s, info: %02X, geninfo: %02X",
 				 LSN_FORMAT_ARGS(record->ReadRecPtr),
-				 rmid, RmgrName(rmid), info);
+				 rmid, RmgrName(rmid), rminfo, geninfo);
 	}
 
 	for (block_id = 0; block_id <= XLogRecMaxBlockId(record); block_id++)
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 13d3ec2f5be..74b878a240a 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -711,10 +711,9 @@ XLogDumpDisplayStats(XLogDumpConfig *config, XLogStats *stats)
 				if (count == 0)
 					continue;
 
-				/* the upper four bits in xl_info are the rmgr's */
-				id = desc->rm_identify(rj << 4);
+				id = desc->rm_identify(rj);
 				if (id == NULL)
-					id = psprintf("UNKNOWN (%x)", rj << 4);
+					id = psprintf("UNKNOWN (%x)", rj);
 
 				XLogDumpStatsRow(psprintf("%s/%s", desc->rm_name, id),
 								 count, total_count, rec_len, total_rec_len,
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 4528e51829e..523cf814ee0 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -164,7 +164,7 @@ typedef struct SavedTransactionCharacteristics
  */
 
 /*
- * XLOG allows to store some information in high 4 bits of log record xl_info
+ * XLOG allows storing some information in the log record's xl_info
  * field. We use 3 for the opcode, and one about an optional flag variable.
  */
 #define XLOG_XACT_COMMIT			0x00
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h
index cc06fc29ab2..34deb2fe5f0 100644
--- a/src/include/access/xlog_internal.h
+++ b/src/include/access/xlog_internal.h
@@ -31,7 +31,7 @@
 /*
  * Each page of XLOG file has a header like this:
  */
-#define XLOG_PAGE_MAGIC 0xD118	/* can be used as WAL version indicator */
+#define XLOG_PAGE_MAGIC 0xD119	/* can be used as WAL version indicator */
 
 typedef struct XLogPageHeaderData
 {
diff --git a/src/include/access/xloginsert.h b/src/include/access/xloginsert.h
index d6a71415d4f..f2cb2c4bbac 100644
--- a/src/include/access/xloginsert.h
+++ b/src/include/access/xloginsert.h
@@ -44,6 +44,7 @@
 extern void XLogBeginInsert(void);
 extern void XLogSetRecordFlags(uint8 flags);
 extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info);
+extern XLogRecPtr XLogInsertExtended(RmgrId rmid, uint8 info, uint8 geninfo);
 extern XLogRecPtr XLogSimpleInsertInt64(RmgrId rmid, uint8 info, int64 value);
 extern void XLogEnsureRecordSpace(int max_block_id, int ndatas);
 extern void XLogRegisterData(const void *data, uint32 len);
diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h
index 9738462d3c9..6faf02e840f 100644
--- a/src/include/access/xlogreader.h
+++ b/src/include/access/xlogreader.h
@@ -408,6 +408,7 @@ extern bool DecodeXLogRecord(XLogReaderState *state,
 #define XLogRecGetTotalLen(decoder) ((decoder)->record->header.xl_tot_len)
 #define XLogRecGetPrev(decoder) ((decoder)->record->header.xl_prev)
 #define XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info)
+#define XLogRecGetGeninfo(decoder) ((decoder)->record->header.xl_geninfo)
 #define XLogRecGetRmid(decoder) ((decoder)->record->header.xl_rmid)
 #define XLogRecGetXid(decoder) ((decoder)->record->header.xl_xid)
 #define XLogRecGetOrigin(decoder) ((decoder)->record->record_origin)
diff --git a/src/include/access/xlogrecord.h b/src/include/access/xlogrecord.h
index a06833ce0a3..d3855f7314e 100644
--- a/src/include/access/xlogrecord.h
+++ b/src/include/access/xlogrecord.h
@@ -43,9 +43,10 @@ typedef struct XLogRecord
 	uint32		xl_tot_len;		/* total len of entire record */
 	TransactionId xl_xid;		/* xact id */
 	XLogRecPtr	xl_prev;		/* ptr to previous record in log */
-	uint8		xl_info;		/* flag bits, see below */
+	uint8		xl_info;		/* RMGR-specific info */
 	RmgrId		xl_rmid;		/* resource manager for this record */
-	/* 2 bytes of padding here, initialize to zero */
+	uint8		xl_geninfo;		/* flag bits, see below */
+	/* 1 byte of padding here, initialize to zero */
 	pg_crc32c	xl_crc;			/* CRC for this record */
 
 	/* XLogRecordBlockHeaders and XLogRecordDataHeader follow, no padding */
@@ -54,13 +55,7 @@ typedef struct XLogRecord
 
 #define SizeOfXLogRecord	(offsetof(XLogRecord, xl_crc) + sizeof(pg_crc32c))
 
-/*
- * The high 4 bits in xl_info may be used freely by rmgr. The
- * XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY bits can be passed by
- * XLogInsert caller. The rest are set internally by XLogInsert.
- */
 #define XLR_INFO_MASK			0x0F
-#define XLR_RMGR_INFO_MASK		0xF0
 
 /*
  * XLogReader needs to allocate all the data of a WAL record in a single
@@ -73,6 +68,12 @@ typedef struct XLogRecord
  */
 #define XLogRecordMaxSize	(1020 * 1024 * 1024)
 
+/*
+ * The XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY bits destined for
+ * xl_geninfo can be passed to XLogInsertExtended. The rest are set
+ * internally by XLogInsertExtended.
+ */
+
 /*
  * If a WAL record modifies any relation files, in ways not covered by the
  * usual block references, this flag is set. This is not used for anything
diff --git a/src/include/access/xlogstats.h b/src/include/access/xlogstats.h
index 6ec6670d44c..ca84d39f5ab 100644
--- a/src/include/access/xlogstats.h
+++ b/src/include/access/xlogstats.h
@@ -16,7 +16,7 @@
 #include "access/rmgr.h"
 #include "access/xlogreader.h"
 
-#define MAX_XLINFO_TYPES 16
+#define MAX_XLINFO_TYPES 256
 
 typedef struct XLogRecStats
 {
-- 
2.51.0

From f89886f2baea15efb1ada32a3d6e01d6a5022c90 Mon Sep 17 00:00:00 2001
From: John Naylor <[email protected]>
Date: Mon, 13 Oct 2025 15:29:53 +0700
Subject: [PATCH v2 2/2] Remove XLR_INFO_MASK

XXX Separate for visibility, to be squashed
---
 contrib/pg_walinspect/pg_walinspect.c          |  4 ++--
 src/backend/access/brin/brin_xlog.c            |  2 +-
 src/backend/access/gin/ginxlog.c               |  2 +-
 src/backend/access/gist/gistxlog.c             |  2 +-
 src/backend/access/hash/hash_xlog.c            |  2 +-
 src/backend/access/heap/heapam_xlog.c          |  4 ++--
 src/backend/access/nbtree/nbtxlog.c            |  2 +-
 src/backend/access/rmgrdesc/brindesc.c         |  4 ++--
 src/backend/access/rmgrdesc/clogdesc.c         |  4 ++--
 src/backend/access/rmgrdesc/committsdesc.c     |  2 +-
 src/backend/access/rmgrdesc/dbasedesc.c        |  4 ++--
 src/backend/access/rmgrdesc/gindesc.c          |  4 ++--
 src/backend/access/rmgrdesc/gistdesc.c         |  4 ++--
 src/backend/access/rmgrdesc/hashdesc.c         |  4 ++--
 src/backend/access/rmgrdesc/heapdesc.c         |  8 ++++----
 src/backend/access/rmgrdesc/logicalmsgdesc.c   |  4 ++--
 src/backend/access/rmgrdesc/mxactdesc.c        |  4 ++--
 src/backend/access/rmgrdesc/nbtdesc.c          |  4 ++--
 src/backend/access/rmgrdesc/relmapdesc.c       |  4 ++--
 src/backend/access/rmgrdesc/replorigindesc.c   |  2 +-
 src/backend/access/rmgrdesc/seqdesc.c          |  4 ++--
 src/backend/access/rmgrdesc/smgrdesc.c         |  4 ++--
 src/backend/access/rmgrdesc/spgdesc.c          |  4 ++--
 src/backend/access/rmgrdesc/standbydesc.c      |  4 ++--
 src/backend/access/rmgrdesc/tblspcdesc.c       |  4 ++--
 src/backend/access/rmgrdesc/xlogdesc.c         |  4 ++--
 src/backend/access/spgist/spgxlog.c            |  2 +-
 src/backend/access/transam/clog.c              |  2 +-
 src/backend/access/transam/commit_ts.c         |  2 +-
 src/backend/access/transam/multixact.c         |  2 +-
 src/backend/access/transam/xlog.c              |  4 ++--
 src/backend/access/transam/xlogprefetcher.c    |  2 +-
 src/backend/access/transam/xlogreader.c        |  2 +-
 src/backend/access/transam/xlogrecovery.c      | 18 +++++++++---------
 src/backend/catalog/storage.c                  |  2 +-
 src/backend/commands/dbcommands.c              |  2 +-
 src/backend/commands/sequence.c                |  2 +-
 src/backend/commands/tablespace.c              |  2 +-
 src/backend/postmaster/walsummarizer.c         |  8 ++++----
 src/backend/replication/logical/decode.c       |  6 +++---
 src/backend/replication/logical/message.c      |  2 +-
 src/backend/replication/logical/origin.c       |  2 +-
 src/backend/storage/ipc/standby.c              |  2 +-
 src/backend/utils/cache/relmapper.c            |  2 +-
 src/bin/pg_rewind/parsexlog.c                  |  5 ++---
 src/bin/pg_waldump/pg_waldump.c                |  2 +-
 src/include/access/xlogrecord.h                |  2 --
 .../test_custom_rmgrs/test_custom_rmgrs.c      |  6 +++---
 48 files changed, 85 insertions(+), 88 deletions(-)

diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c
index 21444bc5bc3..2deb367c623 100644
--- a/contrib/pg_walinspect/pg_walinspect.c
+++ b/contrib/pg_walinspect/pg_walinspect.c
@@ -204,7 +204,7 @@ GetWALRecordInfo(XLogReaderState *record, Datum *values,
 	record_type = desc.rm_identify(XLogRecGetInfo(record));
 
 	if (record_type == NULL)
-		record_type = psprintf("UNKNOWN (%x)", XLogRecGetInfo(record) & ~XLR_INFO_MASK);
+		record_type = psprintf("UNKNOWN (%x)", XLogRecGetInfo(record));
 
 	initStringInfo(&rec_desc);
 	desc.rm_desc(&rec_desc, record);
@@ -267,7 +267,7 @@ GetWALBlockInfo(FunctionCallInfo fcinfo, XLogReaderState *record,
 
 	if (record_type == NULL)
 		record_type = psprintf("UNKNOWN (%x)",
-							   XLogRecGetInfo(record) & ~XLR_INFO_MASK);
+							   XLogRecGetInfo(record));
 
 	initStringInfo(&rec_desc);
 	desc.rm_desc(&rec_desc, record);
diff --git a/src/backend/access/brin/brin_xlog.c b/src/backend/access/brin/brin_xlog.c
index 55348140fad..0cac80f20e4 100644
--- a/src/backend/access/brin/brin_xlog.c
+++ b/src/backend/access/brin/brin_xlog.c
@@ -308,7 +308,7 @@ brin_xlog_desummarize_page(XLogReaderState *record)
 void
 brin_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info & XLOG_BRIN_OPMASK)
 	{
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index fa293ee79d5..3f80a12fd36 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -724,7 +724,7 @@ ginRedoDeleteListPages(XLogReaderState *record)
 void
 gin_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	MemoryContext oldCtx;
 
 	/*
diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c
index 42fee1f0764..7cb0d119c20 100644
--- a/src/backend/access/gist/gistxlog.c
+++ b/src/backend/access/gist/gistxlog.c
@@ -396,7 +396,7 @@ gistRedoPageReuse(XLogReaderState *record)
 void
 gist_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	MemoryContext oldCxt;
 
 	/*
diff --git a/src/backend/access/hash/hash_xlog.c b/src/backend/access/hash/hash_xlog.c
index d963a0c3702..e19186c87d8 100644
--- a/src/backend/access/hash/hash_xlog.c
+++ b/src/backend/access/hash/hash_xlog.c
@@ -1066,7 +1066,7 @@ hash_xlog_vacuum_one_page(XLogReaderState *record)
 void
 hash_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
diff --git a/src/backend/access/heap/heapam_xlog.c b/src/backend/access/heap/heapam_xlog.c
index 230d9888793..e74273672ef 100644
--- a/src/backend/access/heap/heapam_xlog.c
+++ b/src/backend/access/heap/heapam_xlog.c
@@ -1300,7 +1300,7 @@ heap_xlog_inplace(XLogReaderState *record)
 void
 heap_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/*
 	 * These operations don't overwrite MVCC data so no conflict processing is
@@ -1346,7 +1346,7 @@ heap_redo(XLogReaderState *record)
 void
 heap2_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info & XLOG_HEAP_OPMASK)
 	{
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 69ea668bb0d..1e1a7cc4953 100644
--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -1017,7 +1017,7 @@ btree_xlog_reuse_page(XLogReaderState *record)
 void
 btree_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	MemoryContext oldCtx;
 
 	oldCtx = MemoryContextSwitchTo(opCtx);
diff --git a/src/backend/access/rmgrdesc/brindesc.c b/src/backend/access/rmgrdesc/brindesc.c
index 9fc0bfe2a52..b9782208d95 100644
--- a/src/backend/access/rmgrdesc/brindesc.c
+++ b/src/backend/access/rmgrdesc/brindesc.c
@@ -20,7 +20,7 @@ void
 brin_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	info &= XLOG_BRIN_OPMASK;
 	if (info == XLOG_BRIN_CREATE_INDEX)
@@ -75,7 +75,7 @@ brin_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_BRIN_CREATE_INDEX:
 			id = "CREATE_INDEX";
diff --git a/src/backend/access/rmgrdesc/clogdesc.c b/src/backend/access/rmgrdesc/clogdesc.c
index 41bf28dcfd0..7c466d98086 100644
--- a/src/backend/access/rmgrdesc/clogdesc.c
+++ b/src/backend/access/rmgrdesc/clogdesc.c
@@ -21,7 +21,7 @@ void
 clog_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == CLOG_ZEROPAGE)
 	{
@@ -45,7 +45,7 @@ clog_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case CLOG_ZEROPAGE:
 			id = "ZEROPAGE";
diff --git a/src/backend/access/rmgrdesc/committsdesc.c b/src/backend/access/rmgrdesc/committsdesc.c
index a6ab9dd78de..47152924987 100644
--- a/src/backend/access/rmgrdesc/committsdesc.c
+++ b/src/backend/access/rmgrdesc/committsdesc.c
@@ -21,7 +21,7 @@ void
 commit_ts_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == COMMIT_TS_ZEROPAGE)
 	{
diff --git a/src/backend/access/rmgrdesc/dbasedesc.c b/src/backend/access/rmgrdesc/dbasedesc.c
index 4224c5673ff..530ab285595 100644
--- a/src/backend/access/rmgrdesc/dbasedesc.c
+++ b/src/backend/access/rmgrdesc/dbasedesc.c
@@ -22,7 +22,7 @@ void
 dbase_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_DBASE_CREATE_FILE_COPY)
 	{
@@ -58,7 +58,7 @@ dbase_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_DBASE_CREATE_FILE_COPY:
 			id = "CREATE_FILE_COPY";
diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c
index 075c4a0ae93..5a1c72a3d3a 100644
--- a/src/backend/access/rmgrdesc/gindesc.c
+++ b/src/backend/access/rmgrdesc/gindesc.c
@@ -72,7 +72,7 @@ void
 gin_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
@@ -187,7 +187,7 @@ gin_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_GIN_CREATE_PTREE:
 			id = "CREATE_PTREE";
diff --git a/src/backend/access/rmgrdesc/gistdesc.c b/src/backend/access/rmgrdesc/gistdesc.c
index a2b84e898f9..931cc1f6e90 100644
--- a/src/backend/access/rmgrdesc/gistdesc.c
+++ b/src/backend/access/rmgrdesc/gistdesc.c
@@ -61,7 +61,7 @@ void
 gist_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
@@ -91,7 +91,7 @@ gist_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_GIST_PAGE_UPDATE:
 			id = "PAGE_UPDATE";
diff --git a/src/backend/access/rmgrdesc/hashdesc.c b/src/backend/access/rmgrdesc/hashdesc.c
index 2ee5332452f..5cdd6b31f76 100644
--- a/src/backend/access/rmgrdesc/hashdesc.c
+++ b/src/backend/access/rmgrdesc/hashdesc.c
@@ -20,7 +20,7 @@ void
 hash_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
@@ -132,7 +132,7 @@ hash_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_HASH_INIT_META_PAGE:
 			id = "INIT_META_PAGE";
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c
index ca26d1f0ed1..08f4b7234a3 100644
--- a/src/backend/access/rmgrdesc/heapdesc.c
+++ b/src/backend/access/rmgrdesc/heapdesc.c
@@ -185,7 +185,7 @@ void
 heap_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	info &= XLOG_HEAP_OPMASK;
 	if (info == XLOG_HEAP_INSERT)
@@ -265,7 +265,7 @@ void
 heap2_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	info &= XLOG_HEAP_OPMASK;
 	if (info == XLOG_HEAP2_PRUNE_ON_ACCESS ||
@@ -405,7 +405,7 @@ heap_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_HEAP_INSERT:
 			id = "INSERT";
@@ -450,7 +450,7 @@ heap2_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_HEAP2_PRUNE_ON_ACCESS:
 			id = "PRUNE_ON_ACCESS";
diff --git a/src/backend/access/rmgrdesc/logicalmsgdesc.c b/src/backend/access/rmgrdesc/logicalmsgdesc.c
index 1c8c99f19f8..1b81c9dbfb1 100644
--- a/src/backend/access/rmgrdesc/logicalmsgdesc.c
+++ b/src/backend/access/rmgrdesc/logicalmsgdesc.c
@@ -19,7 +19,7 @@ void
 logicalmsg_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_LOGICAL_MESSAGE)
 	{
@@ -45,7 +45,7 @@ logicalmsg_desc(StringInfo buf, XLogReaderState *record)
 const char *
 logicalmsg_identify(uint8 info)
 {
-	if ((info & ~XLR_INFO_MASK) == XLOG_LOGICAL_MESSAGE)
+	if (info == XLOG_LOGICAL_MESSAGE)
 		return "MESSAGE";
 
 	return NULL;
diff --git a/src/backend/access/rmgrdesc/mxactdesc.c b/src/backend/access/rmgrdesc/mxactdesc.c
index 3ca0582db36..11eec402443 100644
--- a/src/backend/access/rmgrdesc/mxactdesc.c
+++ b/src/backend/access/rmgrdesc/mxactdesc.c
@@ -50,7 +50,7 @@ void
 multixact_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE ||
 		info == XLOG_MULTIXACT_ZERO_MEM_PAGE)
@@ -85,7 +85,7 @@ multixact_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_MULTIXACT_ZERO_OFF_PAGE:
 			id = "ZERO_OFF_PAGE";
diff --git a/src/backend/access/rmgrdesc/nbtdesc.c b/src/backend/access/rmgrdesc/nbtdesc.c
index c05d19ab007..5ad5742af19 100644
--- a/src/backend/access/rmgrdesc/nbtdesc.c
+++ b/src/backend/access/rmgrdesc/nbtdesc.c
@@ -24,7 +24,7 @@ void
 btree_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
@@ -140,7 +140,7 @@ btree_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_BTREE_INSERT_LEAF:
 			id = "INSERT_LEAF";
diff --git a/src/backend/access/rmgrdesc/relmapdesc.c b/src/backend/access/rmgrdesc/relmapdesc.c
index caf18460321..c518f88a87d 100644
--- a/src/backend/access/rmgrdesc/relmapdesc.c
+++ b/src/backend/access/rmgrdesc/relmapdesc.c
@@ -20,7 +20,7 @@ void
 relmap_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_RELMAP_UPDATE)
 	{
@@ -36,7 +36,7 @@ relmap_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_RELMAP_UPDATE:
 			id = "UPDATE";
diff --git a/src/backend/access/rmgrdesc/replorigindesc.c b/src/backend/access/rmgrdesc/replorigindesc.c
index 35e3af2903e..285e64996f8 100644
--- a/src/backend/access/rmgrdesc/replorigindesc.c
+++ b/src/backend/access/rmgrdesc/replorigindesc.c
@@ -19,7 +19,7 @@ void
 replorigin_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
diff --git a/src/backend/access/rmgrdesc/seqdesc.c b/src/backend/access/rmgrdesc/seqdesc.c
index 0d289d77fcf..475b22ed51e 100644
--- a/src/backend/access/rmgrdesc/seqdesc.c
+++ b/src/backend/access/rmgrdesc/seqdesc.c
@@ -21,7 +21,7 @@ void
 seq_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	xl_seq_rec *xlrec = (xl_seq_rec *) rec;
 
 	if (info == XLOG_SEQ_LOG)
@@ -35,7 +35,7 @@ seq_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_SEQ_LOG:
 			id = "LOG";
diff --git a/src/backend/access/rmgrdesc/smgrdesc.c b/src/backend/access/rmgrdesc/smgrdesc.c
index 4bb7fc79bce..4411d23a02b 100644
--- a/src/backend/access/rmgrdesc/smgrdesc.c
+++ b/src/backend/access/rmgrdesc/smgrdesc.c
@@ -21,7 +21,7 @@ void
 smgr_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_SMGR_CREATE)
 	{
@@ -45,7 +45,7 @@ smgr_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_SMGR_CREATE:
 			id = "CREATE";
diff --git a/src/backend/access/rmgrdesc/spgdesc.c b/src/backend/access/rmgrdesc/spgdesc.c
index 72efedc5b40..5b2512a869f 100644
--- a/src/backend/access/rmgrdesc/spgdesc.c
+++ b/src/backend/access/rmgrdesc/spgdesc.c
@@ -20,7 +20,7 @@ void
 spg_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
@@ -133,7 +133,7 @@ spg_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_SPGIST_ADD_LEAF:
 			id = "ADD_LEAF";
diff --git a/src/backend/access/rmgrdesc/standbydesc.c b/src/backend/access/rmgrdesc/standbydesc.c
index 81eff5f31c4..ebe40ee7d7b 100644
--- a/src/backend/access/rmgrdesc/standbydesc.c
+++ b/src/backend/access/rmgrdesc/standbydesc.c
@@ -47,7 +47,7 @@ void
 standby_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_STANDBY_LOCK)
 	{
@@ -80,7 +80,7 @@ standby_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_STANDBY_LOCK:
 			id = "LOCK";
diff --git a/src/backend/access/rmgrdesc/tblspcdesc.c b/src/backend/access/rmgrdesc/tblspcdesc.c
index 5d612b4232e..141ffbcd727 100644
--- a/src/backend/access/rmgrdesc/tblspcdesc.c
+++ b/src/backend/access/rmgrdesc/tblspcdesc.c
@@ -21,7 +21,7 @@ void
 tblspc_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_TBLSPC_CREATE)
 	{
@@ -42,7 +42,7 @@ tblspc_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_TBLSPC_CREATE:
 			id = "CREATE";
diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index cd6c2a2f650..aa9e9d7a04a 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -58,7 +58,7 @@ void
 xlog_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_CHECKPOINT_SHUTDOWN ||
 		info == XLOG_CHECKPOINT_ONLINE)
@@ -174,7 +174,7 @@ xlog_identify(uint8 info)
 {
 	const char *id = NULL;
 
-	switch (info & ~XLR_INFO_MASK)
+	switch (info)
 	{
 		case XLOG_CHECKPOINT_SHUTDOWN:
 			id = "CHECKPOINT_SHUTDOWN";
diff --git a/src/backend/access/spgist/spgxlog.c b/src/backend/access/spgist/spgxlog.c
index d4620c915d0..1d41bea17df 100644
--- a/src/backend/access/spgist/spgxlog.c
+++ b/src/backend/access/spgist/spgxlog.c
@@ -934,7 +934,7 @@ spgRedoVacuumRedirect(XLogReaderState *record)
 void
 spg_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	MemoryContext oldCxt;
 
 	oldCxt = MemoryContextSwitchTo(opCtx);
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index e80fbe109cf..7dd5b9e98c0 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -1061,7 +1061,7 @@ WriteTruncateXlogRec(int64 pageno, TransactionId oldestXact, Oid oldestXactDb)
 void
 clog_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in clog records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 370b38e048b..d1f8a416299 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -982,7 +982,7 @@ WriteTruncateXlogRec(int64 pageno, TransactionId oldestXid)
 void
 commit_ts_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in commit_ts records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index 9d5f130af7e..5c3a5ee12b1 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3329,7 +3329,7 @@ WriteMTruncateXlogRec(Oid oldestMultiDB,
 void
 multixact_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in multixact records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index eceab341255..f513c5fdc22 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -755,7 +755,7 @@ XLogInsertRecord(XLogRecData *rdata,
 	pg_crc32c	rdata_crc;
 	bool		inserted;
 	XLogRecord *rechdr = (XLogRecord *) rdata->data;
-	uint8		info = rechdr->xl_info & ~XLR_INFO_MASK;
+	uint8		info = rechdr->xl_info;
 	WalInsertClass class = WALINSERT_NORMAL;
 	XLogRecPtr	StartPos;
 	XLogRecPtr	EndPos;
@@ -8284,7 +8284,7 @@ UpdateFullPageWrites(void)
 void
 xlog_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	XLogRecPtr	lsn = record->EndRecPtr;
 
 	/*
diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c
index ed3aacabc98..7e2b754001c 100644
--- a/src/backend/access/transam/xlogprefetcher.c
+++ b/src/backend/access/transam/xlogprefetcher.c
@@ -530,7 +530,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
 		if (replaying_lsn < record->lsn)
 		{
 			uint8		rmid = record->header.xl_rmid;
-			uint8		record_type = record->header.xl_info & ~XLR_INFO_MASK;
+			uint8		record_type = record->header.xl_info;
 
 			if (rmid == RM_XLOG_ID)
 			{
diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index dcc8d4f9c1b..5d17038249e 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -874,7 +874,7 @@ restart:
 	 * Special processing if it's an XLOG SWITCH record
 	 */
 	if (record->xl_rmid == RM_XLOG_ID &&
-		(record->xl_info & ~XLR_INFO_MASK) == XLOG_SWITCH)
+		record->xl_info == XLOG_SWITCH)
 	{
 		/* Pretend it extends to end of segment */
 		state->NextRecPtr += state->segcxt.ws_segsize - 1;
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 3e3aae0e47c..5ff52062b82 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -635,7 +635,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
 		if (record != NULL)
 		{
 			memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
-			wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
+			wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
 			ereport(DEBUG1,
 					errmsg_internal("checkpoint record is at %X/%08X",
 									LSN_FORMAT_ARGS(CheckPointLoc)));
@@ -803,7 +803,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
 						   LSN_FORMAT_ARGS(CheckPointLoc)));
 		}
 		memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint));
-		wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN);
+		wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
 	}
 
 	if (ArchiveRecoveryRequested)
@@ -1722,7 +1722,7 @@ PerformWalRecovery(void)
 		 * record.
 		 */
 		if (record->xl_rmid != RM_XLOG_ID ||
-			(record->xl_info & ~XLR_INFO_MASK) != XLOG_CHECKPOINT_REDO)
+			record->xl_info != XLOG_CHECKPOINT_REDO)
 			ereport(FATAL,
 					errmsg("unexpected record type found at redo point %X/%08X",
 						   LSN_FORMAT_ARGS(xlogreader->ReadRecPtr)));
@@ -1944,7 +1944,7 @@ ApplyWalRecord(XLogReaderState *xlogreader, XLogRecord *record, TimeLineID *repl
 	{
 		TimeLineID	newReplayTLI = *replayTLI;
 		TimeLineID	prevReplayTLI = *replayTLI;
-		uint8		info = record->xl_info & ~XLR_INFO_MASK;
+		uint8		info = record->xl_info;
 
 		if (info == XLOG_CHECKPOINT_SHUTDOWN)
 		{
@@ -2082,7 +2082,7 @@ ApplyWalRecord(XLogReaderState *xlogreader, XLogRecord *record, TimeLineID *repl
 static void
 xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	XLogRecPtr	lsn = record->EndRecPtr;
 
 	Assert(XLogRecGetRmid(record) == RM_XLOG_ID);
@@ -2318,7 +2318,7 @@ xlog_outdesc(StringInfo buf, XLogReaderState *record)
 
 	id = rmgr.rm_identify(info);
 	if (id == NULL)
-		appendStringInfo(buf, "UNKNOWN (%X): ", info & ~XLR_INFO_MASK);
+		appendStringInfo(buf, "UNKNOWN (%X): ", info);
 	else
 		appendStringInfo(buf, "%s: ", id);
 
@@ -2438,7 +2438,7 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI,
 static bool
 getRecordTimestamp(XLogReaderState *record, TimestampTz *recordXtime)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	uint8		xact_info = info & XLOG_XACT_OPMASK;
 	uint8		rmid = XLogRecGetRmid(record);
 
@@ -2750,7 +2750,7 @@ recoveryStopsAfter(XLogReaderState *record)
 	if (!ArchiveRecoveryRequested)
 		return false;
 
-	info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	info = XLogRecGetInfo(record);
 	rmid = XLogRecGetRmid(record);
 
 	/*
@@ -4100,7 +4100,7 @@ ReadCheckpointRecord(XLogPrefetcher *xlogprefetcher, XLogRecPtr RecPtr,
 				(errmsg("invalid resource manager ID in checkpoint record")));
 		return NULL;
 	}
-	info = record->xl_info & ~XLR_INFO_MASK;
+	info = record->xl_info;
 	if (info != XLOG_CHECKPOINT_SHUTDOWN &&
 		info != XLOG_CHECKPOINT_ONLINE)
 	{
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index 829506296ed..d2520ffa8be 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -981,7 +981,7 @@ void
 smgr_redo(XLogReaderState *record)
 {
 	XLogRecPtr	lsn = record->EndRecPtr;
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in smgr records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 9ed7266b9b3..c9380346faa 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -3285,7 +3285,7 @@ recovery_create_dbdir(char *path, bool only_tblspc)
 void
 dbase_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in dbase records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index cf46a543364..4b23c7c205b 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -1913,7 +1913,7 @@ void
 seq_redo(XLogReaderState *record)
 {
 	XLogRecPtr	lsn = record->EndRecPtr;
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 	Buffer		buffer;
 	Page		page;
 	Page		localpage;
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index df31eace47a..01b4d8e5df0 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -1510,7 +1510,7 @@ get_tablespace_name(Oid spc_oid)
 void
 tblspc_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in tblspc records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/postmaster/walsummarizer.c b/src/backend/postmaster/walsummarizer.c
index e1f142f20c7..2f6fd9e928f 100644
--- a/src/backend/postmaster/walsummarizer.c
+++ b/src/backend/postmaster/walsummarizer.c
@@ -1248,7 +1248,7 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
 static void
 SummarizeDbaseRecord(XLogReaderState *xlogreader, BlockRefTable *brtab)
 {
-	uint8		info = XLogRecGetInfo(xlogreader) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(xlogreader);
 
 	/*
 	 * We use relfilenode zero for a given database OID and tablespace OID to
@@ -1317,7 +1317,7 @@ SummarizeDbaseRecord(XLogReaderState *xlogreader, BlockRefTable *brtab)
 static void
 SummarizeSmgrRecord(XLogReaderState *xlogreader, BlockRefTable *brtab)
 {
-	uint8		info = XLogRecGetInfo(xlogreader) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(xlogreader);
 
 	if (info == XLOG_SMGR_CREATE)
 	{
@@ -1366,7 +1366,7 @@ SummarizeSmgrRecord(XLogReaderState *xlogreader, BlockRefTable *brtab)
 static void
 SummarizeXactRecord(XLogReaderState *xlogreader, BlockRefTable *brtab)
 {
-	uint8		info = XLogRecGetInfo(xlogreader) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(xlogreader);
 	uint8		xact_info = info & XLOG_XACT_OPMASK;
 
 	if (xact_info == XLOG_XACT_COMMIT ||
@@ -1426,7 +1426,7 @@ SummarizeXactRecord(XLogReaderState *xlogreader, BlockRefTable *brtab)
 static bool
 SummarizeXlogRecord(XLogReaderState *xlogreader, bool *new_fast_forward)
 {
-	uint8		info = XLogRecGetInfo(xlogreader) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(xlogreader);
 	int			record_wal_level;
 
 	if (info == XLOG_CHECKPOINT_REDO)
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index cc03f0706e9..d1b552e3990 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -129,7 +129,7 @@ void
 xlog_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 {
 	SnapBuild  *builder = ctx->snapshot_builder;
-	uint8		info = XLogRecGetInfo(buf->record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(buf->record);
 
 	ReorderBufferProcessXid(ctx->reorder, XLogRecGetXid(buf->record),
 							buf->origptr);
@@ -360,7 +360,7 @@ standby_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 {
 	SnapBuild  *builder = ctx->snapshot_builder;
 	XLogReaderState *r = buf->record;
-	uint8		info = XLogRecGetInfo(r) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(r);
 
 	ReorderBufferProcessXid(ctx->reorder, XLogRecGetXid(r), buf->origptr);
 
@@ -597,7 +597,7 @@ logicalmsg_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 	SnapBuild  *builder = ctx->snapshot_builder;
 	XLogReaderState *r = buf->record;
 	TransactionId xid = XLogRecGetXid(r);
-	uint8		info = XLogRecGetInfo(r) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(r);
 	RepOriginId origin_id = XLogRecGetOrigin(r);
 	Snapshot	snapshot = NULL;
 	xl_logical_message *message;
diff --git a/src/backend/replication/logical/message.c b/src/backend/replication/logical/message.c
index ebc8454bad9..844e38d83d2 100644
--- a/src/backend/replication/logical/message.c
+++ b/src/backend/replication/logical/message.c
@@ -86,7 +86,7 @@ LogLogicalMessage(const char *prefix, const char *message, size_t size,
 void
 logicalmsg_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info != XLOG_LOGICAL_MESSAGE)
 		elog(PANIC, "logicalmsg_redo: unknown op code %u", info);
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index bcd5d9aad62..ee38ab55d09 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -849,7 +849,7 @@ StartupReplicationOrigin(void)
 void
 replorigin_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	switch (info)
 	{
diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index 4222bdab078..501de242f8b 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -1162,7 +1162,7 @@ StandbyReleaseOldLocks(TransactionId oldxid)
 void
 standby_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in standby records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/backend/utils/cache/relmapper.c b/src/backend/utils/cache/relmapper.c
index abf89f0776e..d0afb932390 100644
--- a/src/backend/utils/cache/relmapper.c
+++ b/src/backend/utils/cache/relmapper.c
@@ -1095,7 +1095,7 @@ perform_relmap_update(bool shared, const RelMapFile *updates)
 void
 relmap_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	/* Backup blocks are not used in relmap records */
 	Assert(!XLogRecHasAnyBlockRefs(record));
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index 953ca8a1a8d..761f344d102 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -243,7 +243,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,
 		 * be the latest checkpoint before WAL forked and not the checkpoint
 		 * where the primary has been stopped to be rewound.
 		 */
-		info = XLogRecGetInfo(xlogreader) & ~XLR_INFO_MASK;
+		info = XLogRecGetInfo(xlogreader);
 		if (searchptr < forkptr &&
 			XLogRecGetRmid(xlogreader) == RM_XLOG_ID &&
 			(info == XLOG_CHECKPOINT_SHUTDOWN ||
@@ -390,8 +390,7 @@ extractPageInfo(XLogReaderState *record)
 {
 	int			block_id;
 	RmgrId		rmid = XLogRecGetRmid(record);
-	uint8		info = XLogRecGetInfo(record);
-	uint8		rminfo = info & ~XLR_INFO_MASK;
+	uint8		rminfo = XLogRecGetInfo(record);
 	uint8		geninfo = XLogRecGetGeninfo(record);
 
 	/* Is this a special record type that I recognize? */
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 74b878a240a..8d9111a7693 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -564,7 +564,7 @@ XLogDumpDisplayRecord(XLogDumpConfig *config, XLogReaderState *record)
 
 	id = desc->rm_identify(info);
 	if (id == NULL)
-		printf("desc: UNKNOWN (%x) ", info & ~XLR_INFO_MASK);
+		printf("desc: UNKNOWN (%x) ", info);
 	else
 		printf("desc: %s ", id);
 
diff --git a/src/include/access/xlogrecord.h b/src/include/access/xlogrecord.h
index d3855f7314e..14a4967ce99 100644
--- a/src/include/access/xlogrecord.h
+++ b/src/include/access/xlogrecord.h
@@ -55,8 +55,6 @@ typedef struct XLogRecord
 
 #define SizeOfXLogRecord	(offsetof(XLogRecord, xl_crc) + sizeof(pg_crc32c))
 
-#define XLR_INFO_MASK			0x0F
-
 /*
  * XLogReader needs to allocate all the data of a WAL record in a single
  * chunk.  This means that a single XLogRecord cannot exceed MaxAllocSize
diff --git a/src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c b/src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
index 1a424ad55a8..6153a426723 100644
--- a/src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
+++ b/src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
@@ -81,7 +81,7 @@ _PG_init(void)
 void
 testcustomrmgrs_redo(XLogReaderState *record)
 {
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info != XLOG_TEST_CUSTOM_RMGRS_MESSAGE)
 		elog(PANIC, "testcustomrmgrs_redo: unknown op code %u", info);
@@ -91,7 +91,7 @@ void
 testcustomrmgrs_desc(StringInfo buf, XLogReaderState *record)
 {
 	char	   *rec = XLogRecGetData(record);
-	uint8		info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
+	uint8		info = XLogRecGetInfo(record);
 
 	if (info == XLOG_TEST_CUSTOM_RMGRS_MESSAGE)
 	{
@@ -105,7 +105,7 @@ testcustomrmgrs_desc(StringInfo buf, XLogReaderState *record)
 const char *
 testcustomrmgrs_identify(uint8 info)
 {
-	if ((info & ~XLR_INFO_MASK) == XLOG_TEST_CUSTOM_RMGRS_MESSAGE)
+	if (info == XLOG_TEST_CUSTOM_RMGRS_MESSAGE)
 		return "TEST_CUSTOM_RMGRS_MESSAGE";
 
 	return NULL;
-- 
2.51.0

Reply via email to