mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Refactor cluster_rel() to handle more options
This extends cluster_rel() in such a way that more options can be added in the future, which will reduce the amount of chunk code for an upcoming SKIP_LOCKED aimed for VACUUM. As VACUUM FULL is a different flavor of CLUSTER, we want to make that extensible to ease integration. This only reworks the API and its callers, without providing anything user-facing. Two options are present now: verbose mode and relation recheck when doing the cluster command work across multiple transactions. This could be used as well as a base to extend the grammar of CLUSTER later on. Author: Michael Paquier Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/20180723031058.GE2854@paquier.xyz
This commit is contained in:
@@ -1551,13 +1551,17 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params)
|
||||
*/
|
||||
if (options & VACOPT_FULL)
|
||||
{
|
||||
int options = 0;
|
||||
|
||||
/* close relation before vacuuming, but hold lock until commit */
|
||||
relation_close(onerel, NoLock);
|
||||
onerel = NULL;
|
||||
|
||||
if ((options & VACOPT_VERBOSE) != 0)
|
||||
options |= CLUOPT_VERBOSE;
|
||||
|
||||
/* VACUUM FULL is now a variant of CLUSTER; see cluster.c */
|
||||
cluster_rel(relid, InvalidOid, false,
|
||||
(options & VACOPT_VERBOSE) != 0);
|
||||
cluster_rel(relid, InvalidOid, options);
|
||||
}
|
||||
else
|
||||
lazy_vacuum_rel(onerel, options, params, vac_strategy);
|
||||
|
||||
Reference in New Issue
Block a user