Flush WAL stats in bgwriter
authorHeikki Linnakangas
Mon, 2 Oct 2023 09:39:35 +0000 (12:39 +0300)
committerHeikki Linnakangas
Mon, 2 Oct 2023 09:50:32 +0000 (12:50 +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 715d5195bb671e9c6a1df6dc98ba805b6d4be43a..bba79e0b6a0c733526c36e269af2d537e667f3f5 100644 (file)
@@ -247,6 +247,7 @@ BackgroundWriterMain(void)
         * Send off activity statistics to the stats collector
         */
        pgstat_send_bgwriter();
+       pgstat_send_wal(true);
 
        if (FirstCallSinceLastCheckpoint())
        {