Thread: pgsql: Allow users to limit storage reserved by replication slots
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.kyotaro@lab.ntt.co.jp> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.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(-)