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

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(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-25 02:40:28
Message-ID: CAHut+PsO=Lz4+jp+xqAKC1K2Y6TM9rCz9WaEHEy6u_xWqQwvLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 24, 2021 at 11:31 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Mar 23, 2021 at 3:31 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > On Tue, Mar 23, 2021 at 10:44 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> > >
> > > PSA patches to fix those.
> > >
> >
> > Hi Amit.
> >
> > PSA a patch to allow the ALTER SUBSCRIPTION ... REFRESH PUBLICATION to
> > work when two-phase tristate is PENDING.
> >
> > This is necessary for the pg_dump/pg_restore scenario, or for any
> > other use-case where the subscription might
> > start off having no tables.
> >
>
> + subrels = GetSubscriptionRelations(MySubscription->oid);
> +
> + /*
> + * If there are no tables then leave the state as PENDING, which
> + * allows ALTER SUBSCRIPTION ... REFRESH PUBLICATION to work.
> + */
> + become_two_phase_enabled = list_length(subrels) > 0;
>
> This code is similar at both the places it is used. Isn't it better to
> move this inside AllTablesyncsReady and if required then we can change
> the name of the function.

I agree. That way is better.

PSA a patch which changes the AllTableSyncsReady function to now
include the zero tables check.

(This patch is to be applied on top of all previous patches)

------
Kind Regards,
Peter Smith.
Fujitsu Australia.

Attachment Content-Type Size
v66-0005-Change-AllTablesyncsReady-to-return-false-when-0.patch application/octet-stream 5.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiro Ikeda 2021-03-25 02:50:12 Re: About to add WAL write/fsync statistics to pg_stat_wal view
Previous Message Julien Rouhaud 2021-03-25 02:36:38 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?