pgsql: Add ALTER SUBSCRIPTION ... SKIP. - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Add ALTER SUBSCRIPTION ... SKIP.
Date
Msg-id E1nWTkh-000ncF-2O@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Add ALTER SUBSCRIPTION ... SKIP.  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pgsql: Add ALTER SUBSCRIPTION ... SKIP.  (Andres Freund <andres@anarazel.de>)
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/208c5d65bbd60e33e272964578cb74182ac726a8

Modified Files
--------------
doc/src/sgml/catalogs.sgml                      |  10 +
doc/src/sgml/logical-replication.sgml           |  27 +--
doc/src/sgml/ref/alter_subscription.sgml        |  42 +++++
src/backend/catalog/pg_subscription.c           |   1 +
src/backend/catalog/system_views.sql            |   2 +-
src/backend/commands/subscriptioncmds.c         |  73 ++++++++
src/backend/parser/gram.y                       |   9 +
src/backend/replication/logical/worker.c        | 233 +++++++++++++++++++++++-
src/bin/pg_dump/pg_dump.c                       |   4 +
src/bin/psql/describe.c                         |   8 +-
src/bin/psql/tab-complete.c                     |   5 +-
src/include/catalog/catversion.h                |   2 +-
src/include/catalog/pg_subscription.h           |   5 +
src/include/nodes/parsenodes.h                  |   3 +-
src/test/regress/expected/subscription.out      | 126 +++++++------
src/test/regress/sql/subscription.sql           |  11 ++
src/test/subscription/t/029_disable_on_error.pl |  94 ----------
src/test/subscription/t/029_on_error.pl         | 183 +++++++++++++++++++
18 files changed, 665 insertions(+), 173 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: pgstat: reorder pgstat.[ch] contents.
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Add ALTER SUBSCRIPTION ... SKIP.