Re: BUG #13523: Unexplained deadlocks (possible race condition)

Поиск
Список
Период
Сортировка
От Jack Douglas
Тема Re: BUG #13523: Unexplained deadlocks (possible race condition)
Дата
Msg-id 01b001d0caa5$b8ea93e0$2abfbba0$@douglastechnology.co.uk
обсуждение исходный текст
Ответ на Re: BUG #13523: Unexplained deadlocks (possible race condition)  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
> I don't think that'd help at all? The problem here is the lock upgrade
from RowExclusiveLock to the exclusive lock, and that'll not be fixed by
that proposal?

The problem is that the RowExclusiveLock is being aquired in one session
before the Exclusive lock, even though the LOCK TABLE statement is
physically first in the SQL function.

Because the locks are being acquired out-of-order, deadlocks become possible
as another session tries to escalate the lock and waits, then the first
session tries to escalate it's own lock and deadlocks.

Normally this is prevented by acquiring the most restrictive lock first, but
with a SQL-language function (unlike plpgsql for example) this is not
possible.

This is how I understand Tom's initial reply, is that not right?

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

Предыдущее
От: "Jack Douglas"
Дата:
Сообщение: Re: BUG #13523: Unexplained deadlocks (possible race condition)
Следующее
От: Maxim Boguk
Дата:
Сообщение: Re: BUG #13528: LATERAL vs. correlated scalar subquery