From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org, Antonin Houska <ah@cybertec.at>
Subject: Re: xl_heap_header alignment?
Date: Tue, 21 Jul 2020 14:33:23 -0400
Message-ID: <1058724.1595356403@sss.pgh.pa.us> (raw)
In-Reply-To: <5A0F3128-D990-4431-9E97-793CD99FF11E@anarazel.de>
References: <21643.1595353537@antos>
<5A0F3128-D990-4431-9E97-793CD99FF11E@anarazel.de>
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 struct is 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, ah@cybertec.at
Subject: Re: xl_heap_header alignment?
In-Reply-To: <1058724.1595356403@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox