On Mon, Jan 6, 2014 at 5:37 PM, Gabriele Bartolini <gabriele.bartol...@2ndquadrant.it> wrote: > Hi Fabrizio, > > Il 05/01/14 20:46, Fabrizio Mello ha scritto: >> I don't see your code yet, but I would like to know if is possible to >> implement this view as an extension. > I wanted to do it as an extension - so that I could backport that to > previous versions of Postgres. > > I do not think it is a possibility, given that the client code that is > aware of the events lies in pgarch.c. I don't see particularly any point in doing that as an extension as you want to log this statistical information once archive has either failed or passed.
I just had a quick look at v2, and it looks that the patch is in good shape. Sorry to be picky, but I am not sure that using the character m_type is adapted when delivering messages to pgstat facility. You might want to use a boolean instead... MAX_XFN_CHARS is not adapted as well IMO: you should remove it and use instead MAXFNAMELEN of xlog_internal.h, where all the file names related to WAL files, including history and backup files, are generated. Then, the patch looks to be working as expected, here are some results with a short test: =# \x Expanded display (expanded) is on. =# select * from pg_stat_get_archiver(); -[ RECORD 1 ]----------+------------------------------ archived_wals | 6 last_archived_wal | 000000010000000000000005 last_archived_wal_time | 2014-01-07 17:27:34.752903+09 failed_attempts | 12 last_failed_wal | 000000010000000000000006 last_failed_wal_time | 2014-01-07 17:31:18.409528+09 stats_reset (1 row) =# select * from pg_stat_archiver; -[ RECORD 1 ]----------+------------------------------ archived_wals | 6 last_archived_wal | 000000010000000000000005 last_archived_wal_time | 2014-01-07 17:27:34.752903+09 failed_attempts | 12 last_failed_wal | 000000010000000000000006 last_failed_wal_time | 2014-01-07 17:31:18.409528+09 stats_reset | 2014-01-07 17:25:51.949498+09 Regards, -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers