Re: [BUG?] check_exclusion_or_unique_constraint false negative

Поиск
Список
Период
Сортировка
От Michail Nikolaev
Тема Re: [BUG?] check_exclusion_or_unique_constraint false negative
Дата
Msg-id CANtu0og=5v4j8onS4nyJ4zMPdh-EPFxmiEi5PLoyZrmqHA6RKw@mail.gmail.com
обсуждение исходный текст
Ответ на RE: [BUG?] check_exclusion_or_unique_constraint false negative  ("Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>)
Ответы Re: [BUG?] check_exclusion_or_unique_constraint false negative
Список pgsql-hackers
Hello, Hayato!

> Thanks for pointing out the issue!

Thanks for your attention!

> IIUC, the issue can happen when two concurrent transactions using DirtySnapshot access
> the same tuples, which is not specific to the parallel apply

Not exactly, it happens for any DirtySnapshot scan over a B-tree index with some other transaction updating the same index page (even using the MVCC snapshot).

So, logical replication related scenario looks like this:

* subscriber worker receives a tuple update\delete from the publisher
* it calls RelationFindReplTupleByIndex to find the tuple in the local table
* some other transaction updates the tuple in the local table (on subscriber side) in parallel
* RelationFindReplTupleByIndex may not find the tuple because it uses DirtySnapshot
* update\delete is lost

Parallel apply mode looks like more dangerous because it uses multiple workers on the subscriber side, so the probability of the issue is higher.
In that case, "some other transaction" is just another worker applying changes of different transaction in parallel.

Best regards,
Mikhail.
 

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