Re: Failure while inserting parent tuple to B-tree is not fun - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Failure while inserting parent tuple to B-tree is not fun
Date
Msg-id CAM3SWZTORu0L2AdUGSk9KMOtW3vCqCb14vjfDTHTwYEracYcQA@mail.gmail.com
Whole thread Raw
In response to Re: Failure while inserting parent tuple to B-tree is not fun  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: Failure while inserting parent tuple to B-tree is not fun  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
On Fri, Jan 31, 2014 at 9:09 AM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> I refactored the loop in _bt_moveright to, well, not have that bug anymore.
> The 'page' and 'opaque' pointers are now fetched at the beginning of the
> loop. Did I miss something?

I think so, yes. You still aren't assigning the value returned by
_bt_getbuf() to 'buf'. Since, as I mentioned, _bt_finish_split()
ultimately unlocks *and unpins*, it may not be the same buffer as
before, so even with the refactoring there are race conditions. A
closely related issue is that you haven't mentioned anything about
buffer pins/refcount side effects in comments above
_bt_finish_split(), even though I believe you should.

A minor stylistic concern is that I think it would be better to only
have one pair of _bt_finish_split()/_bt_getbuf() calls regardless of
the initial value of 'access'.


-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Gurjeet Singh
Date:
Subject: Proposing pg_hibernate
Next
From: Tom Lane
Date:
Subject: Re: should we add a XLogRecPtr/LSN SQL type?