Re: get rid of RM_HEAP2_ID

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: get rid of RM_HEAP2_ID
Date: 2025-10-21 07:18:38
Message-ID: 472e42c4-e9c7-4c17-be53-1ceb6c42f914@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-10-21 07:23:02 Re: make tsearch use the database default locale
Previous Message Michael Paquier 2025-10-21 07:18:09 Re: pgbench: extend variable usage in scripts