pgsql: Allow altering of two_phase option of a SUBSCRIPTION.

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема pgsql: Allow altering of two_phase option of a SUBSCRIPTION.
Дата
Msg-id E1sWU1Q-000wWl-Rr@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Allow altering of two_phase option of a SUBSCRIPTION.

The two_phase option is controlled by both the publisher (as a slot
option) and the subscriber (as a subscription option), so the slot option
must also be modified.

Changing the 'two_phase' option for a subscription from 'true' to 'false'
is permitted only when there are no pending prepared transactions
corresponding to that subscription. Otherwise, the changes of already
prepared transactions can be replicated again along with their corresponding
commit leading to duplicate data or errors.

To avoid data loss, the 'two_phase' option for a subscription can only be
changed from 'false' to 'true' once the initial data synchronization is
completed. Therefore this is performed later by the logical replication worker.

Author: Hayato Kuroda, Ajin Cherian, Amit Kapila
Reviewed-by: Peter Smith, Hou Zhijie, Amit Kapila, Vitaly Davydov, Vignesh C
Discussion: https://postgr.es/m/8fab8-65d74c80-1-2f28e880@39088166

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1462aad2e4474ab61174f8ab00992cd3d6d57c7b

Modified Files
--------------
doc/src/sgml/protocol.sgml                         |  18 ++-
doc/src/sgml/ref/alter_subscription.sgml           |  36 ++++-
src/backend/access/transam/twophase.c              |  79 ++++++++++
src/backend/commands/subscriptioncmds.c            | 169 ++++++++++++++++-----
.../libpqwalreceiver/libpqwalreceiver.c            |  22 ++-
src/backend/replication/logical/launcher.c         |  10 +-
src/backend/replication/logical/worker.c           |  25 +--
src/backend/replication/slot.c                     |  45 ++++--
src/backend/replication/walsender.c                |  32 ++--
src/bin/psql/tab-complete.c                        |   2 +-
src/include/access/twophase.h                      |   5 +
src/include/replication/slot.h                     |   3 +-
src/include/replication/walreceiver.h              |  12 +-
src/include/replication/worker_internal.h          |   3 +-
src/test/regress/expected/subscription.out         |   5 +-
src/test/regress/sql/subscription.sql              |   5 +-
src/test/subscription/t/021_twophase.pl            |  95 +++++++++++-
17 files changed, 452 insertions(+), 114 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Move all extern declarations for GUC variables to header files
Следующее
От: Thomas Munro
Дата:
Сообщение: pgsql: Refactor tidstore.c iterator buffering.