1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add facility to copy replication slots

This allows the user to create duplicates of existing replication slots,
either logical or physical, and even changing properties such as whether
they are temporary or the output plugin used.

There are multiple uses for this, such as initializing multiple replicas
using the slot for one base backup; when doing investigation of logical
replication issues; and to select a different output plugins.

Author: Masahiko Sawada
Reviewed-by: Michael Paquier, Andres Freund, Petr Jelinek
Discussion: https://postgr.es/m/CAD21AoAm7XX8y_tOPP6j4Nzzch12FvA1wPqiO690RCk+uYVstg@mail.gmail.com
This commit is contained in:
Alvaro Herrera
2019-04-05 14:52:45 -03:00
parent de2b38419c
commit 9f06d79ef8
9 changed files with 736 additions and 50 deletions

View File

@ -20431,6 +20431,47 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup());
</entry>
</row>
<row>
<entry>
<indexterm>
<primary>pg_copy_physical_replication_slot</primary>
</indexterm>
<literal><function>pg_copy_physical_replication_slot(<parameter>src_slot_name</parameter> <type>name</type>, <parameter>dst_slot_name</parameter> <type>name</type> <optional>, <parameter>temporary</parameter> <type>boolean</type></optional>)</function></literal>
</entry>
<entry>
(<parameter>slot_name</parameter> <type>name</type>, <parameter>lsn</parameter> <type>pg_lsn</type>)
</entry>
<entry>
Copies an existing physical replication slot name <parameter>src_slot_name</parameter>
to a physical replication slot named <parameter>dst_slot_name</parameter>.
The copied physical slot starts to reserve WAL from the same <acronym>LSN</acronym> as the
source slot.
<parameter>temporary</parameter> is optional. If <parameter>temporary</parameter>
is omitted, the same value as the source slot is used.
</entry>
</row>
<row>
<entry>
<indexterm>
<primary>pg_copy_logical_replication_slot</primary>
</indexterm>
<literal><function>pg_copy_logical_replication_slot(<parameter>src_slot_name</parameter> <type>name</type>, <parameter>dst_slot_name</parameter> <type>name</type> <optional>, <parameter>temporary</parameter> <type>boolean</type> <optional>, <parameter>plugin</parameter> <type>name</type></optional></optional>)</function></literal>
</entry>
<entry>
(<parameter>slot_name</parameter> <type>name</type>, <parameter>lsn</parameter> <type>pg_lsn</type>)
</entry>
<entry>
Copies an existing logical replication slot name <parameter>src_slot_name</parameter>
to a logical replication slot named <parameter>dst_slot_name</parameter>
while changing the output plugin and persistence. The copied logical slot starts
from the same <acronym>LSN</acronym> as the source logical slot. Both
<parameter>temporary</parameter> and <parameter>plugin</parameter> are optional.
If <parameter>temporary</parameter> or <parameter>plugin</parameter> are omitted,
the same values as the source logical slot are used.
</entry>
</row>
<row>
<entry>
<indexterm>