Re: [HACKERS] logical decoding of two-phase transactions - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: [HACKERS] logical decoding of two-phase transactions
Date
Msg-id CAA4eK1KxX98YXWeO5VSB57gX_V6+MmdR3gDZaQdN92smp4kTiw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] logical decoding of two-phase transactions  (Peter Smith <smithpb2250@gmail.com>)
List pgsql-hackers
On Wed, Nov 25, 2020 at 12:54 PM Peter Smith <smithpb2250@gmail.com> wrote:
>
> Hi Amit.
>
> IIUC the tablesync worker runs in a single transaction.
>
> Last week I discovered and described [1] a problem where/if (by
> unlucky timing) the tablesync worker gets to handle the 2PC PREPARE
> TRANSACTION then that whole single tx is getting committed, regardless
> that a COMMIT PREPARED was not even been executed yet. i.e. It means
> if the publisher subsequently does a ROLLBACK PREPARED then the table
> records on Pub/Sub nodes will no longer be matching.
>
> AFAIK this is a new problem for the current WIP patch because prior to
> this the PREPARE had no decoding.
>
> Please let me know if this issue description is still not clear.
>
> Did you have any thoughts how we might address this issue?
>

I think we need to disable two_phase_commit for table sync workers. We
anyway wanted to expose a parater via subscription for that and we can
use that to do it. Also, there were some other comments [1] related to
tablesync worker w.r.t prepared transactions which would possibly be
addressed by doing it. Kindly check those comments [1] and let me know
if anything additional is required.

[1] - https://www.postgresql.org/message-id/87zhxrwgvh.fsf%40ars-thinkpad

-- 
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] remove pg_standby
Next
From: Amit Kapila
Date:
Subject: Re: Enumize logical replication message actions