| From: | Steven Niu <niushiji(at)gmail(dot)com> |
|---|---|
| To: | Xiaoran Wang <fanfuxiaoran(at)gmail(dot)com> |
| Cc: | wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH] Refactor: Extract XLogRecord info |
| Date: | 2025-06-11 02:27:06 |
| Message-ID: | CABBtG=f_ra5uX+U3VwfQ1B0qeozHTsrHgcKkgi2TDfyjWf4Tmg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi, Xiaoran,
I see. The code is checking if the bits other than rmgr bits,
XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY are used.
Thanks for the explanation.
Steven
Xiaoran Wang <fanfuxiaoran(at)gmail(dot)com> 于2025年6月11日周三 10:13写道:
>
>
> Steven Niu <niushiji(at)gmail(dot)com> 于2025年6月10日周二 17:56写道:
>
>> I'm confused by the code of XLR_RMGR_INFO_MASK and XLR_INFO_MASK.
>>
>> According to the definition of masks, the high 4 bits are for rmgr.
>>
>> /*
>> * 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
>>
>>
>> However, in function XLogInsert(), there is code:
>>
>> /*
>> * The caller can set rmgr bits, 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);
>>
>> XLogInsert only allows the rmgr ,XLR_SPECIAL_REL_UPDATE and
> XLR_CHECK_CONSISTENCY
> set in the info.
>
>> #define XLR_SPECIAL_REL_UPDATE 0x01
>> #define XLR_CHECK_CONSISTENCY 0x02
>>
>> As the XLR_SPECIAL_REL_UPDATE and XLR_CHECK_CONSISTENCY are of the low 4
>> bits,
>> the above code is indicating the low 4 bits are for rmgr too?
>>
>
> No, only the high 4 bits are used for RMGR, see the code under directory
> 'src/backend/access/rmgrdesc'
>
> 'XLR_SPECIAL_REL_UPDATE' and 'XLR_CHECK_CONSISTENCY' are not RMGR info,
> but they
> can be passed by XLogInsert caller.
>
>>
>>
>> Did I misunderstand something?
>>
>> Thanks,
>> Steven
>>
>
> --
> Best regards !
> Xiaoran Wang
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Steven Niu | 2025-06-11 02:27:43 | Re: [PATCH] Refactor: Extract XLogRecord info |
| Previous Message | Junwang Zhao | 2025-06-11 02:26:44 | Re: Add a bound check to TidRangeEval |