diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-04-02 00:56:05 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-04-02 00:56:05 +0300 |
commit | 3d0f730bf19fbc70cca58818c1ad7415e5aa7d62 (patch) | |
tree | abdfaa169dcb09e48f50ca59805213a67500265f /src/backend/access/heap/pruneheap.c | |
parent | 959b38d770ba1f8f35edab27ef3ccf8b1d99f5dd (diff) | |
download | postgresql-3d0f730bf19fbc70cca58818c1ad7415e5aa7d62.tar.gz postgresql-3d0f730bf19fbc70cca58818c1ad7415e5aa7d62.zip |
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
Diffstat (limited to 'src/backend/access/heap/pruneheap.c')
-rw-r--r-- | src/backend/access/heap/pruneheap.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index 5dd37b5a376..ef563e19aa5 100644 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@ -166,7 +166,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer) * not the relation has indexes, since we cannot safely determine * that during on-access pruning with the current implementation. */ - heap_page_prune(relation, buffer, vistest, false, + heap_page_prune(relation, buffer, vistest, 0, &presult, PRUNE_ON_ACCESS, &dummy_off_loc); /* @@ -211,8 +211,9 @@ heap_page_prune_opt(Relation relation, Buffer buffer) * vistest is used to distinguish whether tuples are DEAD or RECENTLY_DEAD * (see heap_prune_satisfies_vacuum). * - * mark_unused_now indicates whether or not dead items can be set LP_UNUSED - * during pruning. + * options: + * MARK_UNUSED_NOW indicates that dead items can be set LP_UNUSED during + * pruning. * * presult contains output parameters needed by callers such as the number of * tuples removed and the number of line pointers newly marked LP_DEAD. @@ -227,7 +228,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer) void heap_page_prune(Relation relation, Buffer buffer, GlobalVisState *vistest, - bool mark_unused_now, + int options, PruneResult *presult, PruneReason reason, OffsetNumber *off_loc) @@ -252,7 +253,7 @@ heap_page_prune(Relation relation, Buffer buffer, */ prstate.new_prune_xid = InvalidTransactionId; prstate.vistest = vistest; - prstate.mark_unused_now = mark_unused_now; + prstate.mark_unused_now = (options & HEAP_PAGE_PRUNE_MARK_UNUSED_NOW) != 0; prstate.snapshotConflictHorizon = InvalidTransactionId; prstate.nredirected = prstate.ndead = prstate.nunused = 0; prstate.ndeleted = 0; |