diff options
| author | Fujii Masao | 2024-10-02 02:17:47 +0000 |
|---|---|---|
| committer | Fujii Masao | 2024-10-02 02:17:47 +0000 |
| commit | 17cc5f666f6aada21eb3237974c50681ba4814ea (patch) | |
| tree | a8d3fad9a3262e2b9d7d82fae23a78cddc1cadde /src/include | |
| parent | 506eede7111ae7c88bd3c21f653bbb65846bd4a5 (diff) | |
Fix inconsistent reporting of checkpointer stats.
Previously, the pg_stat_checkpointer view and the checkpoint completion
log message could show different numbers for buffers written
during checkpoints. The view only counted shared buffers,
while the log message included both shared and SLRU buffers,
causing inconsistencies.
This commit resolves the issue by updating both the view and the log message
to separately report shared and SLRU buffers written during checkpoints.
A new slru_written column is added to the pg_stat_checkpointer view
to track SLRU buffers, while the existing buffers_written column now
tracks only shared buffers. This change would help users distinguish
between the two types of buffers, in the pg_stat_checkpointer view and
the checkpoint complete log message, respectively.
Bump catalog version.
Author: Nitin Jadhav
Reviewed-by: Bharath Rupireddy, Michael Paquier, Kyotaro Horiguchi, Robert Haas
Reviewed-by: Andres Freund, vignesh C, Fujii Masao
Discussion: https://postgr.es/m/CAMm1aWb18EpT0whJrjG+-nyhNouXET6ZUw0pNYYAe+NezpvsAA@mail.gmail.com
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/xlog.h | 1 | ||||
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/pg_proc.dat | 5 | ||||
| -rw-r--r-- | src/include/pgstat.h | 1 |
4 files changed, 8 insertions, 1 deletions
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 36f6e4e4b4e..34ad46c067b 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -167,6 +167,7 @@ typedef struct CheckpointStatsData TimestampTz ckpt_end_t; /* end of checkpoint */ int ckpt_bufs_written; /* # of buffers written */ + int ckpt_slru_written; /* # of SLRU buffers written */ int ckpt_segs_added; /* # of new xlog segments created */ int ckpt_segs_removed; /* # of xlog segments deleted */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 3c89b70f9e4..504bbe53276 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202409302 +#define CATALOG_VERSION_NO 202410021 #endif diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index 05fcbf75156..77f54a79e6a 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -5847,6 +5847,11 @@ proname => 'pg_stat_get_checkpointer_buffers_written', provolatile => 's', proparallel => 'r', prorettype => 'int8', proargtypes => '', prosrc => 'pg_stat_get_checkpointer_buffers_written' }, +{ oid => '8573', + descr => 'statistics: number of SLRU buffers written during checkpoints and restartpoints', + proname => 'pg_stat_get_checkpointer_slru_written', provolatile => 's', + proparallel => 'r', prorettype => 'int8', proargtypes => '', + prosrc => 'pg_stat_get_checkpointer_slru_written' }, { oid => '6314', descr => 'statistics: last reset for the checkpointer', proname => 'pg_stat_get_checkpointer_stat_reset_time', provolatile => 's', proparallel => 'r', prorettype => 'timestamptz', proargtypes => '', diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 476acd680c0..df53fa2d4f9 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -301,6 +301,7 @@ typedef struct PgStat_CheckpointerStats PgStat_Counter write_time; /* times in milliseconds */ PgStat_Counter sync_time; PgStat_Counter buffers_written; + PgStat_Counter slru_written; TimestampTz stat_reset_timestamp; } PgStat_CheckpointerStats; |
