diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-06-03 08:43:41 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-06-03 08:43:41 -0400 |
commit | fdfaccfa798c1c9993feae1fac6e0f79d72aa7b7 (patch) | |
tree | c0b5ccc353176e70438c327e3323ec45a42fde11 /src/backend/commands/vacuumlazy.c | |
parent | a3b30763cc8686f5b4cd121ef0bf510c1533ac22 (diff) |
Cosmetic improvements to freeze map code.
Per post-commit review comments from Andres Freund, improve variable
names, comments, and in one place, slightly improve the code structure.
Masahiko Sawada
Diffstat (limited to 'src/backend/commands/vacuumlazy.c')
-rw-r--r-- | src/backend/commands/vacuumlazy.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index 426e7560930..e39321b0c76 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -1192,9 +1192,9 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, } /* - * If the page is marked as all-visible but not all-frozen, we should - * so mark it. Note that all_frozen is only valid if all_visible is - * true, so we must check both. + * If the all-visible page is turned out to be all-frozen but not marked, + * we should so mark it. Note that all_frozen is only valid if all_visible + * is true, so we must check both. */ else if (all_visible_according_to_vm && all_visible && all_frozen && !VM_ALL_FROZEN(onerel, blkno, &vmbuffer)) @@ -2068,6 +2068,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, if (ItemIdIsDead(itemid)) { all_visible = false; + *all_frozen = false; break; } @@ -2087,6 +2088,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, if (!HeapTupleHeaderXminCommitted(tuple.t_data)) { all_visible = false; + *all_frozen = false; break; } @@ -2098,6 +2100,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, if (!TransactionIdPrecedes(xmin, OldestXmin)) { all_visible = false; + *all_frozen = false; break; } @@ -2116,23 +2119,16 @@ heap_page_is_all_visible(Relation rel, Buffer buf, case HEAPTUPLE_RECENTLY_DEAD: case HEAPTUPLE_INSERT_IN_PROGRESS: case HEAPTUPLE_DELETE_IN_PROGRESS: - all_visible = false; - break; - + { + all_visible = false; + *all_frozen = false; + break; + } default: elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result"); break; } } /* scan along page */ - /* - * We don't bother clearing *all_frozen when the page is discovered not to - * be all-visible, so do that now if necessary. The page might fail to be - * all-frozen for other reasons anyway, but if it's not all-visible, then - * it definitely isn't all-frozen. - */ - if (!all_visible) - *all_frozen = false; - return all_visible; } |