Adjust max_slot_wal_keep_size behavior per review In pg_replication_slot, change output from normal/reserved/lost to reserved/extended/unreserved/ lost, which better expresses the possible states particularly near the time where segments are no longer safe but checkpoint has not run yet.
Under the new definition, reserved means the slot is consuming WAL that's still under the normal WAL size constraints; extended means it's consuming WAL that's being protected by wal_keep_segments or the slot itself, whose size is below max_slot_wal_keep_size; unreserved means the WAL is no longer safe, but checkpoint has not yet removed those files. Such as slot is in imminent danger, but can still continue for a little while and may catch up to the reserved WAL space. Also, there were some bugs in the calculations used to report the status; fixed those. Backpatch to 13. Reported-by: Fujii Masao <[email protected]> Author: Kyotaro Horiguchi <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Reviewed-by: Álvaro Herrera <[email protected]> Discussion: https://postgr.es/m/[email protected] Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6f7a862bed3a49283c74c0adf207172002e3e03c Modified Files -------------- doc/src/sgml/catalogs.sgml | 24 +++++++++---- src/backend/access/transam/xlog.c | 57 +++++++++++++++++-------------- src/backend/replication/slotfuncs.c | 39 ++++++++++++++++----- src/include/access/xlog.h | 6 ++-- src/test/recovery/t/019_replslot_limit.pl | 23 +++++++------ 5 files changed, 96 insertions(+), 53 deletions(-)
