From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Amit Kapila <akapila@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Raise a warning if there is a possibility of data from multiple
Date: Thu, 8 Sep 2022 18:07:32 +0900
Message-ID: <CAD21AoAC9ELmteDHCCBjdHA0dRJbONdABafi1gOXUbio2LU52w@mail.gmail.com> (raw)
In-Reply-To: <CAA4eK1+Eta6demE4+xCGzRtjrd2K653e5D4CgBNMySp8i0nLjQ@mail.gmail.com>
References: <E1oW6W1-001vgA-TP@gemulon.postgresql.org>
<CAD21AoDxqUc3kRfGaKC9-UsUW54mJ7iY2uy_76t0aTkQ=LikOA@mail.gmail.com>
<CAA4eK1+Eta6demE4+xCGzRtjrd2K653e5D4CgBNMySp8i0nLjQ@mail.gmail.com>
On Thu, Sep 8, 2022 at 4:23 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Thu, Sep 8, 2022 at 12:22 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> >
> > On Thu, Sep 8, 2022 at 10:39 AM Amit Kapila <akapila@postgresql.org> wrote:
> > >
> > > Raise a warning if there is a possibility of data from multiple origins.
> > >
> > > This commit raises a warning message for a combination of options
> > > ('copy_data = true' and 'origin = none') during CREATE/ALTER subscription
> > > operations if the publication tables were also replicated from other
> > > publishers.
> > >
> > > During replication, we can skip the data from other origins as we have that
> > > information in WAL but that is not possible during initial sync so we raise
> > > a warning if there is such a possibility.
> > >
> > > Author: Vignesh C
> > > Reviewed-By: Peter Smith, Amit Kapila, Jonathan Katz, Shi yu, Wang wei
> > > Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail...
> > >
> > > Branch
> > > ------
> > > master
> > >
> > > Details
> > > -------
> > > https://git.postgresql.org/pg/commitdiff/875693019053b8897ec3983e292acbb439b088c3
> > >
> > > Modified Files
> > > --------------
> > > doc/src/sgml/ref/alter_subscription.sgml | 5 ++
> > > doc/src/sgml/ref/create_subscription.sgml | 35 ++++++++
> > > src/backend/commands/subscriptioncmds.c | 133 ++++++++++++++++++++++++++++--
> > > src/test/subscription/t/030_origin.pl | 114 +++++++++++++++++++------
> > > 4 files changed, 258 insertions(+), 29 deletions(-)
> >
> > + appendStringInfoString(&cmd,
> > + "SELECT DISTINCT
> > P.pubname AS pubname\n"
> > + "FROM pg_publication P,\n"
> > + " LATERAL
> > pg_get_publication_tables(P.pubname) GPT\n"
> > + " JOIN
> > pg_subscription_rel PS ON (GPT.relid = PS.srrelid),\n"
> > + " pg_class C
> > JOIN pg_namespace N ON (N.oid = C.relnamespace)\n"
> > + "WHERE C.oid =
> > GPT.relid AND P.pubname IN (");
> >
> > Should the tables and the function in this query be schema-qualified?
> > Looking at other code in subscriptioncmd.c, we use schema-qualified
> > names. It works even without the schema names but it may be better to
> > make them consistent.
> >
> > FYI, looking at tablesync.c, there are both styles; it seems that
> > recently added codes use schema-unqualified names.
> >
>
> Yeah, it is better to be consistent in all places and add a schema
> name before accessing an object rather than for one or two places. Do
> we need similar handling for pg_dump code as well, see
> getPublications()?
We can fix at least getPublications() and getSubscriptions() as well.
I'll make a patch for that. Or do you want to fix all of them,
including non-logical-replication-related ones?
Regards,
--
Masahiko Sawada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: sawada.mshk@gmail.com, amit.kapila16@gmail.com, akapila@postgresql.org
Subject: Re: pgsql: Raise a warning if there is a possibility of data from multiple
In-Reply-To: <CAD21AoAC9ELmteDHCCBjdHA0dRJbONdABafi1gOXUbio2LU52w@mail.gmail.com>
References: <E1oW6W1-001vgA-TP@gemulon.postgresql.org> <CAD21AoDxqUc3kRfGaKC9-UsUW54mJ7iY2uy_76t0aTkQ=LikOA@mail.gmail.com> <CAA4eK1+Eta6demE4+xCGzRtjrd2K653e5D4CgBNMySp8i0nLjQ@mail.gmail.com> <CAD21AoAC9ELmteDHCCBjdHA0dRJbONdABafi1gOXUbio2LU52w@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox