]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Flush WAL stats in bgwriter
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 2 Oct 2023 09:39:35 +0000 (12:39 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 2 Oct 2023 09:49:29 +0000 (12:49 +0300)
bgwriter can write out WAL, but did not flush the WAL pgstat counters,
so the writes were not seen in pg_stat_wal.

Back-patch to v14, where pg_stat_wal was introduced.

Author: Nazir Bilal Yavuz
Reviewed-by: Matthias van de Meent, Kyotaro Horiguchi
Discussion: https://www.postgresql.org/message-id/CAN55FZ2FPYngovZstr%3D3w1KSEHe6toiZwrurbhspfkXe5UDocg%40mail.gmail.com

src/backend/postmaster/bgwriter.c

index 91e6f6ea18aad1a525273f5f40d1b6da42062978..470dd2673cab94ff4ce67d42823db57fbc456bb9 100644 (file)
@@ -242,6 +242,7 @@ BackgroundWriterMain(void)
 
                /* Report pending statistics to the cumulative stats system */
                pgstat_report_bgwriter();
+               pgstat_report_wal(true);
 
                if (FirstCallSinceLastCheckpoint())
                {