Re: IndexTupleDSize macro seems redundant - Mailing list pgsql-hackers

From Tom Lane
Subject Re: IndexTupleDSize macro seems redundant
Date
Msg-id 10582.1515695187@sss.pgh.pa.us
Whole thread Raw
In response to Re: IndexTupleDSize macro seems redundant  (Stephen Frost <sfrost@snowman.net>)
Responses Re: IndexTupleDSize macro seems redundant
Re: IndexTupleDSize macro seems redundant
List pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> I'm on board with Stephen's changes, except in _bt_restore_page.
>> The issue there is that the "from" pointer isn't necessarily adequately
>> aligned to be considered an IndexTuple pointer; that's why we're doing
>> the memcpy dance to get a length out of it.

> I certainly hadn't been thinking about that.  I didn't see any
> issues in my testing (where I created a table with a btree index and
> insert'd a bunch of records into and then killed the server, forcing WAL
> replay and then checked that the index appeared to be valid using order
> by queries; perhaps I should have tried amcheck, but doesn't sound like
> this is something that would have been guaranteed to break anyway).

You wouldn't see a problem, unless you tested on alignment-picky
hardware, ie, not Intel.

I wonder whether there is a way to get alignment traps on Intel-type
hardware.  It's getting less and less likely that most hackers are
developing on anything else, so that we don't see gotchas of this
type until code hits the buildfarm (and even then, only if the case
is actually exercised in regression testing).

            regards, tom lane


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: IndexTupleDSize macro seems redundant
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] [PATCH] Generic type subscripting