mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1191,6 +1191,12 @@ pg_stat_get_checkpointer_num_requested(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_INT64(pgstat_fetch_stat_checkpointer()->num_requested);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_checkpointer_num_performed(PG_FUNCTION_ARGS)
|
||||
{
|
||||
PG_RETURN_INT64(pgstat_fetch_stat_checkpointer()->num_performed);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_checkpointer_restartpoints_timed(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user