Add replication command READ_REPLICATION_SLOT

Enterprise / PostgreSQL - Michael Paquier [paquier.xyz] - 24 October 2021 22:40 UTC

The command is supported for physical slots for now, and returns the type of slot, its restart_lsn and its restart_tli.

This will be useful for an upcoming patch related to pg_receivewal, to allow the tool to be able to stream from the position of a slot, rather than the last WAL position flushed by the backend (as reported by IDENTIFY_SYSTEM) if the archive directory is found as empty, which would be an advantage in the case of switching to a different archive locations with the same slot used to avoid holes in WAL segment archives.

Author: Ronan Dunklau

b4ada4e19f Add replication command READ_REPLICATION_SLOT
doc/src/sgml/protocol.sgml | 48 +++++++++++++
src/backend/replication/repl_gram.y | 16 ++++-
src/backend/replication/repl_scanner.l | 1 +
src/backend/replication/walsender.c | 106 ++++++++++++++++++++++++++++
src/include/nodes/nodes.h | 1 +
src/include/nodes/replnodes.h | 11 +++
src/test/recovery/t/001_stream_rep.pl | 32 ++++++++-
src/test/recovery/t/006_logical_decoding.pl | 11 ++-
src/tools/pgindent/typedefs.list | 1 +
9 files changed, 224 insertions(+), 3 deletions(-)

Upstream: git.postgresql.org


  • Share