From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Subject: Why does PageIndexTupleDelete insist tuple size be maxaligned?
Date: Thu, 08 Sep 2016 16:32:42 -0400
Message-ID: <3814.1473366762@sss.pgh.pa.us> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: Why does PageIndexTupleDelete insist tuple size be maxaligned?
In-Reply-To: <3814.1473366762@sss.pgh.pa.us>
References: <3814.1473366762@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