Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-10 Thread Steven Niu
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 explanation. Steven 在 2025/6/11 10:13, Xiaoran Wang 写道: > > > Steven Niu mailto:niush...@gmail.com>> 于2025年6月 > 10日周二 17:56写道: > > I'm confused by

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-10 Thread Steven Niu
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 于2025年6月11日周三 10:13写道: > > > Steven Niu 于2025年6月10日周二 17:56写道: > >> I'm confused by the code of XLR_RMGR_INFO

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-10 Thread Xiaoran Wang
Steven Niu 于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_CONSISTENC

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-10 Thread Michael Paquier
On Mon, Jun 09, 2025 at 10:54:43PM -0300, Fabrízio de Royes Mello wrote: > The refactoring LGTM but do we really need two patches? IMHO you can just > merge everything into a single patch. FWIW, I'm not sure what's the benefit of the proposal which comes down to the removal of a bitwise NOT, excep

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-10 Thread Steven Niu
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. Th

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-10 Thread wenhui qiu
HI > FWIW, I'm not sure what's the benefit of the proposal which comes down > to the removal of a bitwise NOT, except more code conflicts with back > branches. Agree On Tue, Jun 10, 2025 at 3:37 PM Michael Paquier wrote: > On Mon, Jun 09, 2025 at 10:54:43PM -0300, Fabrízio de Royes Mello wrote:

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-09 Thread Fabrízio de Royes Mello
On Mon, 9 Jun 2025 at 22:40 Steven Niu wrote: > LGTM. I have no more comments. > > The refactoring LGTM but do we really need two patches? IMHO you can just merge everything into a single patch. Fabrízio de Royes Mello

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-09 Thread Steven Niu
LGTM. I have no more comments. Regards, Steven Xiaoran Wang 于2025年6月9日周一 18:31写道: > Just upload all the patches together. > > Xiaoran Wang 于2025年6月9日周一 18:25写道: > >> >> >> Steven Niu 于2025年6月9日周一 14:46写道: >> >>> Hi, >>> >>> I like the idea of your change as it saves me out of >>> converting-i

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-09 Thread Xiaoran Wang
Just upload all the patches together. Xiaoran Wang 于2025年6月9日周一 18:25写道: > > > Steven Niu 于2025年6月9日周一 14:46写道: > >> Hi, >> >> I like the idea of your change as it saves me out of >> converting-in-my-mind. >> >> And I suggest to create a macro to do this job. >> #define getRmgrInfo(info

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-09 Thread Xiaoran Wang
Steven Niu 于2025年6月9日周一 14:46写道: > Hi, > > I like the idea of your change as it saves me out of converting-in-my-mind. > > And I suggest to create a macro to do this job. > #define getRmgrInfo(info) (info & XLR_RMGR_INFO_MASK) > > Then the code can become: > XLogRecGetInfo(record) & ~XLR_

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-09 Thread wenhui qiu
HI > And I suggest to create a macro to do this job. >#define getRmgrInfo(info) (info & XLR_RMGR_INFO_MASK) > > Then the code can become: > XLogRecGetInfo(record) & ~XLR_INFO_MASK; > --> > getRmgrInfo(XLogRecGetInfo(record)) +1 Agreed, this makes the code more readable. Thanks On Mon, Jun

Re: [PATCH] Refactor: Extract XLogRecord info

2025-06-08 Thread Steven Niu
Hi, I like the idea of your change as it saves me out of converting-in-my-mind. And I suggest to create a macro to do this job. #define getRmgrInfo(info) (info & XLR_RMGR_INFO_MASK) Then the code can become: XLogRecGetInfo(record) & ~XLR_INFO_MASK; --> getRmgrInfo(XLogRecGetInfo(record)

[PATCH] Refactor: Extract XLogRecord info

2025-06-08 Thread Xiaoran Wang
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 p