Re: get rid of RM_HEAP2_ID

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: get rid of RM_HEAP2_ID
Дата
Msg-id 472e42c4-e9c7-4c17-be53-1ceb6c42f914@iki.fi
обсуждение исходный текст
Ответ на Re: get rid of RM_HEAP2_ID  (Michael Paquier <michael@paquier.xyz>)
Список 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 по дате отправления: