postgresql/contrib
Amit Kapila a8fd13cab0 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
2021-07-14 07:33:50 +05:30
..
adminpack Rename Default Roles to Predefined Roles 2021-04-01 15:32:06 -04:00
amcheck Replace RelationOpenSmgr() with RelationGetSmgr(). 2021-07-12 17:01:36 -04:00
auth_delay
auto_explain Fix EXPLAIN ANALYZE for async-capable nodes. 2021-05-12 14:00:00 +09:00
bloom Replace RelationOpenSmgr() with RelationGetSmgr(). 2021-07-12 17:01:36 -04:00
bool_plperl
btree_gin
btree_gist Revert "Add sortsupport for gist_btree opclasses, for faster index builds." 2021-04-07 14:33:21 +03:00
citext
cube Add binary I/O capability for cube datatype. 2021-03-06 12:04:05 -05:00
dblink Revert use singular for -1 (commits 9ee7d533da and 5da9868ed9 2021-05-01 10:42:44 -04:00
dict_int
dict_xsyn
earthdistance
file_fdw Rename Default Roles to Predefined Roles 2021-04-01 15:32:06 -04:00
fuzzystrmatch
hstore Remove deprecated containment operators for contrib types. 2021-03-05 10:45:41 -05:00
hstore_plperl
hstore_plpython
intagg
intarray Remove extraneous newlines added by perl copyright patch 2021-05-07 11:37:37 -04:00
isn
jsonb_plperl
jsonb_plpython
lo
ltree
ltree_plpython
oid2name Add a copyright notice to perl files lacking one. 2021-05-07 10:56:14 -04:00
old_snapshot Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
pageinspect pageinspect: Improve page_header() for pages of 32kB 2021-07-12 11:05:27 +09:00
passwordcheck
pg_buffercache
pg_freespacemap
pg_prewarm Replace RelationOpenSmgr() with RelationGetSmgr(). 2021-07-12 17:01:36 -04:00
pg_stat_statements Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
pg_surgery Improve error messages about mismatching relkind 2021-07-08 09:44:51 +02:00
pg_trgm
pg_visibility Replace RelationOpenSmgr() with RelationGetSmgr(). 2021-07-12 17:01:36 -04:00
pgcrypto pgcrypto: Check for error return of px_cipher_decrypt() 2021-03-23 11:48:37 +01:00
pgrowlocks Rename Default Roles to Predefined Roles 2021-04-01 15:32:06 -04:00
pgstattuple Improve error messages about mismatching relkind 2021-07-08 09:44:51 +02:00
postgres_fdw Change the name of the Result Cache node to Memoize 2021-07-14 12:43:58 +12:00
seg Stabilize contrib/seg regression test. 2021-06-07 14:52:42 -04:00
sepgsql Centralize the logic for protective copying of utility statements. 2021-06-18 11:22:58 -04:00
spi
sslinfo
start-scripts
tablefunc
tcn
test_decoding Add support for prepared transactions to built-in logical replication. 2021-07-14 07:33:50 +05:30
tsm_system_rows
tsm_system_time
unaccent Update Unicode data to CLDR 39 2021-04-08 08:28:03 +02:00
uuid-ossp
vacuumlo Add a copyright notice to perl files lacking one. 2021-05-07 10:56:14 -04:00
xml2
contrib-global.mk
Makefile
README

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.