From 674b54adc3a92093f0cc25cd9117bf32956c6f2c Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz Date: Wed, 21 Jun 2023 13:39:13 +0300 Subject: [PATCH v2 2/2] Flush WAL in bgwriter bgwriter writes existing WAL from buffers to disk but pg_stat_wal doesn't count them because bgwriter doesn't call pgstat_report_wal() to update WAL statistics. Call pgstat_report_wal() to flush WAL in bgwriter. --- src/backend/postmaster/bgwriter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index caad642ec9..f2e4f23d9f 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -241,6 +241,7 @@ BackgroundWriterMain(void) /* Report pending statistics to the cumulative stats system */ pgstat_report_bgwriter(); + pgstat_report_wal(true); if (FirstCallSinceLastCheckpoint()) { -- 2.40.1