Re: Enumize logical replication message actions

From: Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, amit(dot)kapila16(at)gmail(dot)com
Subject: Re: Enumize logical replication message actions
Date: 2020-10-23 12:50:36
Message-ID: CAG-ACPWtdmodX9p0Xh4NRH_fA+TkU1HV_sXChnSXRuBJtDVFuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 23 Oct 2020 at 06:50, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
wrote:

>
> Those two switch()es are apparently redundant. That code is exactly
> equivalent to:
>
> apply_dispatch(s)
> {
> LogicalRepMsgType msgtype = pq_getmsgtype(s);
>
> switch (msgtype)
> {
> case LOGICAL_REP_MSG_BEGIN:
> apply_handle_begin();
> ! return;
> ...
> case LOGICAL_REP_MSG_STREAM_COMMIT:
> apply_handle_begin();
> ! return;
> }
>
> ereport(ERROR, (errmsg("invalid logical replication message type"..
> }
>
> which is smaller and fast.
>

Good idea. Implemented in the latest patch posted with the next mail.

--
Best Wishes,
Ashutosh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2020-10-23 12:51:05 Re: git clone failed in windows
Previous Message Amit Kapila 2020-10-23 12:39:46 Re: git clone failed in windows