Fix some gaps in pg_stat_io with WAL receiver and WAL summarizer
The WAL receiver and WAL summarizer processes gain each one a call to
pgstat_report_wal(), to make sure that they report their WAL statistics
to pgstats, gathering data for pg_stat_io.
In the WAL receiver, the stats reports are timed with status updates sent
to the primary, that depend on wal_receiver_status_interval and
wal_receiver_timeout. This is a conservative choice, but perhaps we
could be more aggressive with the frequency of the stats reports. An
interesting historical fact is that the WAL receiver does writes and
syncs of WAL, but it has never reported its statistics to pgstats in
pg_stat_wal.
In the WAL summarizer, the stats reports are done each time the process
waits for WAL.
While on it, pg_stat_io is adjusted so as these two processes do not
report any rows when IOObject is not WAL, making the view easier to use
with less rows.
Two tests are added in TAP, checking statistics for the WAL summarizer
and the WAL receiver. Status updates in the WAL receiver are currently
possible in the recovery test 001_stream_rep.pl.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/Z8UKZyVSHUUQJHNb@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f4694e0f35b218238cbc87bcf8f8f5c6639bb1d4
Modified Files
--------------
src/backend/postmaster/walsummarizer.c | 4 ++++
src/backend/replication/walreceiver.c | 10 ++++++++++
src/backend/utils/activity/pgstat_io.c | 12 +++++++++++-
src/bin/pg_walsummary/t/002_blocks.pl | 7 +++++++
src/test/recovery/t/001_stream_rep.pl | 7 +++++++
5 files changed, 39 insertions(+), 1 deletion(-)