mirror of
https://github.com/postgres/postgres.git
synced 2025-12-15 02:22:24 +03:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user