Re: About to add WAL write/fsync statistics to pg_stat_wal view
Masahiro Ikeda <ikedamsh@oss.nttdata.com>
From: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Li Japin <japinli@hotmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>,
kuroda.hayato@fujitsu.com
Date: 2021-01-25T07:51:31Z
Lists: pgsql-hackers
Attachments
- v5_v6.diff (text/x-diff) patch v5
- v6-0001-Add-statistics-related-to-write-sync-wal-records.patch (text/x-diff) patch v6-0001
Hi, thanks for the reviews. I updated the attached patch. The summary of the changes is following. 1. fix document I followed another view's comments. 2. refactor issue_xlog_fsync() I removed "sync_called" variables, narrowed the "duration" scope and change the switch statement to if statement. 3. make wal-receiver report WAL statistics I add the code to collect the statistics for a written operation in XLogWalRcvWrite() and to report stats in WalReceiverMain(). Since WalReceiverMain() can loop fast, to avoid loading stats collector, I add "force" argument to the pgstat_send_wal function. If "force" is false, it can skip reporting until at least 500 msec since it last reported. WalReceiverMain() almost calls pgstat_send_wal() with "force" as false. Regards, -- Masahiro Ikeda 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