pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use Enum for top level logical replication message types.
Date: Mon, 02 Nov 2020 02:57:47 +0000
Message-ID: <E1kZQ2V-0007DE-93@gemulon.postgresql.org> (raw)

Use Enum for top level logical replication message types.

Logical replication protocol uses a single byte character to identify a
message type in logical replication protocol. The code uses string
literals for the same. Use Enum so that

1. All the string literals used can be found at a single place. This
makes it easy to add more types without the risk of conflicts.

2. It's easy to locate the code handling a given message type.

3. When used with switch statements, it is easy to identify the missing
cases using -Wswitch.

Author: Ashutosh Bapat
Reviewed-by: Kyotaro Horiguchi, Andres Freund, Peter Smith and Amit Kapila
Discussion: https://postgr.es/m/CAExHW5uPzQ7L0oAd_ENyvaiYMOPgkrAoJpE+ZY5-obdcVT6NPg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/644f0d7cc9c2cb270746f2024c706554e0fbec82

Modified Files
--------------
src/backend/replication/logical/proto.c  | 26 +++++-----
src/backend/replication/logical/worker.c | 87 ++++++++++++++++----------------
src/include/replication/logicalproto.h   | 27 ++++++++++
3 files changed, 83 insertions(+), 57 deletions(-)



Message-ID: <E1kZQ2V-0007DE-93@gemulon.postgresql.org>
Permalink:  ../E1kZQ2V-0007DE-93@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kZQ2V-0007DE-93@gemulon.postgresql.org

 · 

reply

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: akapila@postgresql.org
  Subject: Re: pgsql: Use Enum for top level logical replication message types.
  In-Reply-To: <E1kZQ2V-0007DE-93@gemulon.postgresql.org>
  References: <E1kZQ2V-0007DE-93@gemulon.postgresql.org>

* 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