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

Pavan Deolasee wrote:
> On Fri, Jul 4, 2008 at 1:01 PM, Zdenek Kotala <Zdenek.Kotala@sun.com> wrote:
>>
>> Good catch. I lost in basic arithmetic. What I see now that original
>> definition count sizeof(ItemIdData) twice and on other side it does not take
>> care about MAXALING correctly. I think correct formula is:
>>
>> #define HashMaxItemSize(page) \
>>        (PageGetPageSize(page) - \
>>          ( MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData))+ \
>>            MAXALIGN(sizeof(HashPageOpaqueData)) \
>>          )\
>>         )
>>
>> What do you think?
> 
> Yes. I think that's the correct way.

Doesn't look right to me. There's no padding after the first line 
pointer, hence the first MAXALIGN shouldn't be there.

BTW, looking at hashinsert.c where it's used, we're actually passing a 
pointer to the meta page to HashMaxItemSize(). So the PageGetPageSize() 
call on that is quite bogus, since it's not the meta page that the tuple 
is going to be inserted to. It's academical, because all pages are the 
same size anyway, but doesn't look right. I think I'd go with BLKCSZ 
instead.

I think this is the way it should be:

#define HashMaxItemSize \
	(BLCKSZ - \
	 SizeOfPageHeaderData - \
	 MAXALIGN(sizeof(HashPageOpaqueData)) - \
	 sizeof(ItemIdData))

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (17+ messages)  latest in thread

Message-ID: <486DF644.4070604@enterprisedb.com>
Permalink:  ../486DF644.4070604@enterprisedb.com/
Also on:    postgresql.org/message-id/486DF644.4070604@enterprisedb.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: heikki@enterprisedb.com, pavan.deolasee@gmail.com, Zdenek.Kotala@sun.com
  Subject: Re: page macros cleanup
  In-Reply-To: <486DF644.4070604@enterprisedb.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