Re: get rid of RM_HEAP2_ID - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: get rid of RM_HEAP2_ID
Date
Msg-id 472e42c4-e9c7-4c17-be53-1ceb6c42f914@iki.fi
Whole thread Raw
In response to Re: get rid of RM_HEAP2_ID  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On 20/10/2025 04:36, Michael Paquier wrote:
> On Wed, Oct 15, 2025 at 05:39:38PM +0300, Heikki Linnakangas wrote:
>> We could store xl_crc unaligned. IIRC all the structs that follow that are
>> already stored unaligned.
> 
> If we do just that, would there be any downside in moving xl_crc to be
> just after xl_prev?  That would keep the record assembling part
> simpler, because XLogRecord is treated as a single object, where the
> code relies on a MAXALIGN64() to make sure that the header is aligned.

The CRC calculation looks like this:

>         /*
>          * Now that xl_prev has been filled in, calculate CRC of the record
>          * header.
>          */
>         rdata_crc = rechdr->xl_crc;
>         COMP_CRC32C(rdata_crc, rechdr, offsetof(XLogRecord, xl_crc));
>         FIN_CRC32C(rdata_crc);
>         rechdr->xl_crc = rdata_crc;

If 'xl_crc' is not the last field, the above needs to be changed to skip 
'xl_crc', or fill it with zeros or something. Similarly in the code that 
verifies the checksum. But sure, we could do that.

- Heikki




pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pgbench: extend variable usage in scripts
Next
From: Peter Eisentraut
Date:
Subject: Re: make tsearch use the database default locale