mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Introduce pg_stat_checkpointer
Historically, the statistics of the checkpointer have been always part of pg_stat_bgwriter. This commit removes a few columns from pg_stat_bgwriter, and introduces pg_stat_checkpointer with equivalent, renamed columns (plus a new one for the reset timestamp): - checkpoints_timed -> num_timed - checkpoints_req -> num_requested - checkpoint_write_time -> write_time - checkpoint_sync_time -> sync_time - buffers_checkpoint -> buffers_written The fields of PgStat_CheckpointerStats and its SQL functions are renamed to match with the new field names, for consistency. Note that background writer and checkpointer have been split into two different processes in commits806a2aee37
andbf405ba8e4
. The pgstat structures were already split, making this change straight-forward. Bump catalog version. Author: Bharath Rupireddy Reviewed-by: Bertrand Drouvot, Andres Freund, Michael Paquier Discussion: https://postgr.es/m/CALj2ACVxX2ii=66RypXRweZe2EsBRiPMj0aHfRfHUeXJcC7kHg@mail.gmail.com
This commit is contained in:
@ -47,11 +47,11 @@ pgstat_report_checkpointer(void)
|
||||
pgstat_begin_changecount_write(&stats_shmem->changecount);
|
||||
|
||||
#define CHECKPOINTER_ACC(fld) stats_shmem->stats.fld += PendingCheckpointerStats.fld
|
||||
CHECKPOINTER_ACC(timed_checkpoints);
|
||||
CHECKPOINTER_ACC(requested_checkpoints);
|
||||
CHECKPOINTER_ACC(checkpoint_write_time);
|
||||
CHECKPOINTER_ACC(checkpoint_sync_time);
|
||||
CHECKPOINTER_ACC(buf_written_checkpoints);
|
||||
CHECKPOINTER_ACC(num_timed);
|
||||
CHECKPOINTER_ACC(num_requested);
|
||||
CHECKPOINTER_ACC(write_time);
|
||||
CHECKPOINTER_ACC(sync_time);
|
||||
CHECKPOINTER_ACC(buffers_written);
|
||||
#undef CHECKPOINTER_ACC
|
||||
|
||||
pgstat_end_changecount_write(&stats_shmem->changecount);
|
||||
@ -92,6 +92,7 @@ pgstat_checkpointer_reset_all_cb(TimestampTz ts)
|
||||
&stats_shmem->stats,
|
||||
sizeof(stats_shmem->stats),
|
||||
&stats_shmem->changecount);
|
||||
stats_shmem->stats.stat_reset_timestamp = ts;
|
||||
LWLockRelease(&stats_shmem->lock);
|
||||
}
|
||||
|
||||
@ -113,10 +114,10 @@ pgstat_checkpointer_snapshot_cb(void)
|
||||
|
||||
/* compensate by reset offsets */
|
||||
#define CHECKPOINTER_COMP(fld) pgStatLocal.snapshot.checkpointer.fld -= reset.fld;
|
||||
CHECKPOINTER_COMP(timed_checkpoints);
|
||||
CHECKPOINTER_COMP(requested_checkpoints);
|
||||
CHECKPOINTER_COMP(checkpoint_write_time);
|
||||
CHECKPOINTER_COMP(checkpoint_sync_time);
|
||||
CHECKPOINTER_COMP(buf_written_checkpoints);
|
||||
CHECKPOINTER_COMP(num_timed);
|
||||
CHECKPOINTER_COMP(num_requested);
|
||||
CHECKPOINTER_COMP(write_time);
|
||||
CHECKPOINTER_COMP(sync_time);
|
||||
CHECKPOINTER_COMP(buffers_written);
|
||||
#undef CHECKPOINTER_COMP
|
||||
}
|
||||
|
Reference in New Issue
Block a user