Re: Enumize logical replication message actions

From: Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Enumize logical replication message actions
Date: 2020-10-23 12:55:57
Message-ID: CAG-ACPWiWoDsCSVZ5u46xaF_1WnTGnf5Lf4aTUYLxxnHuZLSxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 23 Oct 2020 at 18:23, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> On Fri, Oct 23, 2020 at 11:50 AM Kyotaro Horiguchi
> <horikyota(dot)ntt(at)gmail(dot)com> wrote:
> >
> > At Thu, 22 Oct 2020 22:31:41 -0300, Alvaro Herrera <
> alvherre(at)alvh(dot)no-ip(dot)org> wrote in
> > > On 2020-Oct-22, Ashutosh Bapat wrote:
> > >
> > > > On Thu, 22 Oct 2020 at 14:46, Kyotaro Horiguchi <
> horikyota(dot)ntt(at)gmail(dot)com>
> > > > wrote:
> > >
> > > > > pg_send_logicalrep_msg_type() looks somewhat too-much. If we need
> > > > > something like that we shouldn't do this refactoring, I think.
> > > >
> > > > Enum is an integer, and we want to send byte. The function asserts
> that the
> > > > enum fits a byte. If there's a way to declare byte long enums I
> would use
> > > > that. But I didn't find a way to do that.
> > >
> > > I didn't look at the code, but maybe it's sufficient to add a
> > > StaticAssert?
> >
> > That check needs to visit all symbols in a enum and confirm that each
> > of them is in a certain range.
> >
>
> Can we define something like LOGICAL_REP_MSG_LAST (also add a comment
> indicating this is a fake message and must be the last one) as the
> last and just check that?
>
>
I don't think that's required once I applied suggestions from Kyotaro and
Peter. Please check the latest patch.
Usually LAST is added to an enum when we need to cap the number of symbols
or want to find the number of symbols. None of that is necessary here. Do
you see any other use?

--
Best Wishes,
Ashutosh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2020-10-23 13:28:04 Re: Parallel copy
Previous Message Amit Kapila 2020-10-23 12:53:52 Re: Enumize logical replication message actions