Re: Allow logical replication to copy tables in binary format

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, "Takamichi Osumi (Fujitsu)" <osumi(dot)takamichi(at)fujitsu(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow logical replication to copy tables in binary format
Date: 2023-03-01 11:16:45
Message-ID: CAFiTN-sSxrnyU-NWX34A=wBiPQnSnopiuZNy9xUJBSenptLRdw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 27, 2023 at 2:31 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Mon, Feb 20, 2023 at 3:37 PM shiy(dot)fnst(at)fujitsu(dot)com
> <shiy(dot)fnst(at)fujitsu(dot)com> wrote:
> >
> > On Thu, Feb 16, 2023 8:48 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > >
> > > So, doesn't this mean that there is no separate failure mode during
> > > the initial copy? I am clarifying this to see if the patch really
> > > needs a separate copy_format option for initial sync?
> > >
> >
> > In the case that the data type doesn't have binary output function, for apply
> > phase, the column will be sent in text format (see logicalrep_write_tuple()) and
> > it works fine. But with copy_format = binary, the walsender exits with an
> > error.
> >
> ...
> ...
> >
> > Then I got the following error in the publisher log.
> >
> > walsender ERROR: no binary output function available for type public.myvarchar
> > walsender STATEMENT: COPY public.tbl1 (a) TO STDOUT WITH (FORMAT binary)
> >
>
> Thanks for sharing the example. I think to address this user can
> create a SUBSCRIPTION with 'binary = false' and then after the initial
> copy enables it with ALTER SUBSCRIPTION. Personally, I feel it is not
> required to have a separate option to allow copy in binary mode. Note,
> where there is some use for it but having more options for similar
> work is also confusing as users need to pay attention to different
> options and their values. It won't be difficult to add such an option
> in the future if we see such cases and or users specifically require
> something like this.

I agree with this thought, basically adding an extra option will
always complicate things for the user. And logically it doesn't make
much sense to copy data in text mode and then stream in binary mode
(except in some exception cases and for that, we can always alter the
subscription). So IMHO it makes more sense that if the binary option
is selected then ideally it should choose to do the initial sync also
in the binary mode.

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-03-01 11:46:42 Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Previous Message Pavel Luzanov 2023-03-01 10:55:13 Re: psql: Add role's membership options to the \du+ command