Re: Pinning a buffer in TupleTableSlot is unnecessary - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Pinning a buffer in TupleTableSlot is unnecessary
Date
Msg-id 20161114181729.i5wxe3trlf4cjnkz@alap3.anarazel.de
Whole thread Raw
In response to Re: Pinning a buffer in TupleTableSlot is unnecessary  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Pinning a buffer in TupleTableSlot is unnecessary
List pgsql-hackers
On 2016-11-14 13:12:28 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2016-11-14 12:32:53 -0500, Tom Lane wrote:
> >> Basically my concern is that this restriction isn't documented anywhere
> >> and I'm not entirely certain it's been adhered to everywhere.  I'd feel
> >> much better about it if there were some way we could verify that.
> 
> > Would support for valgrind complaining about access to unpinned buffers
> > suffice?
> 
> I don't think it directly addresses the issue, but certainly it'd help.

Well, it detects situations where removed pins cause "unprotected
access", but of course that doesn't protect against cases where
independent pins hide that issue.


> Do you think that's easily doable?

I think so, yes. IIRC I discussed it with Noah and Peter G. at a
conference recently. We'd basically mark the content of shared buffers
inaccessible at backend startup, and mark it accessible whenever a
PinBuffer() happens, and then inaccessible during unpinning. We probably
have to exclude the page header though, as we intentionally access them
unpinned in some cases IIRC.

- Andres



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Pinning a buffer in TupleTableSlot is unnecessary
Next
From: Peter Geoghegan
Date:
Subject: Re: Pinning a buffer in TupleTableSlot is unnecessary