public inbox for [email protected]  
help / color / mirror / Atom feed
From: Amit Kapila <[email protected]>
To: [email protected]
Subject: pgsql: Add ALTER SUBSCRIPTION ... SKIP.
Date: Tue, 22 Mar 2022 01:56:03 +0000
Message-ID: <[email protected]> (raw)

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(-)



view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Add ALTER SUBSCRIPTION ... SKIP.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox