From f89886f2baea15efb1ada32a3d6e01d6a5022c90 Mon Sep 17 00:00:00 2001 From: John Naylor 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