diff options
Diffstat (limited to 'src/backend/postmaster/checkpointer.c')
-rw-r--r-- | src/backend/postmaster/checkpointer.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index e733c70368a..c937c39f502 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -213,6 +213,16 @@ CheckpointerMain(void) last_checkpoint_time = last_xlog_switch_time = (pg_time_t) time(NULL); /* + * Write out stats after shutdown. This needs to be called by exactly one + * process during a normal shutdown, and since checkpointer is shut down + * very late... + * + * Walsenders are shut down after the checkpointer, but currently don't + * report stats. If that changes, we need a more complicated solution. + */ + before_shmem_exit(pgstat_before_server_shutdown, 0); + + /* * Create a memory context that we will do all our work in. We do this so * that we can reset the context during error recovery and thereby avoid * possible memory leaks. Formerly this code just ran in @@ -358,7 +368,7 @@ CheckpointerMain(void) if (((volatile CheckpointerShmemStruct *) CheckpointerShmem)->ckpt_flags) { do_checkpoint = true; - PendingCheckpointerStats.m_requested_checkpoints++; + PendingCheckpointerStats.requested_checkpoints++; } /* @@ -372,7 +382,7 @@ CheckpointerMain(void) if (elapsed_secs >= CheckPointTimeout) { if (!do_checkpoint) - PendingCheckpointerStats.m_timed_checkpoints++; + PendingCheckpointerStats.timed_checkpoints++; do_checkpoint = true; flags |= CHECKPOINT_CAUSE_TIME; } @@ -569,7 +579,7 @@ HandleCheckpointerInterrupts(void) * updates the statistics, increment the checkpoint request and flush * out pending statistic. */ - PendingCheckpointerStats.m_requested_checkpoints++; + PendingCheckpointerStats.requested_checkpoints++; ShutdownXLOG(0, 0); pgstat_report_checkpointer(); pgstat_report_wal(true); @@ -1262,9 +1272,9 @@ AbsorbSyncRequests(void) LWLockAcquire(CheckpointerCommLock, LW_EXCLUSIVE); /* Transfer stats counts into pending pgstats message */ - PendingCheckpointerStats.m_buf_written_backend + PendingCheckpointerStats.buf_written_backend += CheckpointerShmem->num_backend_writes; - PendingCheckpointerStats.m_buf_fsync_backend + PendingCheckpointerStats.buf_fsync_backend += CheckpointerShmem->num_backend_fsync; CheckpointerShmem->num_backend_writes = 0; |