pgsql: Restore replication protocol's duplicate command tags

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Restore replication protocol's duplicate command tags
Date: 2020-10-14 23:16:27
Message-ID: E1kSq0R-0004Mm-2S@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Restore replication protocol's duplicate command tags

I removed the duplicate command tags for START_REPLICATION inadvertently
in commit 07082b08cc5d, but the replication protocol requires them. The
fact that the replication protocol was broken was not noticed because
all our test cases use an optimized code path that exits early, failing
to verify that the behavior is correct for non-optimized cases. Put
them back.

Also document this protocol quirk.

Add a test case that shows the failure. It might still succeed even
without the patch when run on a fast enough server, but it suffices to
show the bug in enough cases that it would be noticed in buildfarm.

Author: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reported-by: Henry Hinze <henry(dot)hinze(at)gmail(dot)com>
Reviewed-by: Petr Jelínek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Discussion: https://postgr.es/m/16643-eaadeb2a1a58d28c@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4e9821b6fac5042e872d5397f711a67984b165f8

Modified Files
--------------
doc/src/sgml/protocol.sgml | 8 +++--
src/backend/replication/logical/worker.c | 1 -
src/backend/replication/walsender.c | 3 +-
src/test/subscription/t/100_bugs.pl | 55 +++++++++++++++++++++++++++++++-
4 files changed, 61 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2020-10-15 00:36:54 Re: pgsql: Restore replication protocol's duplicate command tags
Previous Message Thomas Munro 2020-10-14 22:44:12 pgsql: Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.