Skip to content

Export safe_wal_size and wal_status to monitor for lost replication slots when using max_slot_wal_keep_size #1017

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
MarcWort opened this issue Apr 3, 2024 · 0 comments

Comments

@MarcWort
Copy link
Contributor

MarcWort commented Apr 3, 2024

Proposal

We set the option max_slot_wal_keep_size supported by postgres >= 13 and want to alert if the slot is lost. I cannot find a reliable solution to do this except using wal_status and safe_wal_size which is currently not exported.

documentation: https://www.postgresql.org/docs/13/view-pg-replication-slots.html

example:

postgres=# SELECT * FROM pg_catalog.pg_replication_slots;
 slot_name | plugin | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn | wal_status | safe_wal_size
-----------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------+------------+---------------
 barman    |        | physical  |        |          | f         | f      |            |      |              | 0/B0000000  |                     | unreserved |    -323906992
(1 rows)

postgres=# SELECT * FROM pg_catalog.pg_replication_slots;
 slot_name | plugin | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn | wal_status | safe_wal_size
-----------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------+------------+---------------
 barman    |        | physical  |        |          | f         | f      |            |      |              |             |                     | lost       |
(1 rows)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant