Re: missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger?
Date
Msg-id 21640.1354303007@sss.pgh.pa.us
Whole thread Raw
In response to Re: missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger?  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2012-11-30 14:08:05 -0500, Tom Lane wrote:
>> BTW, I went looking for other places that might have a similar mistake.
>> I found that contrib/pageinspect/btreefuncs.c pokes around in btree
>> pages without any buffer lock, which seems pretty broken --- don't we
>> want it to take share lock?

> I seem to remember comments somewhere indicating that pageinspect (?)
> doesn't take locks by intention to make debugging of locking problems
> easier. Not sure whether thats really realistic, but ...

Dunno, that seems like a pretty lame argument when compared to the very
real possibility of crashing due to processing corrupt data.  Besides,
the heap-page examination functions in the same module take buffer lock,
so why shouldn't these?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: missing LockBuffer(buffer, BUFFER_LOCK_SHARE) in trigger.c GetTupleForTrigger?
Next
From: Simon Riggs
Date:
Subject: Re: Hot Standby Feedback should default to on in 9.3+