mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Improve readability of code PROCESS_MAIN in vacuum_rel()
4211fbd has been handling PROCESS_MAIN in vacuum_rel() with an "if/else if" structure to avoid an extra level of indentation, but this has been found as being rather parse to read. This commit updates the code so as we check for PROCESS_MAIN in a single place and then handle its subpaths, FULL or non-FULL vacuums. Some comments are added to make that clearer for the reader. Reported-by: Melanie Plageman Author: Nathan Bossart Reviewed-by: Michael Paquier, Melanie Plageman Discussion: https://postgr.es/m/20230306194009.5cn6sp3wjotd36nu@liskov
This commit is contained in:
parent
99be6feec9
commit
ee56048b0e
@ -2057,11 +2057,18 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params, bool skip_privs)
|
||||
save_sec_context | SECURITY_RESTRICTED_OPERATION);
|
||||
save_nestlevel = NewGUCNestLevel();
|
||||
|
||||
/*
|
||||
* If PROCESS_MAIN is set (the default), it's time to vacuum the main
|
||||
* relation. Otherwise, we can skip this part. If processing the TOAST
|
||||
* table is required (e.g., PROCESS_TOAST is set), we force PROCESS_MAIN
|
||||
* to be set when we recurse to the TOAST table.
|
||||
*/
|
||||
if (params->options & VACOPT_PROCESS_MAIN)
|
||||
{
|
||||
/*
|
||||
* Do the actual work --- either FULL or "lazy" vacuum
|
||||
*/
|
||||
if ((params->options & VACOPT_FULL) &&
|
||||
(params->options & VACOPT_PROCESS_MAIN))
|
||||
if (params->options & VACOPT_FULL)
|
||||
{
|
||||
ClusterParams cluster_params = {0};
|
||||
|
||||
@ -2075,8 +2082,9 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params, bool skip_privs)
|
||||
/* VACUUM FULL is now a variant of CLUSTER; see cluster.c */
|
||||
cluster_rel(relid, InvalidOid, &cluster_params);
|
||||
}
|
||||
else if (params->options & VACOPT_PROCESS_MAIN)
|
||||
else
|
||||
table_relation_vacuum(rel, params, vac_strategy);
|
||||
}
|
||||
|
||||
/* Roll back any GUC changes executed by index functions */
|
||||
AtEOXact_GUC(false, save_nestlevel);
|
||||
|
Loading…
x
Reference in New Issue
Block a user