Re: Sync Rep v17
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Simon Riggs <simon@2ndquadrant.com>, Fujii Masao <masao.fujii@gmail.com>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>, pgsql-hackers@postgresql.org, Daniel Farina <daniel@heroku.com>
Date: 2011-03-01T15:15:53Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes: > On Tue, Mar 1, 2011 at 3:21 AM, Simon Riggs <simon@2ndquadrant.com> wrote: >> LWlocks are just spinlocks plus sem sleeps, so I don't see the need for >> that in the current code. Other views welcome. > An LWLock is a lot safer, in general, than a spinlock. A spinlock > mustn't do anything that could emit an error or abort (among other > things). I doubt that the performance cost of using an LWLock rather > than a spin lock here is enough to matter, and the spin lock seems > more likely to result in hard-to-find bugs. Well, stuck spinlocks aren't exactly hard to identify. But I agree that the lack of any release-on-error infrastructure is a killer reason not to use a spinlock for anything but short straight-line code segments. regards, tom lane