]> 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:12:22 +0000 (10:12 +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 28f169e59c58b8c369c0ba98c11cdb44df2237ae..782f59e64d2555534d038156889440fc18889d11 100644 (file)
@@ -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);