From 1908e5c2bbe0e6b2945acd3ff32b0f72e72477e7 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Thu, 11 Jan 2018 15:00:32 +0900 Subject: [PATCH 4/4] Documentation for slot-limit feature --- doc/src/sgml/catalogs.sgml | 28 ++++++++++++++++++++++++++++ doc/src/sgml/config.sgml | 24 ++++++++++++++++++++++++ doc/src/sgml/high-availability.sgml | 14 ++++++++------ 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 30e6741305..7a6f4540f1 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -9802,6 +9802,34 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx + + wal_status + text + + + Availability of WAL records claimed by the + slot. streaming, keeping, + lost + or unknown. streaming means that + the claimed records are available. keeping means that + some of them are to be removed in the next + checkpoint. lost means that some of them have been + removed. The last two states are seen only when + is not zero. If the slot + doesn't have valid restart_lsn, this field is unknown. + + + + + min_keep_lsn + pg_lsn + + The address (LSN) back to which is available + to the replication slot. The user of the slot can no longer continue + streaming if this exceeds restart_lsn. + + + diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index f18d2b3353..8715dee1ed 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -3116,6 +3116,30 @@ include_dir 'conf.d' + + max_slot_wal_keep_size (integer) + + max_slot_wal_keep_size configuration parameter + + + + + Specify the maximum size of WAL files kept in + the pg_wal directory at checkpoint time, even in + case some of them are still claimed by + replication + slots. If max_slot_wal_keep_size is zero + (the default), replication slots retain unlimited size of WAL + files. + + + + This size is counted apart from + . + + + + wal_sender_timeout (integer) diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index 46bf198a2a..7bf5cc7f79 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -927,9 +927,11 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' . However, these methods often result in retaining more WAL segments than required, whereas replication slots retain only the number of segments - known to be needed. An advantage of these methods is that they bound - the space requirement for pg_wal; there is currently no way - to do this using replication slots. + known to be needed. On the other hand, replication slots can retain so + many WAL segments that they fill up the space allotted + for pg_wal; + limits the size of WAL files + retained by replication slots. Similarly, @@ -967,9 +969,9 @@ postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot'); node_a_slot | postgres=# SELECT * FROM pg_replication_slots; - slot_name | slot_type | datoid | database | active | xmin | restart_lsn | confirmed_flush_lsn --------------+-----------+--------+----------+--------+------+-------------+--------------------- - node_a_slot | physical | | | f | | | + slot_name | slot_type | datoid | database | active | xmin | restart_lsn | confirmed_flush_lsn | wal_status | min_keep_lsn +-------------+-----------+--------+----------+--------+------+-------------+---------------------+------------+-------------- + node_a_slot | physical | | | f | | | | unknown | 0/1000000 (1 row) To configure the standby to use this slot, primary_slot_name -- 2.16.2