From c584781bcc686ebc0b3139e3e166607537336f69 Mon Sep 17 00:00:00 2001 From: Masahiko Sawada Date: Tue, 13 Aug 2024 18:49:45 -0700 Subject: Use pgBufferUsage for buffer usage tracking in analyze. Previously, (auto)analyze used global variables VacuumPageHit, VacuumPageMiss, and VacuumPageDirty to track buffer usage. However, pgBufferUsage provides a more generic way to track buffer usage with support functions. This change replaces those global variables with pgBufferUsage in analyze. Since analyze was the sole user of those variables, it removes their declarations. Vacuum previously used those variables but replaced them with pgBufferUsage as part of a bug fix, commit 5cd72cc0c. Additionally, it adjusts the buffer usage message in both vacuum and analyze for better consistency. Author: Anthonin Bonnefoy Reviewed-by: Masahiko Sawada, Michael Paquier Discussion: https://postgr.es/m/CAO6_Xqr__kTTCLkftqS0qSCm-J7_xbRG3Ge2rWhucxQJMJhcRA%40mail.gmail.com --- src/backend/storage/buffer/bufmgr.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/backend/storage/buffer/bufmgr.c') diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 4415ba648ae..fb38c7bdd45 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1192,7 +1192,6 @@ PinBufferForBlock(Relation rel, } if (*foundPtr) { - VacuumPageHit++; pgstat_count_io_op(io_object, io_context, IOOP_HIT); if (VacuumCostActive) VacuumCostBalance += VacuumCostPageHit; @@ -1588,7 +1587,6 @@ WaitReadBuffers(ReadBuffersOperation *operation) false); } - VacuumPageMiss += io_buffers_len; if (VacuumCostActive) VacuumCostBalance += VacuumCostPageMiss * io_buffers_len; } @@ -2582,7 +2580,6 @@ MarkBufferDirty(Buffer buffer) */ if (!(old_buf_state & BM_DIRTY)) { - VacuumPageDirty++; pgBufferUsage.shared_blks_dirtied++; if (VacuumCostActive) VacuumCostBalance += VacuumCostPageDirty; @@ -5122,7 +5119,6 @@ MarkBufferDirtyHint(Buffer buffer, bool buffer_std) if (dirtied) { - VacuumPageDirty++; pgBufferUsage.shared_blks_dirtied++; if (VacuumCostActive) VacuumCostBalance += VacuumCostPageDirty; -- cgit v1.2.3