git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 6c9c283) | patch
Add support for prepared transactions to built-in logical replication.
2021年7月14日 02:03:50 +0000 (07:33 +0530)
2021年7月14日 02:03:50 +0000 (07:33 +0530)
commit a8fd13cab0ba815e9925dc9676e6309f699b5f72
Add support for prepared transactions to built-in logical replication.

To add support for streaming transactions at prepare time into the
built-in logical replication, we need to do the following things:

* Modify the output plugin (pgoutput) to implement the new two-phase API
callbacks, by leveraging the extended replication protocol.

* Modify the replication apply worker, to properly handle two-phase
transactions by replaying them on prepare.

* Add a new SUBSCRIPTION option "two_phase" to allow users to enable
two-phase transactions. We enable the two_phase once the initial data sync
is over.

We however must explicitly disable replication of two-phase transactions
during replication slot creation, even if the plugin supports it. We
don't need to replicate the changes accumulated during this phase,
and moreover, we don't have a replication connection open so we don't know
where to send the data anyway.

The streaming option is not allowed with this new two_phase option. This
can be done as a separate patch.

We don't allow to toggle two_phase option of a subscription because it can
lead to an inconsistent replica. For the same reason, we don't allow to
refresh the publication once the two_phase is enabled for a subscription
unless copy_data option is false.

Author: Peter Smith, Ajin Cherian and Amit Kapila based on previous work by Nikhil Sontakke and Stas Kelvich
Reviewed-by: Amit Kapila, Sawada Masahiko, Vignesh C, Dilip Kumar, Takamichi Osumi, Greg Nancarrow
Tested-By: Haiying Tang
Discussion: https://postgr.es/m/02DA5F5E-CECE-4D9C-8B4B-418077E2C010@postgrespro.ru
Discussion: https://postgr.es/m/CAA4eK1+opiV4aFTmWWUF9h_32=HfPOW9vZASHarT0UA5oBrtGw@mail.gmail.com
43 files changed:
contrib/test_decoding/test_decoding.c diff | blob | blame | history
doc/src/sgml/catalogs.sgml diff | blob | blame | history
doc/src/sgml/protocol.sgml diff | blob | blame | history
doc/src/sgml/ref/alter_subscription.sgml diff | blob | blame | history
doc/src/sgml/ref/create_subscription.sgml diff | blob | blame | history
doc/src/sgml/ref/pg_dump.sgml diff | blob | blame | history
src/backend/access/transam/twophase.c diff | blob | blame | history
src/backend/catalog/pg_subscription.c diff | blob | blame | history
src/backend/catalog/system_views.sql diff | blob | blame | history
src/backend/commands/subscriptioncmds.c diff | blob | blame | history
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c diff | blob | blame | history
src/backend/replication/logical/decode.c diff | blob | blame | history
src/backend/replication/logical/logical.c diff | blob | blame | history
src/backend/replication/logical/origin.c diff | blob | blame | history
src/backend/replication/logical/proto.c diff | blob | blame | history
src/backend/replication/logical/reorderbuffer.c diff | blob | blame | history
src/backend/replication/logical/snapbuild.c diff | blob | blame | history
src/backend/replication/logical/tablesync.c diff | blob | blame | history
src/backend/replication/logical/worker.c diff | blob | blame | history
src/backend/replication/pgoutput/pgoutput.c diff | blob | blame | history
src/backend/replication/slot.c diff | blob | blame | history
src/backend/replication/walreceiver.c diff | blob | blame | history
src/bin/pg_dump/pg_dump.c diff | blob | blame | history
src/bin/pg_dump/pg_dump.h diff | blob | blame | history
src/bin/psql/describe.c diff | blob | blame | history
src/bin/psql/tab-complete.c diff | blob | blame | history
src/include/access/twophase.h diff | blob | blame | history
src/include/catalog/catversion.h diff | blob | blame | history
src/include/catalog/pg_subscription.h diff | blob | blame | history
src/include/catalog/pg_subscription_rel.h diff | blob | blame | history
src/include/replication/logical.h diff | blob | blame | history
src/include/replication/logicalproto.h diff | blob | blame | history
src/include/replication/pgoutput.h diff | blob | blame | history
src/include/replication/reorderbuffer.h diff | blob | blame | history
src/include/replication/slot.h diff | blob | blame | history
src/include/replication/snapbuild.h diff | blob | blame | history
src/include/replication/walreceiver.h diff | blob | blame | history
src/include/replication/worker_internal.h diff | blob | blame | history
src/test/regress/expected/subscription.out diff | blob | blame | history
src/test/regress/sql/subscription.sql diff | blob | blame | history
src/test/subscription/t/021_twophase.pl [new file with mode: 0644] blob
src/test/subscription/t/022_twophase_cascade.pl [new file with mode: 0644] blob
src/tools/pgindent/typedefs.list diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /