pgsql: Allow users to limit storage reserved by replication slots

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow users to limit storage reserved by replication slots
Date: 2020-04-07 22:39:19
Message-ID: E1jLwsJ-0001ip-6y@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Allow users to limit storage reserved by replication slots

Replication slots are useful to retain data that may be needed by a
replication system. But experience has shown that allowing them to
retain excessive data can lead to the primary failing because of running
out of space. This new feature allows the user to configure a maximum
amount of space to be reserved using the new option
max_slot_wal_keep_size. Slots that overrun that space are invalidated
at checkpoint time, enabling the storage to be released.

Author: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Reviewed-by: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Reviewed-by: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/20170228.122736.123383594.horiguchi.kyotaro@lab.ntt.co.jp

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/catalogs.sgml | 38 +++++
doc/src/sgml/config.sgml | 23 +++
doc/src/sgml/high-availability.sgml | 8 +-
src/backend/access/transam/xlog.c | 145 ++++++++++++++---
src/backend/catalog/system_views.sql | 4 +-
src/backend/replication/logical/logicalfuncs.c | 2 +-
src/backend/replication/slot.c | 100 +++++++++++-
src/backend/replication/slotfuncs.c | 44 ++++-
src/backend/replication/walsender.c | 4 +-
src/backend/utils/misc/guc.c | 13 ++
src/backend/utils/misc/postgresql.conf.sample | 1 +
src/include/access/xlog.h | 14 ++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 6 +-
src/include/replication/slot.h | 11 +-
src/test/recovery/t/019_replslot_limit.pl | 217 +++++++++++++++++++++++++
src/test/regress/expected/rules.out | 6 +-
17 files changed, 595 insertions(+), 43 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-04-07 22:58:40 pgsql: Remove nbtree BTreeTupleSetAltHeapTID() function.
Previous Message Anna Akenteva 2020-04-07 22:34:28 Re: pgsql: Implement waiting for given lsn at transaction start

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-04-07 22:45:22 Re: [HACKERS] Restricting maximum keep segments by repslots
Previous Message Justin Pryzby 2020-04-07 22:39:01 Re: Default setting for enable_hashagg_disk