Add prepare API support for streaming transactions in logical replication.
Amit Kapila <akapila@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/logicaldecoding.sgml | modified | +10 −1 |
| doc/src/sgml/protocol.sgml | modified | +75 −1 |
| doc/src/sgml/ref/create_subscription.sgml | modified | +0 −10 |
| src/backend/commands/subscriptioncmds.c | modified | +0 −25 |
| src/backend/replication/logical/proto.c | modified | +27 −2 |
| src/backend/replication/logical/worker.c | modified | +55 −1 |
| src/backend/replication/pgoutput/pgoutput.c | modified | +21 −12 |
| src/include/replication/logicalproto.h | modified | +6 −2 |
| src/test/regress/expected/subscription.out | modified | +13 −11 |
| src/test/regress/sql/subscription.sql | modified | +6 −5 |
| src/test/subscription/t/022_twophase_cascade.pl | modified | +170 −9 |
| src/test/subscription/t/023_twophase_stream.pl | added | +284 −0 |
Documentation touched
Discussion
- Re: [HACKERS] logical decoding of two-phase transactions 424 messages · 2018-08-01 → 2022-01-05
- logical decoding of two-phase transactions 222 messages · 2016-12-31 → 2019-09-02