diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-03-08 08:46:48 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-03-08 08:46:48 -0500 |
commit | 77a1d1e79892a20ed15a67be42b96949b8546bf6 (patch) | |
tree | 2558fdac8319cde7e1d6fa9280467580b273e074 /src/backend/commands | |
parent | ba0a198fb133eb3426bffdc2e369cce1bafe1612 (diff) | |
download | postgresql-77a1d1e79892a20ed15a67be42b96949b8546bf6.tar.gz postgresql-77a1d1e79892a20ed15a67be42b96949b8546bf6.zip |
Department of second thoughts: remove PD_ALL_FROZEN.
Commit a892234f830e832110f63fc0a2afce2fb21d1584 added a second bit per
page to the visibility map, which still seems like a good idea, but it
also added a second page-level bit alongside PD_ALL_VISIBLE to track
whether the visibility map bit was set. That no longer seems like a
clever plan, because we don't really need that bit for anything. We
always clear both bits when the page is modified anyway.
Patch by me, reviewed by Kyotaro Horiguchi and Masahiko Sawada.
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/vacuumlazy.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index 8f7b2486e00..363b2d0d10c 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -766,7 +766,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, log_newpage_buffer(buf, true); PageSetAllVisible(page); - PageSetAllFrozen(page); visibilitymap_set(onerel, blkno, buf, InvalidXLogRecPtr, vmbuffer, InvalidTransactionId, VISIBILITYMAP_ALL_VISIBLE | VISIBILITYMAP_ALL_FROZEN); @@ -1024,6 +1023,9 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, { uint8 flags = VISIBILITYMAP_ALL_VISIBLE; + if (all_frozen) + flags |= VISIBILITYMAP_ALL_FROZEN; + /* * It should never be the case that the visibility map page is set * while the page-level bit is clear, but the reverse is allowed @@ -1038,11 +1040,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, * rare cases after a crash, it is not worth optimizing. */ PageSetAllVisible(page); - if (all_frozen) - { - PageSetAllFrozen(page); - flags |= VISIBILITYMAP_ALL_FROZEN; - } MarkBufferDirty(buf); visibilitymap_set(onerel, blkno, buf, InvalidXLogRecPtr, vmbuffer, visibility_cutoff_xid, flags); @@ -1093,10 +1090,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, else if (all_visible_according_to_vm && all_visible && all_frozen && !VM_ALL_FROZEN(onerel, blkno, &vmbuffer)) { - /* Page is marked all-visible but should be all-frozen */ - PageSetAllFrozen(page); - MarkBufferDirty(buf); - /* * We can pass InvalidTransactionId as the cutoff XID here, * because setting the all-frozen bit doesn't cause recovery @@ -1344,11 +1337,7 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer, */ if (heap_page_is_all_visible(onerel, buffer, &visibility_cutoff_xid, &all_frozen)) - { PageSetAllVisible(page); - if (all_frozen) - PageSetAllFrozen(page); - } /* * All the changes to the heap page have been done. If the all-visible |