mirror of
https://github.com/postgres/postgres.git
synced 2025-10-22 14:32:25 +03:00
Separate vacuum cost variables from GUCs
Vacuum code run both by autovacuum workers and a backend doing VACUUM/ANALYZE previously inspected VacuumCostLimit and VacuumCostDelay, which are the global variables backing the GUCs vacuum_cost_limit and vacuum_cost_delay. Autovacuum workers needed to override these variables with their own values, derived from autovacuum_vacuum_cost_limit and autovacuum_vacuum_cost_delay and worker cost limit balancing logic. This led to confusing code which, in some cases, both derived and set a new value of VacuumCostLimit from VacuumCostLimit. In preparation for refreshing these GUC values more often, introduce new, independent global variables and add a function to update them using the GUCs and existing logic. Per suggestion by Kyotaro Horiguchi Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com
This commit is contained in:
@@ -307,6 +307,8 @@ extern PGDLLIMPORT pg_atomic_uint32 *VacuumActiveNWorkers;
|
||||
extern PGDLLIMPORT int VacuumCostBalanceLocal;
|
||||
|
||||
extern PGDLLIMPORT bool VacuumFailsafeActive;
|
||||
extern PGDLLIMPORT double vacuum_cost_delay;
|
||||
extern PGDLLIMPORT int vacuum_cost_limit;
|
||||
|
||||
/* in commands/vacuum.c */
|
||||
extern void ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel);
|
||||
@@ -347,6 +349,9 @@ extern IndexBulkDeleteResult *vac_cleanup_one_index(IndexVacuumInfo *ivinfo,
|
||||
IndexBulkDeleteResult *istat);
|
||||
extern Size vac_max_items_to_alloc_size(int max_items);
|
||||
|
||||
/* In postmaster/autovacuum.c */
|
||||
extern void VacuumUpdateCosts(void);
|
||||
|
||||
/* in commands/vacuumparallel.c */
|
||||
extern ParallelVacuumState *parallel_vacuum_init(Relation rel, Relation *indrels,
|
||||
int nindexes, int nrequested_workers,
|
||||
|
Reference in New Issue
Block a user