Re: More protocol.h replacements this time into walsender.c

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Dave Cramer <davecramer@gmail.com>, Jacob Champion <jacob.champion@enterprisedb.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-04T19:56:01Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Expand usage of macros for protocol characters.

  2. Rename XLogData protocol message to WALData

  3. Use PqMsg_* macros in walsender.c

On Mon, Aug 04, 2025 at 02:31:05PM +0200, Álvaro Herrera wrote:
> +/* Replication Protocol, sent by the primary */
> +
> +#define PqReplMsg_WALData				'w'
> +#define PqReplMsg_PrimaryKeepAlive		'k'
> +#define PqReplMsg_PrimaryStatusUpdate	's'
> +
> +/* Replication Protocol, sent by the standby */
> +
> +#define PqReplMsg_StandbyStatus			'r'
> +#define PqReplMsg_HotStandbyFeedback	'h'
> +#define PqReplMsg_RequestPrimaryStatus	'p'

I know I previously +1'd a new prefix for these, but upon further review,
I'm not so sure about that.  The replication protocol uses many of the
existing PqMsg macros already, so it would be a little strange if only a
subset of the replication protocol messages used the special prefix.  And
IMO it would also be weird to duplicate all the macros used by both
protocols.  There's also backups, which use the replication protocol but
have their own special characters [0].  If we're going the prefix route,
would we add another prefix for those, or use the replication one?

[0] https://postgr.es/m/aIOkE7fgvFOu0FI_%40nathan

-- 
nathan