Re: [TODO] Track number of files ready to be archived in pg_stat_archiver - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: [TODO] Track number of files ready to be archived in pg_stat_archiver
Date
Msg-id CA+U5nM+NqQGQh05m53rcrDBZ-R9zO3RjMGbY1h0Fn=euXTp2Jw@mail.gmail.com
Whole thread Raw
In response to Re: [TODO] Track number of files ready to be archived in pg_stat_archiver  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On 18 November 2014 06:20, Michael Paquier <michael.paquier@gmail.com> wrote:

> the DBA may want to know how long is the queue of WAL files
> waiting to be archived.

Agreed

> That's IMO something we simply forgot in the
> first implementation of pg_stat_archiver

That's not how it appears to me. ISTM that the information requested
is already available, it just needs some minor calculations to work
out how many files are required.

> the most direct way to
> know that is to count the .ready files in archive_status.

...my earlier point was...

>> pg_stat_archiver already has a column for last_archived_wal and
>> last_failed_wal, so you can already work out how many files there must
>> be between then and now. Perhaps that can be added directly to the
>> view, to assist the user in calculating it. Reading the directory
>> itself to count the file is unnecessary, except as a diagnostic.

As soon as we have sent the first file, we will know the queue length
at any point afterwards.

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Add shutdown_at_recovery_target option to recovery.conf
Next
From: Pavel Stehule
Date:
Subject: Re: proposal: plpgsql - Assert statement