Simplify vacuum visibility assertion
authorMelanie Plageman <[email protected]>
Wed, 10 Dec 2025 16:10:01 +0000 (11:10 -0500)
committerMelanie Plageman <[email protected]>
Wed, 10 Dec 2025 16:10:01 +0000 (11:10 -0500)
Phase I vacuum gives the page a once-over after pruning and freezing to
check that the values of all_visible and all_frozen agree with the
result of heap_page_is_all_visible(). This is meant to keep the logic in
phase I for determining visibility in sync with the logic in phase III.

Rewrite the assertion to avoid an Assert(false).

Suggested by Andres Freund.

Author: Melanie Plageman <[email protected]>
Discussion: https://postgr.es/m/mhf4vkmh3j57zx7vuxp4jagtdzwhu3573pgfpmnjwqa6i6yj5y%40sy4ymcdtdklo

src/backend/access/heap/vacuumlazy.c

index eff7c39da7fe50317e7bc479a24b4f5af920c23e..e8c99c3773dc2b98692ba676500545d5531e5be7 100644 (file)
@@ -2042,10 +2042,9 @@ lazy_scan_prune(LVRelState *vacrel,
 
        Assert(presult.lpdead_items == 0);
 
-       if (!heap_page_is_all_visible(vacrel->rel, buf,
-                                     vacrel->cutoffs.OldestXmin, &debug_all_frozen,
-                                     &debug_cutoff, &vacrel->offnum))
-           Assert(false);
+       Assert(heap_page_is_all_visible(vacrel->rel, buf,
+                                       vacrel->cutoffs.OldestXmin, &debug_all_frozen,
+                                       &debug_cutoff, &vacrel->offnum));
 
        Assert(presult.all_frozen == debug_all_frozen);