Re: Skipping logical replication transactions on subscriber side

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com>, Alexey Lesovsky <lesovsky(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Greg Nancarrow <gregn4422(at)gmail(dot)com>
Subject: Re: Skipping logical replication transactions on subscriber side
Date: 2021-09-24 13:18:16
Message-ID: CAD21AoACywmnBKDsWN7BSwMTO_8NO3=xb96HFS=3QSHQTg+Krg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 24, 2021 at 5:53 PM houzj(dot)fnst(at)fujitsu(dot)com
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Tuesday, September 21, 2021 12:53 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > I've attached the updated version patches. Please review them.
>
> Thanks for updating the patch,
> here are a few comments on the v14-0001 patch.

Thank you for the comments!

>
> 1)
> + hash_ctl.keysize = sizeof(Oid);
> + hash_ctl.entrysize = sizeof(SubscriptionRelState);
> + not_ready_rels_htab = hash_create("not ready relations in subscription",
> + 64,
> + &hash_ctl,
> + HASH_ELEM | HASH_BLOBS);
> +
>
> ISTM we can pass list_length(not_ready_rels_list) as the nelem to hash_create.

As Amit pointed out, it seems not necessary to build a temporary hash
table for this purpose.

>
> 2)
>
> + /*
> + * Search for all the dead subscriptions and error entries in stats
> + * hashtable and tell the stats collector to drop them.
> + */
> + if (subscriptionHash)
> + {
> ...
> + HTAB *htab;
> +
>
> It seems we already delacre a "HTAB *htab;" in function pgstat_vacuum_stat(),
> can we use the existing htab here ?

Right. Will remove it.

>
>
> 3)
>
> PGSTAT_MTYPE_RESETREPLSLOTCOUNTER,
> + PGSTAT_MTYPE_SUBSCRIPTIONERR,
> + PGSTAT_MTYPE_SUBSCRIPTIONERRRESET,
> + PGSTAT_MTYPE_SUBSCRIPTIONERRPURGE,
> + PGSTAT_MTYPE_SUBSCRIPTIONPURGE,
> PGSTAT_MTYPE_AUTOVAC_START,
>
> Can we append these values at the end of the Enum struct which won't affect the
> other Enum values.

Yes, I'll move them to the end of the Enum struct.

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-09-24 13:25:09 Re: Column Filtering in Logical Replication
Previous Message Masahiko Sawada 2021-09-24 13:16:09 Re: Skipping logical replication transactions on subscriber side