Re: Reducing overhead of frequent table locks

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: Reducing overhead of frequent table locks
Дата
Msg-id 20110527215036.GA7188@tornado.gateway.2wire.net
обсуждение исходный текст
Ответ на Re: Reducing overhead of frequent table locks  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Fri, May 27, 2011 at 04:55:07PM -0400, Robert Haas wrote:
> When a strong lock is taken or released, we have to increment or
> decrement strong_lock_counts[fasthashpartition].  Here's the question:
> is that atomic?  In other words, suppose that strong_lock_counts[42]
> starts out at 0, and two backends both do ++strong_lock_counts[42].
> Are we guaranteed to end up with "2" in that memory location or might
> we unluckily end up with "1"?  I think the latter is possible... and
> some guard is needed to make sure that doesn't happen.

Yeah: what Tom said.  Guard it with a spinlock?  Given that the backend is about
to (or did earlier) go off and acquire dozens or hundreds of LWLocks, it doesn't
seem like an area begging for early optimization.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "David E. Wheeler"
Дата:
Сообщение: Re: storing TZ along timestamps
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: minor patch submission: CREATE CAST ... AS EXPLICIT