Why does PageIndexTupleDelete insist tuple size be maxaligned?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Why does PageIndexTupleDelete insist tuple size be maxaligned?
Дата
Msg-id 3814.1473366762@sss.pgh.pa.us
обсуждение исходный текст
Список pgsql-hackers
While perusing the proposed PageIndexTupleOverwrite patch, I noticed
that PageIndexTupleDelete throws an error if size != MAXALIGN(size),
where "size" is the ItemIdGetLength value.  This seems wrong now that
I look at it, because PageAddItem does not insist on tuple sizes being
maxaligned.  It does maxalign the amount of space actually allocated,
but what it stores into the ItemId length field is the pre-alignment
tuple size.

Also, PageRepairFragmentation and PageIndexMultiDelete are on board
with having to maxalign ItemIdGetLength values.  The latter makes
things particularly problematic here, because depending on how many
tuples are to be deleted, we might or might not enforce the restriction
about size being maxaligned.

So I think this is wrong, or at least trouble waiting to happen.
It probably works because all index AMs using these functions maxalign
their claimed tuple sizes before calling any bufpage.c functions,
but since we don't do that for heap tuples, it seems wrong to insist
that index AMs do so.

Barring objection, I plan to modify PageIndexTupleDelete to not expect
maxalignment of the stored size.
        regards, tom lane



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

Предыдущее
От: Lucas
Дата:
Сообщение: Re: Preventing deadlock on parallel backup
Следующее
От: Andres Freund
Дата:
Сообщение: CVE-2016-1238 fix breaks (at least) pg_rewind tests