Re: xl_heap_header alignment?

Поиск
Список
Период
Сортировка
Искать
От
Andres Freund
Тема
Re: xl_heap_header alignment?
Дата
Msg-id
5A0F3128-D990-4431-9E97-793CD99FF11E@anarazel.de
Ответ на
xl_heap_header alignment? (Antonin Houska)
Список
Дерево обсуждения
xl_heap_header alignment? Antonin Houska <ah@cybertec.at>
Re: xl_heap_header alignment? Andres Freund <andres@anarazel.de>
Re: xl_heap_header alignment? Tom Lane <tgl@sss.pgh.pa.us>
Re: xl_heap_header alignment? Antonin Houska <ah@cybertec.at>
Hi, 

On July 21, 2020 10:45:37 AM PDT, Antonin Houska  wrote:
>I don't quite understand this part of the comment of the xl_heap_header
>structure:
>
>* NOTE: t_hoff could be recomputed, but we may as well store it because
> * it will come for free due to alignment considerations.
>
>What are the alignment considerations? The WAL code does not appear to
>assume
>any alignment, and therefore it uses memcpy() to copy the structure
>into a
>local variable before accessing its fields. For example,
>heap_xlog_insert().

Unless you declare them as packed, structs will add padding to align members correctly (if, and only if, the whole struct is stored well aligned).

Regards,

Andres
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


В списке pgsql-hackers по дате отправления
От: Antonin Houska
Дата:
Сообщение: xl_heap_header alignment?
От: Tom Lane
Дата:
Сообщение: Re: xl_heap_header alignment?
FAQ