Re: Enumize logical replication message actions - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Enumize logical replication message actions
Date
Msg-id CAG-ACPWtdmodX9p0Xh4NRH_fA+TkU1HV_sXChnSXRuBJtDVFuQ@mail.gmail.com
Whole thread Raw
In response to Re: Enumize logical replication message actions  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers


On Fri, 23 Oct 2020 at 06:50, Kyotaro Horiguchi <horikyota.ntt@gmail.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

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: git clone failed in windows
Next
From: Dave Page
Date:
Subject: Re: git clone failed in windows