pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Introduce a new GUC 'standby_slot_names'.
Date: Fri, 08 Mar 2024 02:53:04 +0000
Message-ID: <E1riQM4-002eUJ-80@gemulon.postgresql.org> (raw)

Introduce a new GUC 'standby_slot_names'.

This patch provides a way to ensure that physical standbys that are
potential failover candidates have received and flushed changes before
the primary server making them visible to subscribers. Doing so guarantees
that the promoted standby server is not lagging behind the subscribers
when a failover is necessary.

The logical walsender now guarantees that all local changes are sent and
flushed to the standby servers corresponding to the replication slots
specified in 'standby_slot_names' before sending those changes to the
subscriber.

Additionally, the SQL functions pg_logical_slot_get_changes,
pg_logical_slot_peek_changes and pg_replication_slot_advance are modified
to ensure that they process changes for failover slots only after physical
slots specified in 'standby_slot_names' have confirmed WAL receipt for those.

Author: Hou Zhijie and Shveta Malik
Reviewed-by: Masahiko Sawada, Peter Smith, Bertrand Drouvot, Ajin Cherian, Nisha Moond, Amit Kapila
Discussion: https://postgr.es/m/514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bf279ddd1c28ce0251446ee90043a4cb96e5db0f

Modified Files
--------------
doc/src/sgml/config.sgml                           |  39 ++
doc/src/sgml/func.sgml                             |  16 +-
doc/src/sgml/logicaldecoding.sgml                  |  12 +
src/backend/replication/logical/logicalfuncs.c     |  12 +
src/backend/replication/logical/slotsync.c         |  11 +
src/backend/replication/slot.c                     | 403 ++++++++++++++++++++-
src/backend/replication/slotfuncs.c                |  12 +
src/backend/replication/walsender.c                | 159 +++++++-
src/backend/utils/activity/wait_event_names.txt    |   1 +
src/backend/utils/misc/guc_tables.c                |  14 +
src/backend/utils/misc/postgresql.conf.sample      |   2 +
src/include/replication/slot.h                     |   5 +
src/include/replication/walsender.h                |   1 +
src/include/replication/walsender_private.h        |   7 +
src/include/utils/guc_hooks.h                      |   3 +
src/test/recovery/t/006_logical_decoding.pl        |   3 +-
.../recovery/t/040_standby_failover_slots_sync.pl  | 244 ++++++++++++-
src/tools/pgindent/typedefs.list                   |   1 +
18 files changed, 918 insertions(+), 27 deletions(-)



view thread (2+ messages)

Message-ID: <E1riQM4-002eUJ-80@gemulon.postgresql.org>
Permalink:  ../E1riQM4-002eUJ-80@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1riQM4-002eUJ-80@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Introduce a new GUC 'standby_slot_names'.
  In-Reply-To: <E1riQM4-002eUJ-80@gemulon.postgresql.org>

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

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