From ea2bb1b47d7629a17dbc0c7da66cf063f8d3a768 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 18 Nov 2013 09:51:09 +0200 Subject: [PATCH] Count locked pages that don't need vacuuming as scanned. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Previously, if VACUUM skipped vacuuming a page because it's pinned, it didn't count that page as scanned. However, that meant that relfrozenxid was not bumped up either, which prevented anti-wraparound vacuum from doing its job. Report by Миша Тюрин, analysis and patch by Sergey Burladyn and Jeff Janes. Backpatch to 9.2, where the skip-locked-pages behavior was introduced. --- src/backend/commands/vacuumlazy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index c2b3d719b9..11d0192931 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -602,6 +602,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, if (!lazy_check_needs_freeze(buf)) { UnlockReleaseBuffer(buf); + vacrelstats->scanned_pages++; continue; } LockBuffer(buf, BUFFER_LOCK_UNLOCK); -- 2.40.0