1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Introduce 'options' argument to heap_page_prune()

Currently there is only one option, HEAP_PAGE_PRUNE_MARK_UNUSED_NOW
which replaces the old boolean argument, but upcoming patches will
introduce at least one more. Having a lot of boolean arguments makes
it hard to see at the call sites what the arguments mean, so prefer a
bitmask of options with human-readable names.

Author: Melanie Plageman <melanieplageman@gmail.com>
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Discussion: https://www.postgresql.org/message-id/20240401172219.fngjosaqdgqqvg4e@liskov
This commit is contained in:
Heikki Linnakangas
2024-04-02 00:56:05 +03:00
parent 959b38d770
commit 3d0f730bf1
3 changed files with 16 additions and 9 deletions

View File

@ -1425,6 +1425,7 @@ lazy_scan_prune(LVRelState *vacrel,
bool all_visible,
all_frozen;
TransactionId visibility_cutoff_xid;
int prune_options = 0;
int64 fpi_before = pgWalUsage.wal_fpi;
OffsetNumber deadoffsets[MaxHeapTuplesPerPage];
HeapTupleFreeze frozen[MaxHeapTuplesPerPage];
@ -1458,10 +1459,12 @@ lazy_scan_prune(LVRelState *vacrel,
* that were deleted from indexes.
*
* If the relation has no indexes, we can immediately mark would-be dead
* items LP_UNUSED, so mark_unused_now should be true if no indexes and
* false otherwise.
* items LP_UNUSED.
*/
heap_page_prune(rel, buf, vacrel->vistest, vacrel->nindexes == 0,
prune_options = 0;
if (vacrel->nindexes == 0)
prune_options = HEAP_PAGE_PRUNE_MARK_UNUSED_NOW;
heap_page_prune(rel, buf, vacrel->vistest, prune_options,
&presult, PRUNE_VACUUM_SCAN, &vacrel->offnum);
/*