diff options
author | Andres Freund <andres@anarazel.de> | 2021-08-04 19:16:04 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2021-08-04 19:16:04 -0700 |
commit | 1bc8e7b0991c1eae5fa6dc2d29bb2280efb52740 (patch) | |
tree | a1648b9a8353e9405536c7298f44558407b9e70f /src/backend/storage/buffer/bufmgr.c | |
parent | cc8033e1dafe89271aa86c2f2f86a828956929f0 (diff) | |
download | postgresql-1bc8e7b0991c1eae5fa6dc2d29bb2280efb52740.tar.gz postgresql-1bc8e7b0991c1eae5fa6dc2d29bb2280efb52740.zip |
pgstat: split reporting/fetching of bgwriter and checkpointer stats.
These have been unrelated since bgwriter and checkpointer were split into two
processes in 806a2aee379. As there several pending patches (shared memory
stats, extending the set of tracked IO / buffer statistics) that are made a
bit more awkward by the grouping, split them. Done separately to make
reviewing easier.
This does *not* change the contents of pg_stat_bgwriter or move fields out of
bgwriter/checkpointer stats that arguably do not belong in either. However
pgstat_fetch_global() was renamed and split into
pgstat_fetch_stat_checkpointer() and pgstat_fetch_stat_bgwriter().
Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20210405092914.mmxqe7j56lsjfsej@alap3.anarazel.de
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 33d99f604ad..77685bdde28 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -2137,7 +2137,7 @@ BufferSync(int flags) if (SyncOneBuffer(buf_id, false, &wb_context) & BUF_WRITTEN) { TRACE_POSTGRESQL_BUFFER_SYNC_WRITTEN(buf_id); - BgWriterStats.m_buf_written_checkpoints++; + PendingCheckpointerStats.m_buf_written_checkpoints++; num_written++; } } @@ -2247,7 +2247,7 @@ BgBufferSync(WritebackContext *wb_context) strategy_buf_id = StrategySyncStart(&strategy_passes, &recent_alloc); /* Report buffer alloc counts to pgstat */ - BgWriterStats.m_buf_alloc += recent_alloc; + PendingBgWriterStats.m_buf_alloc += recent_alloc; /* * If we're not running the LRU scan, just stop after doing the stats @@ -2437,7 +2437,7 @@ BgBufferSync(WritebackContext *wb_context) reusable_buffers++; if (++num_written >= bgwriter_lru_maxpages) { - BgWriterStats.m_maxwritten_clean++; + PendingBgWriterStats.m_maxwritten_clean++; break; } } @@ -2445,7 +2445,7 @@ BgBufferSync(WritebackContext *wb_context) reusable_buffers++; } - BgWriterStats.m_buf_written_clean += num_written; + PendingBgWriterStats.m_buf_written_clean += num_written; #ifdef BGW_DEBUG elog(DEBUG1, "bgwriter: recent_alloc=%u smoothed=%.2f delta=%ld ahead=%d density=%.2f reusable_est=%d upcoming_est=%d scanned=%d wrote=%d reusable=%d", |