mirror of
https://github.com/postgres/postgres.git
synced 2026-01-26 09:41:40 +03:00
Rationalize handling of VacuumParams
This commit refactors the vacuum routines that rely on VacuumParams, adding const markers where necessary to force a new policy in the code. This structure should not use a pointer as it may be used across multiple relations, and its contents should never be updated. vacuum_rel() stands as an exception as it touches the "index_cleanup" and "truncate" options. VacuumParams has been introduced in0d83138974, and661643dedahas fixed a bug impacting VACUUM operating on multiple relations. The changes done in tableam.h break ABI compatibility, so this commit can only happen on HEAD. Author: Shihao Zhong <zhong950419@gmail.com> Co-authored-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Reviewed-by: Junwang Zhao <zhjwpku@gmail.com> Discussion: https://postgr.es/m/CAGRkXqTo+aK=GTy5pSc-9cy8H2F2TJvcrZ-zXEiNJj93np1UUw@mail.gmail.com
This commit is contained in:
@@ -336,7 +336,7 @@ extern PGDLLIMPORT int64 parallel_vacuum_worker_delay_ns;
|
||||
|
||||
/* in commands/vacuum.c */
|
||||
extern void ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel);
|
||||
extern void vacuum(List *relations, VacuumParams *params,
|
||||
extern void vacuum(List *relations, const VacuumParams params,
|
||||
BufferAccessStrategy bstrategy, MemoryContext vac_context,
|
||||
bool isTopLevel);
|
||||
extern void vac_open_indexes(Relation relation, LOCKMODE lockmode,
|
||||
@@ -357,7 +357,7 @@ extern void vac_update_relstats(Relation relation,
|
||||
bool *frozenxid_updated,
|
||||
bool *minmulti_updated,
|
||||
bool in_outer_xact);
|
||||
extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams *params,
|
||||
extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams params,
|
||||
struct VacuumCutoffs *cutoffs);
|
||||
extern bool vacuum_xid_failsafe_check(const struct VacuumCutoffs *cutoffs);
|
||||
extern void vac_update_datfrozenxid(void);
|
||||
@@ -398,7 +398,7 @@ extern void parallel_vacuum_main(dsm_segment *seg, shm_toc *toc);
|
||||
|
||||
/* in commands/analyze.c */
|
||||
extern void analyze_rel(Oid relid, RangeVar *relation,
|
||||
VacuumParams *params, List *va_cols, bool in_outer_xact,
|
||||
const VacuumParams params, List *va_cols, bool in_outer_xact,
|
||||
BufferAccessStrategy bstrategy);
|
||||
extern bool std_typanalyze(VacAttrStats *stats);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user