Function for listing archive_status directory

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Function for listing archive_status directory
Date: 2018-09-30 20:59:20
Message-ID: 20180930205920.GA64534@elch.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

while setting up monitoring for a new PostgreSQL instance, I noticed that
there's no build-in way for a pg_monitor role to check the contents of
the archive_status directory. We got pg_ls_waldir() in 10, but that
only lists pg_wal - not it's subdirectory. It seems listing the
archive_status directory wasn't even really discussed (or my Google-Fu
betrayed me?). Of course, these days people should use streaming archiving
(but there're still environments where that's not an option); and of
course it's possible to create a wrapper function for
pg_ls_dir('pg_wal/archive_status') with SECURITY DEFINER set - but the
same could have been said about pg_ls_waldir(), and it didn't stop
anyone.

Without further ado, I present a patch to implement pg_ls_archive_status(),
which fills this gap. I believe the function name is long enough and we
don't need an extra wal in there. The patch is based on a very recent
master (just pulled and merged), but does not include the catversion
bump (avoid conflict on merge).

Is this relevant?

Regards,
Christoph

--
Spare Space

Attachment Content-Type Size
ls_archive_status.diff text/x-diff 4.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2018-09-30 21:33:15 Re: Making all nbtree entries unique by having heap TIDs participate in comparisons
Previous Message Tom Lane 2018-09-30 19:20:44 Relations being opened without any lock whatever