Re: Conflict detection and logging in logical replication - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Conflict detection and logging in logical replication
Date
Msg-id CAA4eK1K1fZyxLTDQUYEzWmH4gbsZPyM1QAFmft96g4Nds=pXSg@mail.gmail.com
Whole thread Raw
In response to Re: Conflict detection and logging in logical replication  (Michail Nikolaev <michail.nikolaev@gmail.com>)
Responses Re: Conflict detection and logging in logical replication
List pgsql-hackers
On Wed, Aug 14, 2024 at 7:45 PM Michail Nikolaev
<michail.nikolaev@gmail.com> wrote:
>
> > This is as expected, and we have documented this in the code comments. We don't
> > need to report a conflict if the conflicting tuple has been removed or updated
> > due to concurrent transaction. The same is true if the transaction that
> > inserted the conflicting tuple is rolled back before CheckAndReportConflict().
> > We don't consider such cases as a conflict.
>
> That seems a little bit strange to me.
>
> From the perspective of a user, I expect that if a change from publisher is not applied - I need to know about it
fromthe logs. 
>

In the above conditions where a concurrent tuple insertion is removed
or rolled back before CheckAndReportConflict, the tuple inserted by
apply will remain. There is no need to report anything in such cases
as apply was successful.

> But in that case, I will not see any information about conflict in the logs in SOME cases. But in OTHER cases I will
seeit. 
> However, in both cases the change from publisher was not applied.
> And these cases are just random and depend on the timing of race conditions. It is not something I am expecting from
thedatabase. 
>
> Maybe it is better to report about the fact that event from publisher was not applied because of conflict and then
tryto 
> provide additional information about the conflict itself?
>
> Or possibly in case we were unable to apply the event and not able to find the conflict, we should retry the event
processing?
>

Per my understanding, we will apply or the conflict will be logged and
retried where required (unique key violation).

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: CREATE SUBSCRIPTION - add missing test case
Next
From: Yugo Nagata
Date:
Subject: Re: define PG_REPLSLOT_DIR