From c4a93d778478c8140ff7d57f26e0dafe20aba3a0 Mon Sep 17 00:00:00 2001 From: Matthias van de Meent Date: Mon, 23 Jan 2023 16:24:01 +0100 Subject: [PATCH v5 2/7] Replace accesses to rmgr's XLogRecord info bit accesses with XLogRecGetRmgrInfo This allows refactoring of the info bits into its own struct field, instead of sharing the field with the records own info bits. --- contrib/pg_walinspect/pg_walinspect.c | 8 ++--- src/backend/access/brin/brin_xlog.c | 4 +-- 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.c | 10 +++---- src/backend/access/nbtree/nbtxlog.c | 2 +- src/backend/access/rmgrdesc/brindesc.c | 2 +- src/backend/access/rmgrdesc/clogdesc.c | 2 +- src/backend/access/rmgrdesc/committsdesc.c | 2 +- src/backend/access/rmgrdesc/dbasedesc.c | 2 +- src/backend/access/rmgrdesc/gindesc.c | 2 +- src/backend/access/rmgrdesc/gistdesc.c | 2 +- src/backend/access/rmgrdesc/hashdesc.c | 2 +- src/backend/access/rmgrdesc/heapdesc.c | 6 ++-- src/backend/access/rmgrdesc/logicalmsgdesc.c | 2 +- src/backend/access/rmgrdesc/mxactdesc.c | 2 +- src/backend/access/rmgrdesc/nbtdesc.c | 2 +- src/backend/access/rmgrdesc/relmapdesc.c | 2 +- src/backend/access/rmgrdesc/replorigindesc.c | 2 +- src/backend/access/rmgrdesc/seqdesc.c | 2 +- src/backend/access/rmgrdesc/smgrdesc.c | 2 +- src/backend/access/rmgrdesc/spgdesc.c | 2 +- src/backend/access/rmgrdesc/standbydesc.c | 2 +- src/backend/access/rmgrdesc/tblspcdesc.c | 2 +- src/backend/access/rmgrdesc/xactdesc.c | 30 +++++++++---------- src/backend/access/rmgrdesc/xlogdesc.c | 2 +- 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/twophase.c | 2 +- src/backend/access/transam/xact.c | 10 +++---- src/backend/access/transam/xlog.c | 2 +- src/backend/access/transam/xlogrecovery.c | 22 +++++++------- src/backend/access/transam/xlogstats.c | 2 +- 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/replication/logical/decode.c | 20 +++++++------ 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 | 6 ++-- src/bin/pg_waldump/pg_waldump.c | 4 +-- src/include/access/xact.h | 6 ++-- src/include/access/xlogreader.h | 3 +- .../test_custom_rmgrs/test_custom_rmgrs.c | 4 +-- 50 files changed, 105 insertions(+), 102 deletions(-) diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c index 796a74f322..1b6f4cb178 100644 --- a/contrib/pg_walinspect/pg_walinspect.c +++ b/contrib/pg_walinspect/pg_walinspect.c @@ -196,10 +196,10 @@ GetWALRecordInfo(XLogReaderState *record, Datum *values, int i = 0; desc = GetRmgr(XLogRecGetRmid(record)); - record_type = desc.rm_identify(XLogRecGetInfo(record)); + record_type = desc.rm_identify(XLogRecGetRmgrInfo(record)); if (record_type == NULL) - record_type = psprintf("UNKNOWN (%x)", XLogRecGetInfo(record) & ~XLR_INFO_MASK); + record_type = psprintf("UNKNOWN (%x)", XLogRecGetRmgrInfo(record)); initStringInfo(&rec_desc); desc.rm_desc(&rec_desc, record); @@ -258,11 +258,11 @@ GetWALBlockInfo(FunctionCallInfo fcinfo, XLogReaderState *record, Assert(XLogRecHasAnyBlockRefs(record)); desc = GetRmgr(XLogRecGetRmid(record)); - record_type = desc.rm_identify(XLogRecGetInfo(record)); + record_type = desc.rm_identify(XLogRecGetRmgrInfo(record)); if (record_type == NULL) record_type = psprintf("UNKNOWN (%x)", - XLogRecGetInfo(record) & ~XLR_INFO_MASK); + XLogRecGetRmgrInfo(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 89145b68f6..00dd85bdc5 100644 --- a/src/backend/access/brin/brin_xlog.c +++ b/src/backend/access/brin/brin_xlog.c @@ -56,7 +56,7 @@ brin_xlog_insert_update(XLogReaderState *record, * If we inserted the first and only tuple on the page, re-initialize the * page from scratch. */ - if (XLogRecGetInfo(record) & XLOG_BRIN_INIT_PAGE) + if (XLogRecGetRmgrInfo(record) & XLOG_BRIN_INIT_PAGE) { buffer = XLogInitBufferForRedo(record, 0); page = BufferGetPage(buffer); @@ -308,7 +308,7 @@ brin_xlog_desummarize_page(XLogReaderState *record) void brin_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); switch (info & XLOG_BRIN_OPMASK) { diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c index f7c84beef8..feb675ed19 100644 --- a/src/backend/access/gin/ginxlog.c +++ b/src/backend/access/gin/ginxlog.c @@ -725,7 +725,7 @@ ginRedoDeleteListPages(XLogReaderState *record) void gin_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); MemoryContext oldCtx; /* diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c index 15249aa921..a49210b64f 100644 --- a/src/backend/access/gist/gistxlog.c +++ b/src/backend/access/gist/gistxlog.c @@ -398,7 +398,7 @@ gistRedoPageReuse(XLogReaderState *record) void gist_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); MemoryContext oldCxt; /* diff --git a/src/backend/access/hash/hash_xlog.c b/src/backend/access/hash/hash_xlog.c index e8e06c62a9..3a45b7ee21 100644 --- a/src/backend/access/hash/hash_xlog.c +++ b/src/backend/access/hash/hash_xlog.c @@ -1048,7 +1048,7 @@ hash_xlog_vacuum_one_page(XLogReaderState *record) void hash_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 88a123d38a..e61a6f67d5 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -9247,7 +9247,7 @@ heap_xlog_insert(XLogReaderState *record) * If we inserted the first and only tuple on the page, re-initialize the * page from scratch. */ - if (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) + if (XLogRecGetRmgrInfo(record) & XLOG_HEAP_INIT_PAGE) { buffer = XLogInitBufferForRedo(record, 0); page = BufferGetPage(buffer); @@ -9341,7 +9341,7 @@ heap_xlog_multi_insert(XLogReaderState *record) uint32 newlen; Size freespace = 0; int i; - bool isinit = (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) != 0; + bool isinit = (XLogRecGetRmgrInfo(record) & XLOG_HEAP_INIT_PAGE) != 0; XLogRedoAction action; /* @@ -9589,7 +9589,7 @@ heap_xlog_update(XLogReaderState *record, bool hot_update) nbuffer = obuffer; newaction = oldaction; } - else if (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) + else if (XLogRecGetRmgrInfo(record) & XLOG_HEAP_INIT_PAGE) { nbuffer = XLogInitBufferForRedo(record, 0); page = (Page) BufferGetPage(nbuffer); @@ -9953,7 +9953,7 @@ heap_xlog_inplace(XLogReaderState *record) void heap_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); /* * These operations don't overwrite MVCC data so no conflict processing is @@ -9999,7 +9999,7 @@ heap_redo(XLogReaderState *record) void heap2_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); switch (info & XLOG_HEAP_OPMASK) { diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c index c87e46ed66..97d8d068c6 100644 --- a/src/backend/access/nbtree/nbtxlog.c +++ b/src/backend/access/nbtree/nbtxlog.c @@ -1015,7 +1015,7 @@ btree_xlog_reuse_page(XLogReaderState *record) void btree_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); MemoryContext oldCtx; oldCtx = MemoryContextSwitchTo(opCtx); diff --git a/src/backend/access/rmgrdesc/brindesc.c b/src/backend/access/rmgrdesc/brindesc.c index 1466a31bbb..1d3e5ee03e 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 = XLogRecGetRmgrInfo(record); info &= XLOG_BRIN_OPMASK; if (info == XLOG_BRIN_CREATE_INDEX) diff --git a/src/backend/access/rmgrdesc/clogdesc.c b/src/backend/access/rmgrdesc/clogdesc.c index e60b76f9da..915f9945d0 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 = XLogRecGetRmgrInfo(record); if (info == CLOG_ZEROPAGE) { diff --git a/src/backend/access/rmgrdesc/committsdesc.c b/src/backend/access/rmgrdesc/committsdesc.c index e7155cd507..3d673c2302 100644 --- a/src/backend/access/rmgrdesc/committsdesc.c +++ b/src/backend/access/rmgrdesc/committsdesc.c @@ -22,7 +22,7 @@ void commit_ts_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); if (info == COMMIT_TS_ZEROPAGE) { diff --git a/src/backend/access/rmgrdesc/dbasedesc.c b/src/backend/access/rmgrdesc/dbasedesc.c index 3922120d64..a9529bde05 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_DBASE_CREATE_FILE_COPY) { diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c index 246a6a6b85..08fc7ba49b 100644 --- a/src/backend/access/rmgrdesc/gindesc.c +++ b/src/backend/access/rmgrdesc/gindesc.c @@ -74,7 +74,7 @@ void gin_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/rmgrdesc/gistdesc.c b/src/backend/access/rmgrdesc/gistdesc.c index 5dc6e1dcee..6473069c1a 100644 --- a/src/backend/access/rmgrdesc/gistdesc.c +++ b/src/backend/access/rmgrdesc/gistdesc.c @@ -60,7 +60,7 @@ void gist_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/rmgrdesc/hashdesc.c b/src/backend/access/rmgrdesc/hashdesc.c index b6810a9320..bcb2013048 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 = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c index d73248abdd..15f943051a 100644 --- a/src/backend/access/rmgrdesc/heapdesc.c +++ b/src/backend/access/rmgrdesc/heapdesc.c @@ -95,7 +95,7 @@ void heap_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); info &= XLOG_HEAP_OPMASK; if (info == XLOG_HEAP_INSERT) @@ -172,7 +172,7 @@ void heap2_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); info &= XLOG_HEAP_OPMASK; if (info == XLOG_HEAP2_PRUNE) @@ -265,7 +265,7 @@ heap2_desc(StringInfo buf, XLogReaderState *record) else if (info == XLOG_HEAP2_MULTI_INSERT) { xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec; - bool isinit = (XLogRecGetInfo(record) & XLOG_HEAP_INIT_PAGE) != 0; + bool isinit = (XLogRecGetRmgrInfo(record) & XLOG_HEAP_INIT_PAGE) != 0; appendStringInfo(buf, "ntuples: %d, flags: 0x%02X", xlrec->ntuples, xlrec->flags); diff --git a/src/backend/access/rmgrdesc/logicalmsgdesc.c b/src/backend/access/rmgrdesc/logicalmsgdesc.c index 0578ec5535..2bb6cb06c3 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_LOGICAL_MESSAGE) { diff --git a/src/backend/access/rmgrdesc/mxactdesc.c b/src/backend/access/rmgrdesc/mxactdesc.c index a2fa1eca18..cdcf8a4f45 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE || info == XLOG_MULTIXACT_ZERO_MEM_PAGE) diff --git a/src/backend/access/rmgrdesc/nbtdesc.c b/src/backend/access/rmgrdesc/nbtdesc.c index e4fbaa4d5d..ede8df72c0 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 = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/rmgrdesc/relmapdesc.c b/src/backend/access/rmgrdesc/relmapdesc.c index 82ad51eb9a..f4f0e5ce8b 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_RELMAP_UPDATE) { diff --git a/src/backend/access/rmgrdesc/replorigindesc.c b/src/backend/access/rmgrdesc/replorigindesc.c index 8ce4588fda..539dc57939 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 = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/rmgrdesc/seqdesc.c b/src/backend/access/rmgrdesc/seqdesc.c index ba60544085..6def7b653b 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 = XLogRecGetRmgrInfo(record); xl_seq_rec *xlrec = (xl_seq_rec *) rec; if (info == XLOG_SEQ_LOG) diff --git a/src/backend/access/rmgrdesc/smgrdesc.c b/src/backend/access/rmgrdesc/smgrdesc.c index bd841b96e8..8604bee0c0 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_SMGR_CREATE) { diff --git a/src/backend/access/rmgrdesc/spgdesc.c b/src/backend/access/rmgrdesc/spgdesc.c index 87f62f0fb4..9e1e48240b 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 = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/access/rmgrdesc/standbydesc.c b/src/backend/access/rmgrdesc/standbydesc.c index f2bce9a37a..9a08e10fe1 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_STANDBY_LOCK) { diff --git a/src/backend/access/rmgrdesc/tblspcdesc.c b/src/backend/access/rmgrdesc/tblspcdesc.c index b8c89f8c54..c1feb4fa05 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 = XLogRecGetRmgrInfo(record); if (info == XLOG_TBLSPC_CREATE) { diff --git a/src/backend/access/rmgrdesc/xactdesc.c b/src/backend/access/rmgrdesc/xactdesc.c index 01610c5ddc..8903bb32de 100644 --- a/src/backend/access/rmgrdesc/xactdesc.c +++ b/src/backend/access/rmgrdesc/xactdesc.c @@ -32,7 +32,7 @@ */ void -ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed) +ParseCommitRecord(uint8 rmgrinfo, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed) { char *data = ((char *) xlrec) + MinSizeOfXactCommit; @@ -43,7 +43,7 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *pars parsed->xact_time = xlrec->xact_time; - if (info & XLOG_XACT_HAS_INFO) + if (rmgrinfo & XLOG_XACT_HAS_INFO) { xl_xact_xinfo *xl_xinfo = (xl_xact_xinfo *) data; @@ -138,7 +138,7 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *pars } void -ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed) +ParseAbortRecord(uint8 rmgrinfo, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed) { char *data = ((char *) xlrec) + MinSizeOfXactAbort; @@ -149,7 +149,7 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed) parsed->xact_time = xlrec->xact_time; - if (info & XLOG_XACT_HAS_INFO) + if (rmgrinfo & XLOG_XACT_HAS_INFO) { xl_xact_xinfo *xl_xinfo = (xl_xact_xinfo *) data; @@ -236,7 +236,7 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed) * ParsePrepareRecord */ void -ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed) +ParsePrepareRecord(uint8 rmgrinfo, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed) { char *bufptr; @@ -328,11 +328,11 @@ xact_desc_stats(StringInfo buf, const char *label, } static void -xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId origin_id) +xact_desc_commit(StringInfo buf, uint8 rmgrinfo, xl_xact_commit *xlrec, RepOriginId origin_id) { xl_xact_parsed_commit parsed; - ParseCommitRecord(info, xlrec, &parsed); + ParseCommitRecord(rmgrinfo, xlrec, &parsed); /* If this is a prepared xact, show the xid of the original xact */ if (TransactionIdIsValid(parsed.twophase_xid)) @@ -364,11 +364,11 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId } static void -xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec, RepOriginId origin_id) +xact_desc_abort(StringInfo buf, uint8 rmgrinfo, xl_xact_abort *xlrec, RepOriginId origin_id) { xl_xact_parsed_abort parsed; - ParseAbortRecord(info, xlrec, &parsed); + ParseAbortRecord(rmgrinfo, xlrec, &parsed); /* If this is a prepared xact, show the xid of the original xact */ if (TransactionIdIsValid(parsed.twophase_xid)) @@ -391,11 +391,11 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec, RepOriginId or } static void -xact_desc_prepare(StringInfo buf, uint8 info, xl_xact_prepare *xlrec, RepOriginId origin_id) +xact_desc_prepare(StringInfo buf, uint8 rmgrinfo, xl_xact_prepare *xlrec, RepOriginId origin_id) { xl_xact_parsed_prepare parsed; - ParsePrepareRecord(info, xlrec, &parsed); + ParsePrepareRecord(rmgrinfo, xlrec, &parsed); appendStringInfo(buf, "gid %s: ", parsed.twophase_gid); appendStringInfoString(buf, timestamptz_to_str(parsed.xact_time)); @@ -436,27 +436,27 @@ void xact_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & XLOG_XACT_OPMASK; + uint8 info = XLogRecGetRmgrInfo(record) & XLOG_XACT_OPMASK; if (info == XLOG_XACT_COMMIT || info == XLOG_XACT_COMMIT_PREPARED) { xl_xact_commit *xlrec = (xl_xact_commit *) rec; - xact_desc_commit(buf, XLogRecGetInfo(record), xlrec, + xact_desc_commit(buf, XLogRecGetRmgrInfo(record), xlrec, XLogRecGetOrigin(record)); } else if (info == XLOG_XACT_ABORT || info == XLOG_XACT_ABORT_PREPARED) { xl_xact_abort *xlrec = (xl_xact_abort *) rec; - xact_desc_abort(buf, XLogRecGetInfo(record), xlrec, + xact_desc_abort(buf, XLogRecGetRmgrInfo(record), xlrec, XLogRecGetOrigin(record)); } else if (info == XLOG_XACT_PREPARE) { xl_xact_prepare *xlrec = (xl_xact_prepare *) rec; - xact_desc_prepare(buf, XLogRecGetInfo(record), xlrec, + xact_desc_prepare(buf, XLogRecGetRmgrInfo(record), xlrec, XLogRecGetOrigin(record)); } else if (info == XLOG_XACT_ASSIGNMENT) diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c index f390c177e4..3692dfb96a 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -37,7 +37,7 @@ void xlog_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); if (info == XLOG_CHECKPOINT_SHUTDOWN || info == XLOG_CHECKPOINT_ONLINE) diff --git a/src/backend/access/spgist/spgxlog.c b/src/backend/access/spgist/spgxlog.c index 459ac929ba..53190a67f9 100644 --- a/src/backend/access/spgist/spgxlog.c +++ b/src/backend/access/spgist/spgxlog.c @@ -936,7 +936,7 @@ spgRedoVacuumRedirect(XLogReaderState *record) void spg_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); MemoryContext oldCxt; oldCxt = MemoryContextSwitchTo(opCtx); diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index 4a431d5876..11c10b936d 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -984,7 +984,7 @@ WriteTruncateXlogRec(int pageno, TransactionId oldestXact, Oid oldestXactDb) void clog_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(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 b897fabc70..a351ee84ce 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -966,7 +966,7 @@ WriteTruncateXlogRec(int pageno, TransactionId oldestXid) void commit_ts_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(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 abb022e067..c70b6b7358 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -3232,7 +3232,7 @@ WriteMTruncateXlogRec(Oid oldestMultiDB, void multixact_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); /* Backup blocks are not used in multixact records */ Assert(!XLogRecHasAnyBlockRefs(record)); diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index c6af8cfd7e..cf852a2668 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -1430,7 +1430,7 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len) } if (XLogRecGetRmid(xlogreader) != RM_XACT_ID || - (XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE) + (XLogRecGetRmgrInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE) ereport(ERROR, (errcode_for_file_access(), errmsg("expected two-phase state data is not present in WAL at %X/%X", diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 8daaa535ed..c560f07390 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -6183,7 +6183,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid, void xact_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & XLOG_XACT_OPMASK; + uint8 info = XLogRecGetRmgrInfo(record) & XLOG_XACT_OPMASK; /* Backup blocks are not used in xact records */ Assert(!XLogRecHasAnyBlockRefs(record)); @@ -6193,7 +6193,7 @@ xact_redo(XLogReaderState *record) xl_xact_commit *xlrec = (xl_xact_commit *) XLogRecGetData(record); xl_xact_parsed_commit parsed; - ParseCommitRecord(XLogRecGetInfo(record), xlrec, &parsed); + ParseCommitRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); xact_redo_commit(&parsed, XLogRecGetXid(record), record->EndRecPtr, XLogRecGetOrigin(record)); } @@ -6202,7 +6202,7 @@ xact_redo(XLogReaderState *record) xl_xact_commit *xlrec = (xl_xact_commit *) XLogRecGetData(record); xl_xact_parsed_commit parsed; - ParseCommitRecord(XLogRecGetInfo(record), xlrec, &parsed); + ParseCommitRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); xact_redo_commit(&parsed, parsed.twophase_xid, record->EndRecPtr, XLogRecGetOrigin(record)); @@ -6216,7 +6216,7 @@ xact_redo(XLogReaderState *record) xl_xact_abort *xlrec = (xl_xact_abort *) XLogRecGetData(record); xl_xact_parsed_abort parsed; - ParseAbortRecord(XLogRecGetInfo(record), xlrec, &parsed); + ParseAbortRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); xact_redo_abort(&parsed, XLogRecGetXid(record), record->EndRecPtr, XLogRecGetOrigin(record)); } @@ -6225,7 +6225,7 @@ xact_redo(XLogReaderState *record) xl_xact_abort *xlrec = (xl_xact_abort *) XLogRecGetData(record); xl_xact_parsed_abort parsed; - ParseAbortRecord(XLogRecGetInfo(record), xlrec, &parsed); + ParseAbortRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); xact_redo_abort(&parsed, parsed.twophase_xid, record->EndRecPtr, XLogRecGetOrigin(record)); diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index fcbde10529..08c78bf57b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7742,7 +7742,7 @@ UpdateFullPageWrites(void) void xlog_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); XLogRecPtr lsn = record->EndRecPtr; /* diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index becc2bda62..6508246999 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -1995,7 +1995,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 = XLogRecGetRmgrInfo(record); XLogRecPtr lsn = record->EndRecPtr; Assert(XLogRecGetRmid(record) == RM_XLOG_ID); @@ -2213,7 +2213,7 @@ void xlog_outdesc(StringInfo buf, XLogReaderState *record) { RmgrData rmgr = GetRmgr(XLogRecGetRmid(record)); - uint8 info = XLogRecGetInfo(record); + uint8 info = XLogRecGetRmgrInfo(record); const char *id; appendStringInfoString(buf, rmgr.rm_name); @@ -2221,7 +2221,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); @@ -2341,7 +2341,7 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI, static bool getRecordTimestamp(XLogReaderState *record, TimestampTz *recordXtime) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); uint8 xact_info = info & XLOG_XACT_OPMASK; uint8 rmid = XLogRecGetRmid(record); @@ -2535,7 +2535,7 @@ recoveryStopsBefore(XLogReaderState *record) if (XLogRecGetRmid(record) != RM_XACT_ID) return false; - xact_info = XLogRecGetInfo(record) & XLOG_XACT_OPMASK; + xact_info = XLogRecGetRmgrInfo(record); if (xact_info == XLOG_XACT_COMMIT) { @@ -2548,7 +2548,7 @@ recoveryStopsBefore(XLogReaderState *record) xl_xact_parsed_commit parsed; isCommit = true; - ParseCommitRecord(XLogRecGetInfo(record), + ParseCommitRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); recordXid = parsed.twophase_xid; @@ -2564,7 +2564,7 @@ recoveryStopsBefore(XLogReaderState *record) xl_xact_parsed_abort parsed; isCommit = false; - ParseAbortRecord(XLogRecGetInfo(record), + ParseAbortRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); recordXid = parsed.twophase_xid; @@ -2653,7 +2653,7 @@ recoveryStopsAfter(XLogReaderState *record) if (!ArchiveRecoveryRequested) return false; - info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + info = XLogRecGetRmgrInfo(record); rmid = XLogRecGetRmid(record); /* @@ -2721,7 +2721,7 @@ recoveryStopsAfter(XLogReaderState *record) xl_xact_commit *xlrec = (xl_xact_commit *) XLogRecGetData(record); xl_xact_parsed_commit parsed; - ParseCommitRecord(XLogRecGetInfo(record), + ParseCommitRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); recordXid = parsed.twophase_xid; @@ -2731,7 +2731,7 @@ recoveryStopsAfter(XLogReaderState *record) xl_xact_abort *xlrec = (xl_xact_abort *) XLogRecGetData(record); xl_xact_parsed_abort parsed; - ParseAbortRecord(XLogRecGetInfo(record), + ParseAbortRecord(XLogRecGetRmgrInfo(record), xlrec, &parsed); recordXid = parsed.twophase_xid; @@ -2925,7 +2925,7 @@ recoveryApplyDelay(XLogReaderState *record) if (XLogRecGetRmid(record) != RM_XACT_ID) return false; - xact_info = XLogRecGetInfo(record) & XLOG_XACT_OPMASK; + xact_info = XLogRecGetRmgrInfo(record) & XLOG_XACT_OPMASK; if (xact_info != XLOG_XACT_COMMIT && xact_info != XLOG_XACT_COMMIT_PREPARED) diff --git a/src/backend/access/transam/xlogstats.c b/src/backend/access/transam/xlogstats.c index 2d315df67a..267b108943 100644 --- a/src/backend/access/transam/xlogstats.c +++ b/src/backend/access/transam/xlogstats.c @@ -79,7 +79,7 @@ XLogRecStoreStats(XLogStats *stats, XLogReaderState *record) * RmgrId). */ - recid = XLogRecGetInfo(record) >> 4; + recid = XLogRecGetRmgrInfo(record) >> 4; /* * XACT records need to be handled differently. Those records use the diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c index 93f07e49b7..9ce4d9a920 100644 --- a/src/backend/catalog/storage.c +++ b/src/backend/catalog/storage.c @@ -958,7 +958,7 @@ void smgr_redo(XLogReaderState *record) { XLogRecPtr lsn = record->EndRecPtr; - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(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 307729ab7e..bc061a697d 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -3179,7 +3179,7 @@ recovery_create_dbdir(char *path, bool only_tblspc) void dbase_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(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 47acdf5166..efd0bd4f02 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -1816,7 +1816,7 @@ void seq_redo(XLogReaderState *record) { XLogRecPtr lsn = record->EndRecPtr; - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); Buffer buffer; Page page; Page localpage; diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 13b0dee146..1de6803df7 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -1516,7 +1516,7 @@ get_tablespace_name(Oid spc_oid) void tblspc_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); /* Backup blocks are not used in tblspc records */ Assert(!XLogRecHasAnyBlockRefs(record)); diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c index 730061c9da..1878dad9c8 100644 --- a/src/backend/replication/logical/decode.c +++ b/src/backend/replication/logical/decode.c @@ -132,7 +132,7 @@ void xlog_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) { SnapBuild *builder = ctx->snapshot_builder; - uint8 info = XLogRecGetInfo(buf->record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(buf->record); ReorderBufferProcessXid(ctx->reorder, XLogRecGetXid(buf->record), buf->origptr); @@ -205,7 +205,7 @@ xact_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) SnapBuild *builder = ctx->snapshot_builder; ReorderBuffer *reorder = ctx->reorder; XLogReaderState *r = buf->record; - uint8 info = XLogRecGetInfo(r) & XLOG_XACT_OPMASK; + uint8 info = XLogRecGetRmgrInfo(r) & XLOG_XACT_OPMASK; /* * If the snapshot isn't yet fully built, we cannot decode anything, so @@ -225,7 +225,9 @@ xact_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) bool two_phase = false; xlrec = (xl_xact_commit *) XLogRecGetData(r); - ParseCommitRecord(XLogRecGetInfo(buf->record), xlrec, &parsed); + ParseCommitRecord(XLogRecGetRmgrInfo(buf->record), + xlrec, + &parsed); if (!TransactionIdIsValid(parsed.twophase_xid)) xid = XLogRecGetXid(r); @@ -253,7 +255,7 @@ xact_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) bool two_phase = false; xlrec = (xl_xact_abort *) XLogRecGetData(r); - ParseAbortRecord(XLogRecGetInfo(buf->record), xlrec, &parsed); + ParseAbortRecord(XLogRecGetRmgrInfo(buf->record), xlrec, &parsed); if (!TransactionIdIsValid(parsed.twophase_xid)) xid = XLogRecGetXid(r); @@ -316,7 +318,7 @@ xact_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) /* ok, parse it */ xlrec = (xl_xact_prepare *) XLogRecGetData(r); - ParsePrepareRecord(XLogRecGetInfo(buf->record), + ParsePrepareRecord(XLogRecGetRmgrInfo(buf->record), xlrec, &parsed); /* @@ -361,7 +363,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 = XLogRecGetRmgrInfo(r); ReorderBufferProcessXid(ctx->reorder, XLogRecGetXid(r), buf->origptr); @@ -405,7 +407,7 @@ standby_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) void heap2_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) { - uint8 info = XLogRecGetInfo(buf->record) & XLOG_HEAP_OPMASK; + uint8 info = XLogRecGetRmgrInfo(buf->record) & XLOG_HEAP_OPMASK; TransactionId xid = XLogRecGetXid(buf->record); SnapBuild *builder = ctx->snapshot_builder; @@ -464,7 +466,7 @@ heap2_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) void heap_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) { - uint8 info = XLogRecGetInfo(buf->record) & XLOG_HEAP_OPMASK; + uint8 info = XLogRecGetRmgrInfo(buf->record) & XLOG_HEAP_OPMASK; TransactionId xid = XLogRecGetXid(buf->record); SnapBuild *builder = ctx->snapshot_builder; @@ -589,7 +591,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 = XLogRecGetRmgrInfo(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 c5de14afc6..c31dc1203f 100644 --- a/src/backend/replication/logical/message.c +++ b/src/backend/replication/logical/message.c @@ -80,7 +80,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 = XLogRecGetRmgrInfo(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 b0255ffd25..4977d2eb9a 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -826,7 +826,7 @@ StartupReplicationOrigin(void) void replorigin_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(record); switch (info) { diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index cc22d2e87c..44338d6de3 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -1160,7 +1160,7 @@ StandbyReleaseOldLocks(TransactionId oldxid) void standby_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(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 26575cae6c..b825dda353 100644 --- a/src/backend/utils/cache/relmapper.c +++ b/src/backend/utils/cache/relmapper.c @@ -1084,7 +1084,7 @@ perform_relmap_update(bool shared, const RelMapFile *updates) void relmap_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetRmgrInfo(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 27782237d0..2b6b46f0e3 100644 --- a/src/bin/pg_rewind/parsexlog.c +++ b/src/bin/pg_rewind/parsexlog.c @@ -222,7 +222,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 = XLogRecGetRmgrInfo(xlogreader); if (searchptr < forkptr && XLogRecGetRmid(xlogreader) == RM_XLOG_ID && (info == XLOG_CHECKPOINT_SHUTDOWN || @@ -370,7 +370,7 @@ extractPageInfo(XLogReaderState *record) int block_id; RmgrId rmid = XLogRecGetRmid(record); uint8 info = XLogRecGetInfo(record); - uint8 rminfo = info & ~XLR_INFO_MASK; + uint8 rminfo = XLogRecGetRmgrInfo(record); /* Is this a special record type that I recognize? */ @@ -440,7 +440,7 @@ extractPageInfo(XLogReaderState *record) pg_fatal("WAL record modifies a relation, but record type is not recognized: " "lsn: %X/%X, rmid: %d, rmgr: %s, info: %02X", LSN_FORMAT_ARGS(record->ReadRecPtr), - rmid, RmgrName(rmid), info); + rmid, RmgrName(rmid), info | rminfo); } 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 a3535bdfa9..48b733b767 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -549,7 +549,7 @@ XLogDumpDisplayRecord(XLogDumpConfig *config, XLogReaderState *record) const RmgrDescData *desc = GetRmgrDesc(XLogRecGetRmid(record)); uint32 rec_len; uint32 fpi_len; - uint8 info = XLogRecGetInfo(record); + uint8 info = XLogRecGetRmgrInfo(record); XLogRecPtr xl_prev = XLogRecGetPrev(record); StringInfoData s; @@ -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/xact.h b/src/include/access/xact.h index 7d3b9446e6..b94b264402 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -519,9 +519,9 @@ extern void xact_desc(StringInfo buf, XLogReaderState *record); extern const char *xact_identify(uint8 info); /* also in xactdesc.c, so they can be shared between front/backend code */ -extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed); -extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed); -extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed); +extern void ParseCommitRecord(uint8 rmgrinfo, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed); +extern void ParseAbortRecord(uint8 rmgrinfo, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed); +extern void ParsePrepareRecord(uint8 rmgrinfo, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed); extern void EnterParallelMode(void); extern void ExitParallelMode(void); diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h index da32c7db77..2b976dcc03 100644 --- a/src/include/access/xlogreader.h +++ b/src/include/access/xlogreader.h @@ -407,7 +407,8 @@ 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 XLogRecGetInfo(decoder) ((decoder)->record->header.xl_info & XLR_INFO_MASK) +#define XLogRecGetRmgrInfo(decoder) (((decoder)->record->header.xl_info) & XLR_RMGR_INFO_MASK) #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/test/modules/test_custom_rmgrs/test_custom_rmgrs.c b/src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c index a304ba54bb..b5537a5f5b 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 = XLogRecGetRmgrInfo(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 = XLogRecGetRmgrInfo(record); if (info == XLOG_TEST_CUSTOM_RMGRS_MESSAGE) { -- 2.40.1