Re: Logical replication can be broken by domain constraint with NOT VALID option

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Logical replication can be broken by domain constraint with NOT VALID option
Дата
Msg-id 29155.1572795733@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Logical replication can be broken by domain constraint with NOT VALIDoption  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Ответы Re: Logical replication can be broken by domain constraint with NOTVALID option  (Andrey Lepikhov <a.lepikhov@postgrespro.ru>)
Список pgsql-bugs
Andrey Lepikhov <a.lepikhov@postgrespro.ru> writes:
> During patch development I ran into a small problem (see attachment, 
> fail_replication.sh):
> 1. We have a table with logical replication to another node.
> 2. On the master and replica add such "NOT VALID" domain constraint on 
> the table  that some tuples  violates the constraint.
> 3. UPDATE the table: set value of the tuple that violates constraint to 
> correct value.
> 4. That's all!

> The reason for this problem is that on UPDATE walsender sends old tuple 
> value (that violates the constraint) with new version (satisfied the 
> constraint).
> Replication worker at replica node restores slot from transfer 
> representation. During this process domain checking constraint and 
> returns an ERROR.

I'm not sure this is something we should attempt to fix.  There are
an infinite number of ways you can break logical replication by
presenting it with inconsistent data, and that's really what you've
done here.

> This problem can be solved by many ways and approaches. I wrote the 
> patch to solve this problem (see in attachment) by the shortest way.

That patch is certainly utterly unacceptable.  It'd allow the
receipient to accept data that violates the domain constraint.

The situation you're describing would probably best be handled by
not adding the constraint on the replica side until all the
bad data has been corrected (and replicated).

            regards, tom lane



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

Предыдущее
От: Manuel Rigger
Дата:
Сообщение: Re: ALTER TABLE results in "ERROR: could not open relation with OID 43707388"
Следующее
От: Andrey Lepikhov
Дата:
Сообщение: Re: Logical replication can be broken by domain constraint with NOTVALID option