Re: "ERROR: deadlock detected" when replicating TRUNCATE

Поиск
Список
Период
Сортировка
От Dilip Kumar
Тема Re: "ERROR: deadlock detected" when replicating TRUNCATE
Дата
Msg-id CAFiTN-tbL_HCKXW1fAY06bHET=YZuYve50OcompA7k4Au-KVjg@mail.gmail.com
обсуждение исходный текст
Ответ на "ERROR: deadlock detected" when replicating TRUNCATE  (Peter Smith <smithpb2250@gmail.com>)
Ответы Re: "ERROR: deadlock detected" when replicating TRUNCATE  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
On Mon, May 17, 2021 at 12:30 PM Peter Smith <smithpb2250@gmail.com> wrote:

> The essence of the trouble seems to be that the apply_handle_truncate
> function never anticipated it may end up truncating the same table
> from 2 separate workers (subscriptions) like this test case is doing.
> Probably this is quite an old problem because the
> apply_handle_truncate code has not changed much for a long time. The
> code of apply_handle_truncate function (worker.c) has a very similar
> pattern to the ExecuteTruncate function (tablecmds.c) but the
> ExecuteTruncate is using a more powerful AcccessExclusiveLock than the
> apply_handle_truncate was using.

Right, that's a problem.

>
> PSA a patch to make the apply_handle_truncate use AccessExclusiveLock
> same as the ExecuteTruncate function does.

I think the fix makes sense to me.

> PSA a patch adding a test for this scenario.

I am not sure this test case is exactly targeting the problematic
behavior because that will depends upon the order of execution of the
apply workers right?

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: "houzj.fnst@fujitsu.com"
Дата:
Сообщение: RE: making update/delete of inheritance trees scale better
Следующее
От: "tanghy.fnst@fujitsu.com"
Дата:
Сообщение: RE: "ERROR: deadlock detected" when replicating TRUNCATE