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: 2021-03-01 10:10:43
Message-ID: CAA4eK1J=i16+DVpdkBjzgWQazYwVdcMJWQF0RAeCgLkCxm40=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 26, 2021 at 4:28 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Fri, Feb 26, 2021 at 9:56 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Thu, Feb 25, 2021 at 12:32 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> > >
> >
> > 5. You need to write/sync the spool file at prepare time because after
> > restart between prepare and commit prepared the changes can be lost
> > and won't be resent by the publisher assuming there are commits of
> > other transactions between prepare and commit prepared. For the same
> > reason, I am not sure if we can just rely on the in-memory hash table
> > for it (prepare_spoolfile_exists). Sure, if it exists and there is no
> > restart then it would be cheap to check in the hash table but I don't
> > think it is guaranteed.
> >
>
> As we can't rely on the hash table, I think we can get rid of it and
> always check if the corresponding file exists.
>

Few more related points:
====================
1. Currently, the patch will always clean up the files if there is an
error because SharedFileSetInit registers the cleanup function.
However, we want the files to be removed only if any error happens
before flushing prepare. Once prepare is flushed, we expect the file
will be cleaned up by commit prepared. So, we need to probably call
SharedFileSetUnregister after prepare has been flushed to file.

2. The other point is that I think we need to drop these files (if
any) on Drop Subscription. Investigate if any variant of Alter needs
similar handling.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2021-03-01 10:12:49 [PATCH] Add --create-only option to pg_dump/pg_dumpall
Previous Message Daniel Gustafsson 2021-03-01 10:06:40 Re: Fix DROP TABLESPACE on Windows with ProcSignalBarrier?