mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Fix bogus completion tag usage in walsender
Since commitfd5942c18f
(2012, 9.3-era), walsender has been sending completion tags for certain replication commands twice -- and they're not even consistent. Apparently neither libpq nor JDBC have a problem with it, but it's not kosher. Fix by remove the EndCommand() call in the common code path for them all, and inserting specific calls to EndReplicationCommand() specifically in those places where it's needed. EndReplicationCommand() is a new simple function to send the completion tag for replication commands. Do this instead of sending a generic SELECT completion tag for them all, which was also pretty bogus (if innocuous). While at it, change StartReplication() to use EndReplicationCommand() instead of pg_puttextmessage(). In commit2f9661311b
, I failed to realize that replication commands are not close-enough kin of regular SQL commands, so the DROP_REPLICATION_SLOT tag I added is undeserved and a type pun. Take it out. Backpatch to 13, where the latter commit appeared. The duplicate tag has been sent since 9.3, but since nothing is broken, it doesn't seem worth fixing. Per complaints from Tom Lane. Discussion: https://postgr.es/m/1347966.1600195735@sss.pgh.pa.us
This commit is contained in:
@@ -211,6 +211,18 @@ EndCommand(const QueryCompletion *qc, CommandDest dest, bool force_undecorated_o
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* EndReplicationCommand - stripped down version of EndCommand
|
||||
*
|
||||
* For use by replication commands.
|
||||
* ----------------
|
||||
*/
|
||||
void
|
||||
EndReplicationCommand(const char *commandTag)
|
||||
{
|
||||
pq_putmessage('C', commandTag, strlen(commandTag) + 1);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* NullCommand - tell dest that an empty query string was recognized
|
||||
*
|
||||
|
Reference in New Issue
Block a user