Re: page macros cleanup

Zdenek Kotala <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
Heikki Linnakangas napsal(a):
> Pavan Deolasee wrote:
>> On Fri, Jul 4, 2008 at 3:37 PM, Heikki Linnakangas
>> <[email protected]> wrote:
>>>
>>> I think this is the way it should be:
>>>
>>> #define HashMaxItemSize \
>>>        (BLCKSZ - \
>>>         SizeOfPageHeaderData - \
>>>         MAXALIGN(sizeof(HashPageOpaqueData)) - \
>>>         sizeof(ItemIdData))
>>>
>>
>> I am wondering if this would fail for corner case if HashMaxItemSize
>> happened to be unaligned. For example, if (itemsz < HashMaxItemSize <
>> MAXALIGN(itemsz), PageAddItem() would later fail with a not-so-obvious
>> error. Should we just MAXALIGN_DOWN the HashMaxItemSize ?
> 
> No, there's a itemsz = MAXALIGN(itemsz) call before the check against 
> HashMaxItemSize.

It is tru, but id somebody will use HashMaxItemSize in different place in the 
future he could omit to use same approach. See tuptoaster.h how TOAST_MAX_CHUNK 
is defined or BTMaxItemSize in nbtree.h.

Pavan's comments is correct. It should give same result as my implementation 
(because BLCKSZ is aligned), but it is better readable and consistent with other.

	Zdenek

-- 
Zdenek Kotala              Sun Microsystems
Prague, Czech Republic     http://sun.com/postgresql


-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.