Remove the unnecessary PrepareWrite in pgoutput.
authorAmit Kapila <akapila@postgresql.org>
Tue, 16 Feb 2021 01:56:50 +0000 (07:26 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 16 Feb 2021 01:56:50 +0000 (07:26 +0530)
commitf672df5fdd22dac14c98d0a0bf5bbaa6ab17f8a5
treeedc3729b1e4981906b3f2f0da522aa8a28f2fab8
parent8001cb77ee6cb4f32632850d41f00206a86bac3e
Remove the unnecessary PrepareWrite in pgoutput.

This issue exists from the inception of this code (PG-10) but got exposed
by the recent commit ce0fdbfe97 where we are using origins in tablesync
workers. The problem was that we were sometimes sending the prepare_write
('w') message but then the actual message was not being sent and on the
subscriber side, we always expect a message after prepare_write message
which led to this bug.

I refrained from backpatching this because there is no way in the core
code to hit this prior to commit ce0fdbfe97 and we haven't received any
complaints so far.

Reported-by: Erik Rijkers
Author: Amit Kapila and Vignesh C
Tested-by: Erik Rijkers
Discussion: https://postgr.es/m/1295168140.139428.1613133237154@webmailclassic.xs4all.nl
src/backend/replication/pgoutput/pgoutput.c
src/test/subscription/t/100_bugs.pl