[PATCH] Refactor: Extract XLogRecord info

From: Xiaoran Wang <fanfuxiaoran(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Refactor: Extract XLogRecord info
Date: 2025-06-09 06:23:17
Message-ID: CAGjhLkNYhNfbhsZhR_sEJ=1VqJmFCzx1BVfWWZ0+it2ucqG-pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-Refactor-Extract-XLogRecord-info.patch application/octet-stream 37.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Steven Niu 2025-06-09 06:45:50 Re: [PATCH] Refactor: Extract XLogRecord info
Previous Message Alexander Lakhin 2025-06-09 06:00:00 Re: strange perf regression with data checksums