Re: [HACKERS] logical decoding of two-phase transactions

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Date: 2020-11-25 09:18:24
Message-ID: CAA4eK1KxX98YXWeO5VSB57gX_V6+MmdR3gDZaQdN92smp4kTiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 25, 2020 at 12:54 PM Peter Smith <smithpb2250(at)gmail(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-11-25 09:22:21 Re: Enumize logical replication message actions
Previous Message Peter Eisentraut 2020-11-25 09:04:12 Re: [PATCH] remove pg_standby