From: Heikki Linnakangas Date: Mon, 18 Nov 2013 07:51:09 +0000 (+0200) Subject: Count locked pages that don't need vacuuming as scanned. X-Git-Tag: REL9_2_6~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3379263b6ded774acb96288d1e67caa37dcba0de;p=postgresql Count locked pages that don't need vacuuming as scanned. 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. --- diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index 28f169e59c..782f59e64d 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -589,6 +589,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);