[PATCH] Refactor: Extract XLogRecord info
Xiaoran Wang <fanfuxiaoran@gmail.com>
From: Xiaoran Wang <fanfuxiaoran@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2025-06-09T06:23:17Z
Lists: pgsql-hackers
Attachments
- 0001-Refactor-Extract-XLogRecord-info.patch (application/octet-stream) patch 0001
Hi,
I refactored the code of extracting XLogRecord info.
In XLogRecord, the high 4 bits in xl_info is used by rmgr.
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 */
RmgrId xl_rmid; /* resource manager for this record */
/* 2 bytes of padding here, initialize to zero */
pg_crc32c xl_crc; /* CRC for this record */
/* XLogRecordBlockHeaders and XLogRecordDataHeader follow, no padding */
} XLogRecord;
I found lots of the code to get the info as below
XLogRecGetInfo(record) & ~XLR_INFO_MASK
Actually, we can directly use XLR_RMGR_INFO_MASK(0xF0)
instead of XLR_INFO_MASK(0x0F), which is easier to understand.
Remove XLR_INFO_MASK as it is not used any more.
--
Best regards !
Xiaoran Wang