pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zdenek Kotala <Zdenek.Kotala@Sun.COM>
To: Heikki Linnakangas <heikki@enterprisedb.com>
Cc: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: PostgreSQL-patches <pgsql-patches@postgresql.org>
Subject: Re: page macros cleanup
Date: Fri, 04 Jul 2008 13:04:15 +0200
Message-ID: <486E03AF.2040402@sun.com> (raw)
In-Reply-To: <486E01B0.9050100@enterprisedb.com>
References: <48529B83.9010907@sun.com>
	<2e78013d0807030450m4cab60d0jd99d1acce59fae56@mail.gmail.com>
	<486DD1D1.50604@sun.com>
	<2e78013d0807040150w393ad72codaf06a6ac12a83ce@mail.gmail.com>
	<486DF644.4070604@enterprisedb.com>
	<2e78013d0807040350m3b2913cfkceaa70d8f9d697c2@mail.gmail.com>
	<486E01B0.9050100@enterprisedb.com>

Heikki Linnakangas napsal(a):
> Pavan Deolasee wrote:
>> On Fri, Jul 4, 2008 at 3:37 PM, Heikki Linnakangas
>> <heikki@enterprisedb.com> 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




view thread (17+ messages)  latest in thread

Message-ID: <486E03AF.2040402@sun.com>
Permalink:  ../486E03AF.2040402@sun.com/
Also on:    postgresql.org/message-id/486E03AF.2040402@sun.com

 · 

reply

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-patches@postgresql.org
  Cc: Zdenek.Kotala@Sun.COM, heikki@enterprisedb.com, pavan.deolasee@gmail.com
  Subject: Re: page macros cleanup
  In-Reply-To: <486E03AF.2040402@sun.com>

* 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