pgsql: Add more monitoring data for WAL writes in the WAL receiver - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Add more monitoring data for WAL writes in the WAL receiver
Date
Msg-id E1tpzbK-0010AC-0g@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Add more monitoring data for WAL writes in the WAL receiver

This commit adds two improvements related to the monitoring of WAL
writes for the WAL receiver.

First, write counts and timings are now counted in pg_stat_io for the
WAL receiver.  These have been discarded from pg_stat_wal in
ff99918c625a due to performance concerns, related to the fact that we
still relied on an on-disk file for the stats back then, even with
track_wal_io_timing to avoid the overhead of the timestamp calculations.
This implementation is simpler than the original proposal as it is
possible to rely on the APIs of pgstat_io.c to do the job.  Like the
fsync and read data, track_wal_io_timing needs to be enabled to track
the timings.

Second, a wait event is added around the pg_pwrite() call in charge of
the writes, using the exiting WAIT_EVENT_WAL_WRITE.  This is useful as
the WAL receiver data is tracked in pg_stat_activity.

Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/Z8gFnH4o3jBm5BRz@ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7f7f324eb5a4754ab9fa1c68dfef952555a94d1b

Modified Files
--------------
src/backend/replication/walreceiver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Use ModifyWaitEvent to update exit_on_postmaster_death
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix compiler warnings about typedef redefinitions