Function for listing archive_status directory - Mailing list pgsql-hackers

From Christoph Moench-Tegeder
Subject Function for listing archive_status directory
Date
Msg-id 20180930205920.GA64534@elch.exwg.net
Whole thread Raw
Responses Re: Function for listing archive_status directory  (Michael Paquier <michael@paquier.xyz>)
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Relations being opened without any lock whatever
Next
From: Peter Geoghegan
Date:
Subject: Re: Making all nbtree entries unique by having heap TIDs participatein comparisons