Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
Дата
Msg-id CAApHDvpXSQ5-=G-bCTYCVNr6EFwdLHJt5ydrN8X14SJds0VzYA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?  (Dmitry Koval <d.koval@postgrespro.ru>)
Список pgsql-bugs
On Fri, 7 Jun 2024 at 20:58, David Rowley <dgrowleyml@gmail.com> wrote:
> s1: create table t ();
> s1: begin;
> s2: begin;
> s1: lock table t in access share mode;
> s2: lock table t in access share mode;
> s1: lock table t in access exclusive mode;
> s2: lock table t in access exclusive mode; -- deadlock
>
> Isn't this more or less the same as what's going on in your scenario?

I didn't explain why this needs to happen...  s1 can't get the AEL on
"t" because it's blocked by s2's share lock. Subsequently, s2 then
must wait on s1's AEL request and that creates a deadlock cycle that
needs to be broken.

David



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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
Следующее
От: Etsuro Fujita
Дата:
Сообщение: Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption