Re: Show WAL write and fsync stats in pg_stat_io
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>, "bharath.rupireddyforpostgres@gmail.com"
<bharath.rupireddyforpostgres@gmail.com>
Date: 2023-11-20T07:47:19Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix copy-paste error related to the autovacuum launcher in pgstat_io.c
- 17d8bba6dad1 18.0 landed
-
Move SQL tests of pg_stat_io for WAL data to recovery test 029_stats_restart
- 428fadb7e97e 18.0 landed
-
Add data for WAL in pg_stat_io and backend statistics
- a051e71e28a1 18.0 landed
-
Improve comment on top of pgstat_count_io_op_time()
- b998fedab74c 18.0 landed
-
Refactor pgstat_prepare_io_time() with an input argument instead of a GUC
- 3c9d9acae0bc 17.0 landed
On Thu, Nov 09, 2023 at 02:39:26PM +0300, Nazir Bilal Yavuz wrote: > There are some differences between pg_stat_wal and pg_stat_io while > collecting WAL stats. For example in the XLogWrite() function in the > xlog.c file, pg_stat_wal counts wal_writes as write system calls. This > is not something we want for pg_stat_io since pg_stat_io counts the > number of blocks rather than the system calls, so instead incremented > pg_stat_io by npages. > > Could that cause a problem since pg_stat_wal's behaviour will be > changed? Of course, as an alternative we could change pg_stat_io's > behaviour but in the end either pg_stat_wal's or pg_stat_io's > behaviour will be changed. Yep, that could be confusing for existing applications that track the information of pg_stat_wal. The number of writes is not something that can be correctly shared between both. The timings for the writes and the syncs could be shared at least, right? This slightly relates to pgstat_count_io_op_n() in your latest patch, where it feels a bit weird to see an update of PendingWalStats.wal_sync sit in the middle of a routine dedicated to pg_stat_io.. I am not completely sure what's the right balance here, but I would try to implement things so as pg_stat_io paths does not need to know about PendingWalStats. -- Michael