Add prepare API support for streaming transactions in logical replication.
authorAmit Kapila <akapila@postgresql.org>
Wed, 4 Aug 2021 02:17:06 +0000 (07:47 +0530)
committerAmit Kapila <akapila@postgresql.org>
Wed, 4 Aug 2021 02:17:06 +0000 (07:47 +0530)
commit63cf61cdeb7b0450dcf3b2f719c553177bac85a2
tree91df5f810b6cd96ddd1d7f2f4bd1c286af0fa2dc
parent6424337073589476303b10f6d7cc74f501b8d9d7
Add prepare API support for streaming transactions in logical replication.

Commit a8fd13cab0 added support for prepared transactions to built-in
logical replication via a new option "two_phase" for a subscription. The
"two_phase" option was not allowed with the existing streaming option.

This commit permits the combination of "streaming" and "two_phase"
subscription options. It extends the pgoutput plugin and the subscriber
side code to add the prepare API for streaming transactions which will
apply the changes accumulated in the spool-file at prepare time.

Author: Peter Smith and Ajin Cherian
Reviewed-by: Vignesh C, Amit Kapila, Greg Nancarrow
Tested-By: Haiying Tang
Discussion: https://postgr.es/m/02DA5F5E-CECE-4D9C-8B4B-418077E2C010@postgrespro.ru
Discussion: https://postgr.es/m/CAMGcDxeqEpWj3fTXwqhSwBdXd2RS9jzwWscO-XbeCfso6ts3+Q@mail.gmail.com
12 files changed:
doc/src/sgml/logicaldecoding.sgml
doc/src/sgml/protocol.sgml
doc/src/sgml/ref/create_subscription.sgml
src/backend/commands/subscriptioncmds.c
src/backend/replication/logical/proto.c
src/backend/replication/logical/worker.c
src/backend/replication/pgoutput/pgoutput.c
src/include/replication/logicalproto.h
src/test/regress/expected/subscription.out
src/test/regress/sql/subscription.sql
src/test/subscription/t/022_twophase_cascade.pl
src/test/subscription/t/023_twophase_stream.pl [new file with mode: 0644]