Re: Sync Rep v17 - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Sync Rep v17
Date
Msg-id 1299003507.1974.0.camel@ebony
Whole thread Raw
In response to Re: Sync Rep v17  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, 2011-03-01 at 10:02 -0500, Tom Lane wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
> > On Tue, 2011-03-01 at 15:51 +0900, Fujii Masao wrote:
> >> A spinlock can be used only for very short-term operation like
> >> read/write of some shared-variables. The operation on the queue
> >> is not short, so should be protected by LWLock, I think.
> 
> > There's no need to sleep while holding locks and the operations are very
> > short in most cases. The code around it isn't trivial, but that's no
> > reason to use LWlocks.
> 
> What does "in most cases" mean?
> 
> > LWlocks are just spinlocks plus sem sleeps, so I don't see the need for
> > that in the current code. Other views welcome.
> 
> Simon, that is absolutely NOT acceptable.  Spinlocks are to be used only
> for short straight-line code segments.  If the lock has any potential to
> be held for more than nanoseconds, use an LWLock.  The contention costs
> of the shortcut you propose are too high.

No problem to change.

-- Simon Riggs           http://www.2ndQuadrant.com/books/PostgreSQL Development, 24x7 Support, Training and Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Is the attribute options cache actually worth anything?
Next
From: Robert Haas
Date:
Subject: Re: Is the attribute options cache actually worth anything?