Re: Enumize logical replication message actions

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-10-19T23:27:53Z
Lists: pgsql-hackers
Hi,

On 2020-10-16 12:55:26 +0530, Ashutosh Bapat wrote:
> Here's a patch simplifying that for top level logical replication
> messages.

I think that's a good plan. One big benefit for me is that it's much
easier to search for an enum than for a single letter
constant. Including searching for all the places that deal with any sort
of logical rep message type.


>  void
>  logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn)
>  {
> -	pq_sendbyte(out, 'B');		/* BEGIN */
> +	pq_sendbyte(out, LOGICAL_REP_MSG_BEGIN);		/* BEGIN */

I think if we have the LOGICAL_REP_MSG_BEGIN we don't need the /* BEGIN */.


Greetings,

Andres Freund



Commits

  1. Use Enums for logical replication message types at more places.

  2. Use Enum for top level logical replication message types.