Re: xl_heap_header alignment?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: xl_heap_header alignment?
Дата
Msg-id 1058724.1595356403@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: xl_heap_header alignment?  (Andres Freund <andres@anarazel.de>)
Ответы Re: xl_heap_header alignment?  (Antonin Houska <ah@cybertec.at>)
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On July 21, 2020 10:45:37 AM PDT, Antonin Houska <ah@cybertec.at> 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.

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

I think that comment may be out of date, because what's there now is

 * NOTE: t_hoff could be recomputed, but we may as well store it because
 * it will come for free due to alignment considerations.
 */
typedef struct xl_heap_header
{
    uint16        t_infomask2;
    uint16        t_infomask;
    uint8        t_hoff;
} xl_heap_header;

I find it hard to see how tacking t_hoff onto what would have been a
4-byte struct is "free".  Maybe sometime in the dim past there was
another field in this struct?  (But I checked back as far as 7.4
without finding one.)

I don't particularly want to remove the field, but we ought to
change or remove the comment.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: xl_heap_header alignment?
Следующее
От: Justin Pryzby
Дата:
Сообщение: v13 planner ERROR: could not determine which collation to use for string comparison