mirror of
https://github.com/postgres/postgres.git
synced 2025-08-14 02:22:38 +03:00
Department of second thoughts: remove PD_ALL_FROZEN.
Commit a892234f83
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.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user