pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Gripes about walsender command processing
Date: Wed, 16 Sep 2020 12:44:29 -0400
Message-ID: <1633417.1600274669@sss.pgh.pa.us> (raw)
In-Reply-To: <20200916163633.GA9907@alvherre.pgsql>
References: <20200916163633.GA9907@alvherre.pgsql>

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2020-Sep-15, Alvaro Herrera wrote:
>> I overlooked this in 2f9661311b83.  From this perspective, I agree it
>> looks wrong.  We still have to send *some* completion tag (the 'C'
>> message), but maybe we can invent a separate entry point in dest.c for
>> that -- EndReplicationCommand() or some such -- that takes values from a
>> separate enum?

> It seems simpler than that actually; we don't need to build a lot of
> infrastructure.

This looks moderately reasonable to me.  However, with the process
title reporting I want to add, we're going to end up with a switch
that looks like

 		case T_IdentifySystemCmd:
+			set_ps_display("IDENTIFY_SYSTEM");
 			IdentifySystem();
+			EndReplicationCommand("IDENTIFY_SYSTEM");
 			break;
 
 		case T_BaseBackupCmd:
+			set_ps_display("BASE_BACKUP");
 			PreventInTransactionBlock(true, "BASE_BACKUP");
 			SendBaseBackup((BaseBackupCmd *) cmd_node);
+			EndReplicationCommand("BASE_BACKUP");
 			break;

which is starting to look a bit repetitive and copy-pasteo-prone.
I don't see an easy way to improve on it though.  The only obvious
alternative would be to put another switch before the main one that
just fills a "const char *cmdtag" variable, but that seems ugly.

			regards, tom lane





view thread (16+ messages)  latest in thread

Message-ID: <1633417.1600274669@sss.pgh.pa.us>
Permalink:  ../1633417.1600274669@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1633417.1600274669@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, michael@paquier.xyz, pgsql-hackers@lists.postgresql.org
  Subject: Re: Gripes about walsender command processing
  In-Reply-To: <1633417.1600274669@sss.pgh.pa.us>

* 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