User-assigned LWLocks (was Re: Announcing Veil)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема User-assigned LWLocks (was Re: Announcing Veil)
Дата
Msg-id 7990.1128716486@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Announcing Veil  (Marc Munro <marc@bloodnok.com>)
Ответы Re: User-assigned LWLocks (was Re: Announcing Veil)  (Marc Munro <marc@bloodnok.com>)
Список pgsql-hackers
Marc Munro <marc@bloodnok.com> writes:
> Thanks for this.  I am very happy that this patch will be going in.
> Thanks also for pointing out the correct header to use.

Patch applied for 8.1.

> As Tom points out, this will do nothing for users of 7.4 and 8.0.  For
> these versions I propose to continue to use MMCacheLock.  As far as I
> can see, this is safe in 7.4, and otherwise unused in 8.0.

Yeah, MMCacheLock is for long-dead code, so you can probably get away
with using it in the back versions.

> On the use of LWLockAssign():can anyone tell me if I should protect the
> call using the ShmemLock spinlock?

Hmm ... the comment for LWLockAssign is not meant to imply that the
caller could do that; in the event of being out of LWLocks, the code
would elog(FATAL) without releasing the spinlock, which would lock up
the whole database.  If we were to do it that way we'd need the spinlock
handling to be done inside LWLockAssign.  This would not be that bad,
just a marginal slowdown during database startup, but given the low
demand for this feature I'm not very eager to do it.

The alternative though would seem to be to adopt some convention about
another LWLock to take while trying to assign a new LWLock post-startup.
None of the existing locks seem very appropriate for this, and putting
the responsibility on callers might be unwise anyway.

Thoughts?
        regards, tom lane


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

Предыдущее
От: "Jonah H. Harris"
Дата:
Сообщение: Oracle buys Innobase
Следующее
От: "Luke Lonergan"
Дата:
Сообщение: Re: Oracle buys Innobase