From 559efce1d684069acf234a5cb032acba84e70938 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Mon, 30 Sep 2024 11:56:05 +0900 Subject: Add num_done counter to the pg_stat_checkpointer view. Checkpoints can be skipped when the server is idle. The existing num_timed and num_requested counters in pg_stat_checkpointer track both completed and skipped checkpoints, but there was no way to count only the completed ones. This commit introduces the num_done counter, which tracks only completed checkpoints, making it easier to see how many were actually performed. Bump catalog version. Author: Anton A. Melnikov Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/9ea77f40-818d-4841-9dee-158ac8f6e690@oss.nttdata.com --- src/backend/utils/activity/pgstat_checkpointer.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/backend/utils/activity/pgstat_checkpointer.c') diff --git a/src/backend/utils/activity/pgstat_checkpointer.c b/src/backend/utils/activity/pgstat_checkpointer.c index bbfc9c7e183..4a0a2d1493a 100644 --- a/src/backend/utils/activity/pgstat_checkpointer.c +++ b/src/backend/utils/activity/pgstat_checkpointer.c @@ -49,6 +49,7 @@ pgstat_report_checkpointer(void) #define CHECKPOINTER_ACC(fld) stats_shmem->stats.fld += PendingCheckpointerStats.fld CHECKPOINTER_ACC(num_timed); CHECKPOINTER_ACC(num_requested); + CHECKPOINTER_ACC(num_performed); CHECKPOINTER_ACC(restartpoints_timed); CHECKPOINTER_ACC(restartpoints_requested); CHECKPOINTER_ACC(restartpoints_performed); @@ -127,6 +128,7 @@ pgstat_checkpointer_snapshot_cb(void) #define CHECKPOINTER_COMP(fld) pgStatLocal.snapshot.checkpointer.fld -= reset.fld; CHECKPOINTER_COMP(num_timed); CHECKPOINTER_COMP(num_requested); + CHECKPOINTER_COMP(num_performed); CHECKPOINTER_COMP(restartpoints_timed); CHECKPOINTER_COMP(restartpoints_requested); CHECKPOINTER_COMP(restartpoints_performed); -- cgit v1.2.3