Add ALTER SUBSCRIPTION ... SKIP.
authorAmit Kapila <akapila@postgresql.org>
Tue, 22 Mar 2022 01:41:19 +0000 (07:11 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 22 Mar 2022 01:41:19 +0000 (07:11 +0530)
commit208c5d65bbd60e33e272964578cb74182ac726a8
tree5f3a99783f4c7be35c16237c5b10ebc711b37293
parent315ae75e9b6da72456eaa44e55ace9ab1b95ef74
Add ALTER SUBSCRIPTION ... SKIP.

This feature allows skipping the transaction on subscriber nodes.

If incoming change violates any constraint, logical replication stops
until it's resolved. Currently, users need to either manually resolve the
conflict by updating a subscriber-side database or by using function
pg_replication_origin_advance() to skip the conflicting transaction. This
commit introduces a simpler way to skip the conflicting transactions.

The user can specify LSN by ALTER SUBSCRIPTION ... SKIP (lsn = XXX),
which allows the apply worker to skip the transaction finished at
specified LSN. The apply worker skips all data modification changes within
the transaction.

Author: Masahiko Sawada
Reviewed-by: Takamichi Osumi, Hou Zhijie, Peter Eisentraut, Amit Kapila, Shi Yu, Vignesh C, Greg Nancarrow, Haiying Tang, Euler Taveira
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com
18 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/logical-replication.sgml
doc/src/sgml/ref/alter_subscription.sgml
src/backend/catalog/pg_subscription.c
src/backend/catalog/system_views.sql
src/backend/commands/subscriptioncmds.c
src/backend/parser/gram.y
src/backend/replication/logical/worker.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/describe.c
src/bin/psql/tab-complete.c
src/include/catalog/catversion.h
src/include/catalog/pg_subscription.h
src/include/nodes/parsenodes.h
src/test/regress/expected/subscription.out
src/test/regress/sql/subscription.sql
src/test/subscription/t/029_disable_on_error.pl [deleted file]
src/test/subscription/t/029_on_error.pl [new file with mode: 0644]