diff options
| author | Melanie Plageman <melanieplageman@gmail.com> | 2025-11-20 10:30:43 -0500 |
|---|---|---|
| committer | Melanie Plageman <melanieplageman@gmail.com> | 2025-11-20 10:32:14 -0500 |
| commit | 1937ed70621e203c99e651ce4430dd217743d150 (patch) | |
| tree | a62e02bf2d562cb61d151c7c0d6596268cc5817c /src/backend/access/heap/vacuumlazy.c | |
| parent | fa0ffa28778fbf4056a77f7b76361d295a737df6 (diff) | |
Refactor heap_page_prune_and_freeze() parameters into a struct
heap_page_prune_and_freeze() had accumulated an unwieldy number of input
parameters and upcoming work to handle VM updates in this function will
add even more.
Introduce a new PruneFreezeParams struct to group the function’s input
parameters, improving readability and maintainability.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/yn4zp35kkdsjx6wf47zcfmxgexxt4h2og47pvnw2x5ifyrs3qc%407uw6jyyxuyf7
Diffstat (limited to 'src/backend/access/heap/vacuumlazy.c')
| -rw-r--r-- | src/backend/access/heap/vacuumlazy.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index deb9a3dc0d1..c3fc1098e23 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -1965,7 +1965,10 @@ lazy_scan_prune(LVRelState *vacrel, { Relation rel = vacrel->rel; PruneFreezeResult presult; - int prune_options = 0; + PruneFreezeParams params = {.relation = rel,.buffer = buf, + .reason = PRUNE_VACUUM_SCAN,.options = HEAP_PAGE_PRUNE_FREEZE, + .vistest = vacrel->vistest,.cutoffs = &vacrel->cutoffs + }; Assert(BufferGetBlockNumber(buf) == blkno); @@ -1984,12 +1987,11 @@ lazy_scan_prune(LVRelState *vacrel, * tuples. Pruning will have determined whether or not the page is * all-visible. */ - prune_options = HEAP_PAGE_PRUNE_FREEZE; if (vacrel->nindexes == 0) - prune_options |= HEAP_PAGE_PRUNE_MARK_UNUSED_NOW; + params.options |= HEAP_PAGE_PRUNE_MARK_UNUSED_NOW; - heap_page_prune_and_freeze(rel, buf, vacrel->vistest, prune_options, - &vacrel->cutoffs, &presult, PRUNE_VACUUM_SCAN, + heap_page_prune_and_freeze(¶ms, + &presult, &vacrel->offnum, &vacrel->NewRelfrozenXid, &vacrel->NewRelminMxid); |
