pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Ildar Musin <i.musin@postgrespro.ru>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: IndexTupleDSize macro seems redundant
Date: Thu, 11 Jan 2018 12:47:43 -0500
Message-ID: <8984.1515692863@sss.pgh.pa.us> (raw)
In-Reply-To: <20180111172241.GK2416@tamriel.snowman.net>
References: <0274288e-9e88-13b6-c61c-7b36928bf221@postgrespro.ru>
	<CAA4eK1+qNuT2iY+gL-yi-Sn-aj=2y7hBD3GFFRrxh6hV-U+X6w@mail.gmail.com>
	<CA+TgmoaBZi-oNU4dK-FBDeqRWijxYKc5Lne2hD7+bn+sXKuT3g@mail.gmail.com>
	<20180111172241.GK2416@tamriel.snowman.net>

Stephen Frost <sfrost@snowman.net> writes:
> I'll leave the patch status in 'Needs review' since there's more
> changes, but hopefully someone can take a look and we can move this
> along, seems like a pretty small and reasonable improvement.

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.  "Item" doesn't connote
anything about alignment (it's the same as Pointer, ie char*).  Even
though we don't do anything with items[i] except pass it as an Item
to PageAddItem, the proposed change could result in breakage, because
the compiler could take it as license to assume that "from" is aligned,
and perhaps change what it generates for the memcpy.

I think that in the other places where Stephen wants to change Item
to something else, the alignment expectation actually does hold,
so we're OK if we want to do it in those places.

			regards, tom lane




view thread (15+ messages)  latest in thread

Message-ID: <8984.1515692863@sss.pgh.pa.us>
Permalink:  ../8984.1515692863@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8984.1515692863@sss.pgh.pa.us

 · 

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sfrost@snowman.net, robertmhaas@gmail.com, amit.kapila16@gmail.com, i.musin@postgrespro.ru
  Subject: Re: IndexTupleDSize macro seems redundant
  In-Reply-To: <8984.1515692863@sss.pgh.pa.us>

* 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