Re: Gripes about walsender command processing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Gripes about walsender command processing
Date: 2020-09-16 22:21:08
Message-ID: 39194.1600294868@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> On 2020-Sep-16, Tom Lane wrote:
>> 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.

> The alternative of doing the assignment in each case of the same switch
> does not look too terrible:

> case T_IdentifySystemCmd:
> + cmdtag = "IDENTIFY_SYSTEM";
> + set_ps_display(cmdtag);
> IdentifySystem();
> + EndReplicationCommand(cmdtag);
> break;

> case T_BaseBackupCmd:
> + cmdtag = "BASE_BACKUP";
> + set_ps_display(cmdtag);
> PreventInTransactionBlock(true, cmdtag);
> SendBaseBackup((BaseBackupCmd *) cmd_node);
> + EndReplicationCommand(cmdtag);
> break;

Yeah, that works for me. It doesn't allow for having just one
set_ps_display() call ahead of the switch, but that isn't that
big a loss. We cannot merge the EndReplicationCommand calls to
after the switch, because some of the cases don't want one here;
so that partial duplication is inescapable.

Note that your changes need to be backpatched into v13,
because AFAICS this code is violating the FE/BE protocol
right now --- it's just luck that libpq isn't moaning
about extra CommandComplete messages. But I don't think
we want to change the ps title behavior in v13 at this
late date, so that part should be HEAD-only.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-09-16 22:46:14 Re: Gripes about walsender command processing
Previous Message David G. Johnston 2020-09-16 22:20:00 Re: DROP relation IF EXISTS Docs and Tests - Bug Fix