v9-0021-Reorder-heap_page_prune_and_freeze-parameters.patch
text/x-patch
Filename: v9-0021-Reorder-heap_page_prune_and_freeze-parameters.patch
Type: text/x-patch
Part: 19
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v9-0021
Subject: Reorder heap_page_prune_and_freeze parameters
| File | + | − |
|---|---|---|
| src/backend/access/heap/pruneheap.c | 19 | 19 |
| src/backend/access/heap/vacuumlazy.c | 3 | 3 |
| src/include/access/heapam.h | 2 | 2 |
From fd56683e500e528ee9da99a7326368aca8cb8bac Mon Sep 17 00:00:00 2001 From: Melanie Plageman <melanieplageman@gmail.com> Date: Thu, 31 Jul 2025 12:08:18 -0400 Subject: [PATCH v9 21/22] Reorder heap_page_prune_and_freeze parameters Reorder parameters so that all of the output parameters are together at the end of the parameter list. --- src/backend/access/heap/pruneheap.c | 38 ++++++++++++++-------------- src/backend/access/heap/vacuumlazy.c | 6 ++--- src/include/access/heapam.h | 4 +-- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index b9f85d1452e..53cb81d2510 100644 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@ -297,10 +297,10 @@ heap_page_prune_opt(Relation relation, Buffer buffer, Buffer *vmbuffer) * not the relation has indexes, since we cannot safely determine * that during on-access pruning with the current implementation. */ - heap_page_prune_and_freeze(relation, buffer, false, + heap_page_prune_and_freeze(relation, buffer, options, false, vmbuffer ? *vmbuffer : InvalidBuffer, - vistest, options, - NULL, &presult, PRUNE_ON_ACCESS, + vistest, + NULL, PRUNE_ON_ACCESS, &presult, &dummy_off_loc, NULL, NULL); /* @@ -645,6 +645,15 @@ heap_page_will_freeze(Relation relation, Buffer buffer, * also need to account for a reduction in the length of the line pointer * array following array truncation by us. * + * options: + * MARK_UNUSED_NOW indicates that dead items can be set LP_UNUSED during + * pruning. + * + * FREEZE indicates that we will also freeze tuples, and will return + * 'all_visible', 'all_frozen' flags to the caller. + * + * UPDATE_VM indicates that we will set the page's status in the VM. + * * If the HEAP_PRUNE_FREEZE option is set, we will also freeze tuples if it's * required in order to advance relfrozenxid / relminmxid, or if it's * considered advantageous for overall system performance to do so now. The @@ -663,30 +672,21 @@ heap_page_will_freeze(Relation relation, Buffer buffer, * contain the required block of the visibility map. * * vistest is used to distinguish whether tuples are DEAD or RECENTLY_DEAD - * (see heap_prune_satisfies_vacuum). - * - * options: - * MARK_UNUSED_NOW indicates that dead items can be set LP_UNUSED during - * pruning. - * - * FREEZE indicates that we will also freeze tuples, and will return - * 'all_visible', 'all_frozen' flags to the caller. - * - * UPDATE_VM indicates that we will set the page's status in the VM. + * (see heap_prune_satisfies_vacuum). It is an input parameter. * * cutoffs contains the freeze cutoffs, established by VACUUM at the beginning * of vacuuming the relation. Required if HEAP_PRUNE_FREEZE option is set. * cutoffs->OldestXmin is also used to determine if dead tuples are - * HEAPTUPLE_RECENTLY_DEAD or HEAPTUPLE_DEAD. + * HEAPTUPLE_RECENTLY_DEAD or HEAPTUPLE_DEAD. It is an input parameter. + * + * reason indicates why the pruning is performed. It is included in the WAL + * record for debugging and analysis purposes, but otherwise has no effect. * * presult contains output parameters needed by callers, such as the number of * tuples removed and the offsets of dead items on the page after pruning. * heap_page_prune_and_freeze() is responsible for initializing it. Required * by all callers. * - * reason indicates why the pruning is performed. It is included in the WAL - * record for debugging and analysis purposes, but otherwise has no effect. - * * off_loc is the offset location required by the caller to use in error * callback. * @@ -699,13 +699,13 @@ heap_page_will_freeze(Relation relation, Buffer buffer, */ void heap_page_prune_and_freeze(Relation relation, Buffer buffer, + int options, bool blk_known_av, Buffer vmbuffer, GlobalVisState *vistest, - int options, struct VacuumCutoffs *cutoffs, - PruneFreezeResult *presult, PruneReason reason, + PruneFreezeResult *presult, OffsetNumber *off_loc, TransactionId *new_relfrozen_xid, MultiXactId *new_relmin_mxid) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 7558ac697f1..99b9cab0974 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -1991,11 +1991,11 @@ lazy_scan_prune(LVRelState *vacrel, if (vacrel->nindexes == 0) prune_options |= HEAP_PAGE_PRUNE_MARK_UNUSED_NOW; - heap_page_prune_and_freeze(rel, buf, + heap_page_prune_and_freeze(rel, buf, prune_options, all_visible_according_to_vm, vmbuffer, - vacrel->vistest, prune_options, - &vacrel->cutoffs, &presult, PRUNE_VACUUM_SCAN, + vacrel->vistest, + &vacrel->cutoffs, PRUNE_VACUUM_SCAN, &presult, &vacrel->offnum, &vacrel->NewRelfrozenXid, &vacrel->NewRelminMxid); diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 16f7904a21e..0c4e5607627 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -394,13 +394,13 @@ struct GlobalVisState; extern void heap_page_prune_opt(Relation relation, Buffer buffer, Buffer *vmbuffer); extern void heap_page_prune_and_freeze(Relation relation, Buffer buffer, + int options, bool blk_known_av, Buffer vmbuffer, struct GlobalVisState *vistest, - int options, struct VacuumCutoffs *cutoffs, - PruneFreezeResult *presult, PruneReason reason, + PruneFreezeResult *presult, OffsetNumber *off_loc, TransactionId *new_relfrozen_xid, MultiXactId *new_relmin_mxid); -- 2.43.0