]> granicus.if.org Git - postgresql/commitdiff
Count locked pages that don't need vacuuming as scanned.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 18 Nov 2013 07:51:09 +0000 (09:51 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 18 Nov 2013 08:16:31 +0000 (10:16 +0200)
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

index c2b3d719b9392c52366e33cee612a13bda1a84aa..11d0192931f7e88a332fff6b1346f652ac7d1935 100644 (file)
@@ -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);