From 6f7a862bed3a49283c74c0adf207172002e3e03c Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 24 Jun 2020 14:23:39 -0400 Subject: Adjust max_slot_wal_keep_size behavior per review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Author: Kyotaro Horiguchi Reviewed-by: Fujii Masao Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/20200616.120236.1809496990963386593.horikyota.ntt@gmail.com --- doc/src/sgml/catalogs.sgml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 700271fd40e..8945959f9d2 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -11239,19 +11239,29 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx Possible values are: - normal means that the claimed files + reserved means that the claimed files are within max_wal_size. - reserved means + extended means that max_wal_size is exceeded but the files are - still held, either by some replication slot or - by wal_keep_segments. + still retained, either by the replication slot or + by wal_keep_segments. + - lost means that some WAL files are - definitely lost and this slot cannot be used to resume replication - anymore. + + unreserved means that the slot no longer + retains the required WAL files and some of them are to be removed at + the next checkpoint. This state can return + to reserved or extended. + + + + + lost means that some required WAL files have + been removed and this slot is no longer usable. + The last two states are seen only when -- cgit v1.2.3