Re: About to add WAL write/fsync statistics to pg_stat_wal view
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: ikedamsh <ikedamsh@oss.nttdata.com>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>,
Masahiko Sawada <sawada.mshk@gmail.com>, Li Japin <japinli@hotmail.com>,
kuroda.hayato@fujitsu.com
Date: 2021-03-23T07:10:58Z
Lists: pgsql-hackers
On 2021/03/22 20:25, ikedamsh wrote: > Agreed. Users can know whether the stats is for walreceiver or not. The > pg_stat_wal view in standby server shows for the walreceiver, and in primary > server it shows for the others. So, I updated the document. > (v20-0003-Makes-the-wal-receiver-report-WAL-statistics.patch) Thanks for updating the docs! There was the discussion about when the stats collector is invoked, at [1]. Currently during archive recovery or standby, the stats collector is invoked when the startup process reaches the consistent state, sends PMSIGNAL_BEGIN_HOT_STANDBY, and then the system is starting accepting read-only connections. But walreceiver can be invoked at earlier stage. This can cause walreceiver to generate and send the statistics about WAL writing even though the stats collector has not been running yet. This might be problematic? If so, maybe we need to ensure that the stats collector is invoked before walreceiver? During recovery, the stats collector is not invoked if hot standby mode is disabled. But walreceiver can be running in this case. So probably we should change walreceiver so that it's invoked even when hot standby is disabled? Otherwise we cannnot collect the statistics about WAL writing by walreceiver in that case. [1] https://postgr.es/m/e5a982a5-8bb4-5a10-cf9a-40dd1921bdb5@oss.nttdata.com Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION
Commits
-
Send statistics collected during shutdown checkpoint to the stats collector.
- b82640df0062 14.0 landed
-
Force to send remaining WAL stats to the stats collector at walwriter exit.
- 33394ee6f243 14.0 landed
-
Track total amounts of times spent writing and syncing WAL data to disk.
- ff99918c625a 14.0 landed
-
Retry short writes when flushing WAL.
- 79ce29c734c6 9.4.0 cited