Re: pageinspect: Hash index support - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pageinspect: Hash index support
Date
Msg-id 8921.1478109287@sss.pgh.pa.us
Whole thread Raw
In response to Re: pageinspect: Hash index support  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: pageinspect: Hash index support  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> So, we're down to crashes in gin_metapage_info() on ia64 and sparc64.
> My guess is that the raw page data that is passed into the function
> needs to be 8-byte aligned before being accessed as GinMetaPageData.

That's what it looks like to me, too.  The "bytea" page image is
guaranteed to be improperly aligned for 64-bit access, since it will have
an int32 length word before the actual page data, breaking the alignment
that would exist for a page sitting in a page buffer.  This is likely to
be a problem for more things than just gin_metapage_info(); sooner or
later it could affect just about everything in pageinspect.

> (Maybe GinPageGetMeta() should do it?)

I think the right thing is likely to be to copy the presented bytea
into a palloc'd (and therefore properly aligned) buffer.  And not
just in this one function.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pageinspect: Hash index support
Next
From: Mithun Cy
Date:
Subject: Re: Patch: Implement failover on libpq connect level.