Re: Gripes about walsender command processing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Gripes about walsender command processing
Date
Msg-id 1347966.1600195735@sss.pgh.pa.us
Whole thread Raw
In response to Re: Gripes about walsender command processing  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Sep 14, 2020 at 11:34:44PM -0400, Tom Lane wrote:
>> (I don't quite follow your comment about repslot drop, btw.)

> There is already a command tag equivalent to DROP_REPLICATION_SLOT:
> $ git grep REPLICATION -- */cmdtaglist.h
> src/include/tcop/cmdtaglist.h:PG_CMDTAG(CMDTAG_DROP_REPLICATION_SLOT,
> "DROP REPLICATION SLOT", false, false, false)

[ blink ... ]  So why is it that DropReplicationSlot does

    SetQueryCompletion(&qc, CMDTAG_DROP_REPLICATION_SLOT, 0);
    EndCommand(&qc, DestRemote, false);

when the caller will immediately after that do

    SetQueryCompletion(&qc, CMDTAG_SELECT, 0);
    EndCommand(&qc, DestRemote, true);

StartLogicalReplication has a similar weirdness.
The more I look at this code, the more broken it seems.

Anyway, independently of whether walsender should be sending multiple
command-complete messages, I don't think I really approve of including
replication commands in the CommandTag enum.  It still seems like a
type pun.  However, it looks like we'd have to duplicate
SetQueryCompletion/EndCommand if we don't want to do that, so maybe
I'd better just hold my nose and do it that way.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] [PATCH] Generic type subscripting
Next
From: Ranier Vilela
Date:
Subject: Re: Simplified version of read_binary_file (src/backend/utils/adt/genfile.c)