Hi,

On Fri, Nov 28, 2025 at 02:20:25PM +0100, Peter Eisentraut wrote:
> On 28.11.25 10:06, Bertrand Drouvot wrote:
> > On Fri, Nov 28, 2025 at 09:11:16AM +0100, Peter Eisentraut wrote:
> > > I think this whole thing could be simplified by overlaying a uint32 over
> > > "data" and just accessing the array fields normally.  See attached patch.
> > 
> > Indeed, that's a nice simplification.
> > 
> > -                       data += sizeof(uint32) * 2;
> > 
> > Is it safe? I mean could XLH_SPLIT_META_UPDATE_MASKS and 
> > XLH_SPLIT_META_UPDATE_SPLITPOINT
> > be set simultaneously?
> 
> Yes, that's what was probably intended.  But apparently not exercised in the
> tests.
> 
> So maybe more like this patch.

+   uint32          lowmask = uidata[uidatacount++];
+   uint32          highmask = uidata[uidatacount++];

good idea! That way that's easier to add more branches/flags later if we need
to.

Also, I think that's safe thanks to XLogRecGetBlockData() returning a
MAXALIGNed buffer. Not sure if it's worth to add a comment. I think that a
comment was not needed with the original code as it was using memcpy() instead.

Except for the nit comment remark above, LGTM.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com


Reply via email to