Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]
Дата
Msg-id 20150219095453.GF16383@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2015-02-18 21:00:43 -0500, Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
> > 3) heapam.c in three places with HeapTupleHeaderData:
> >         struct
> >         {
> >                 HeapTupleHeaderData hdr;
> >                 char            data[MaxHeapTupleSize];
> >         }                       tbuf;
> 
> And this, though I'm not sure if we'd have to change the size of the
> padding data[] member.

I don't think so.
/** MaxHeapTupleSize is the maximum allowed size of a heap tuple, including* header and MAXALIGN alignment padding.
Basicallyit's BLCKSZ minus the* other stuff that has to be on a disk page.  Since heap pages use no* "special space",
there'sno deduction for that.
 
...
#define MaxHeapTupleSize  (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))

> > 5) reorderbuffer.h with its use of HeapTupleHeaderData:
> 
> Hmm.  Andres will have to answer for that one ;-)

That should be fairly uncomplicated to replace.
...       /* tuple, stored sequentially */HeapTupleData tuple;HeapTupleHeaderData header;char
data[MaxHeapTupleSize];

probably can just be replaced by a union of data and header part - as
quoted above MaxHeapTupleSize actually contains space for the
header. It's a bit annoying because potentially some output plugin might
reference .header - but they can just be changed to reference
tuple.t_data instead.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Expanding the use of FLEXIBLE_ARRAY_MEMBER for declarations like foo[1]
Следующее
От: Andres Freund
Дата:
Сообщение: Re: INSERT ... ON CONFLICT UPDATE and logical decoding