pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_createsubscriber: creates a new logical replica from a standb
Date: Mon, 25 Mar 2024 11:48:00 +0000
Message-ID: <E1roio3-005ZLs-Q3@gemulon.postgresql.org> (raw)

pg_createsubscriber: creates a new logical replica from a standby server

It must be run on the target server and should be able to connect to
the source server (publisher) and the target server (subscriber).  All
tables in the specified database(s) are included in the logical
replication setup.  A pair of publication and subscription objects are
created for each database.

The main advantage of pg_createsubscriber over the common logical
replication setup is the initial data copy.  It also reduces the
catchup phase.

Some prerequisites must be met to successfully run it.  It is
basically the logical replication requirements.  It starts creating a
publication using FOR ALL TABLES and a replication slot for each
specified database.  Write recovery parameters into the target data
directory and start the target server.  It specifies the LSN of the
last replication slot (replication start point) up to which the
recovery will proceed.  Wait until the target server is promoted.
Create one subscription per specified database (using publication and
replication slot created in a previous step) on the target server.
Set the replication progress to the replication start point for each
subscription.  Enable the subscription for each specified database on
the target server.  And finally, change the system identifier on the
target server.

Author: Euler Taveira <euler.taveira@enterprisedb.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Shubham Khanna <khannashubham1197@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/5ac50071-f2ed-4ace-a8fd-b892cffd33eb@www.fastmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/allfiles.sgml                     |    1 +
doc/src/sgml/ref/pg_createsubscriber.sgml          |  523 +++++
doc/src/sgml/reference.sgml                        |    1 +
src/bin/pg_basebackup/.gitignore                   |    1 +
src/bin/pg_basebackup/Makefile                     |   11 +-
src/bin/pg_basebackup/meson.build                  |   19 +
src/bin/pg_basebackup/nls.mk                       |    1 +
src/bin/pg_basebackup/pg_createsubscriber.c        | 2141 ++++++++++++++++++++
src/bin/pg_basebackup/t/040_pg_createsubscriber.pl |  364 ++++
9 files changed, 3059 insertions(+), 3 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1roio3-005ZLs-Q3@gemulon.postgresql.org>
Permalink:  ../E1roio3-005ZLs-Q3@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1roio3-005ZLs-Q3@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: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_createsubscriber: creates a new logical replica from a standb
  In-Reply-To: <E1roio3-005ZLs-Q3@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