Re: postgresql locks the whole table!

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: postgresql locks the whole table!
Дата
Msg-id 20031207110323.N86550@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Re: postgresql locks the whole table!  (Greg Stark <gsstark@mit.edu>)
Ответы Re: postgresql locks the whole table!
Список pgsql-general
On Sun, 7 Dec 2003, Greg Stark wrote:

> It's not strictly necessary to have a list of all xids at all. The normal
> "shared read lock" is just "take the write lock, increment the readers
> counter, unlock" Anyone who wants to write has to wait (using, eg, a condition
> variable) until the readers count goes to 0.

There are some storage/cleanup questions though. If that's stored in the
tuple header, what happens after a crash?

In addition, how should the locks be granted for a sequence like:
 T1: get shared lock on row A
 T2: get exclusive lock on row A
 T3: get shared lock on row A
Does T3 get the lock or not? If it does, then you have the possibility of
freezing out T2 for a very long time and badly hurting update/delete
performance. If it doesn't, then how are you keeping track of the fact
that there are one or more people who want exclusive locks on the same
row that are "in front" of you?

> This gets the right semantics but without the debugging info of a list of
> lockers. Other than debugging the only advantage I see to having the list of
> lockers is for deadlock detection. Is that absolutely mandatory?

I think so, yes, especially if we're going to use it for things like
foreign keys.  It's too easy to get into a deadlock with foreign keys
(even when implemented through shared locks) and I think having undetected
deadlocks would be even worse than our current behavior.  At least with
the current behavior you get an indication that something is wrong.

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

Предыдущее
От: Mike Mascari
Дата:
Сообщение: Re: postgresql locks the whole table!
Следующее
От: Tom Lane
Дата:
Сообщение: Re: postgresql locks the whole table!