PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <signal.h>
#include <sys/time.h>
#include <unistd.h>
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/multixact.h"
#include "access/reloptions.h"
#include "access/tableam.h"
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/namespace.h"
#include "catalog/pg_database.h"
#include "catalog/pg_namespace.h"
#include "commands/dbcommands.h"
#include "commands/vacuum.h"
#include "common/int.h"
#include "lib/ilist.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
#include "postmaster/interrupt.h"
#include "postmaster/postmaster.h"
#include "storage/bufmgr.h"
#include "storage/ipc.h"
#include "storage/latch.h"
#include "storage/lmgr.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/procsignal.h"
#include "storage/smgr.h"
#include "tcop/tcopprot.h"
#include "utils/fmgroids.h"
#include "utils/fmgrprotos.h"
#include "utils/guc_hooks.h"
#include "utils/injection_point.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
#include "utils/syscache.h"
#include "utils/timeout.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
struct | avl_dbase |
struct | avw_dbase |
struct | av_relation |
struct | autovac_table |
struct | WorkerInfoData |
struct | AutoVacuumWorkItem |
struct | AutoVacuumShmemStruct |
Macros | |
#define | MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */ |
#define | MAX_AUTOVAC_SLEEPTIME 300 /* seconds */ |
#define | AutoVacNumSignals (AutoVacRebalance + 1) |
#define | NUM_WORKITEMS 256 |
#define | MAX_AUTOVAC_ACTIV_LEN (NAMEDATALEN * 2 + 56) |
Typedefs | |
typedef struct avl_dbase | avl_dbase |
typedef struct avw_dbase | avw_dbase |
typedef struct av_relation | av_relation |
typedef struct autovac_table | autovac_table |
typedef struct WorkerInfoData | WorkerInfoData |
typedef struct WorkerInfoData * | WorkerInfo |
typedef struct AutoVacuumWorkItem | AutoVacuumWorkItem |
Enumerations | |
enum | AutoVacuumSignal { AutoVacForkFailed , AutoVacRebalance } |
Functions | |
static Oid | do_start_worker (void) |
static void | HandleAutoVacLauncherInterrupts (void) |
static void | AutoVacLauncherShutdown (void) |
static void | launcher_determine_sleep (bool canlaunch, bool recursing, struct timeval *nap) |
static void | rebuild_database_list (Oid newdb) |
static int | db_comparator (const void *a, const void *b) |
static void | launch_worker (TimestampTz now) |
void | AutoVacWorkerFailed (void) |
static void | avl_sigusr2_handler (SIGNAL_ARGS) |
void | AutoVacWorkerMain (char *startup_data, size_t startup_data_len) |
static void | FreeWorkerInfo (int code, Datum arg) |
void | VacuumUpdateCosts (void) |
void | AutoVacuumUpdateCostLimit (void) |
static void | autovac_recalculate_workers_for_balance (void) |
static List * | get_database_list (void) |
static void | do_autovacuum (void) |
static void | perform_work_item (AutoVacuumWorkItem *workitem) |
static AutoVacOpts * | extract_autovac_opts (HeapTuple tup, TupleDesc pg_class_desc) |
static autovac_table * | table_recheck_autovac (Oid relid, HTAB *table_toast_map, TupleDesc pg_class_desc, int effective_multixact_freeze_max_age) |
static void | recheck_relation_needs_vacanalyze (Oid relid, AutoVacOpts *avopts, Form_pg_class classForm, int effective_multixact_freeze_max_age, bool *dovacuum, bool *doanalyze, bool *wraparound) |
static void | relation_needs_vacanalyze (Oid relid, AutoVacOpts *relopts, Form_pg_class classForm, PgStat_StatTabEntry *tabentry, int effective_multixact_freeze_max_age, bool *dovacuum, bool *doanalyze, bool *wraparound) |
static void | autovacuum_do_vac_analyze (autovac_table *tab, BufferAccessStrategy bstrategy) |
static void | autovac_report_activity (autovac_table *tab) |
static void | autovac_report_workitem (AutoVacuumWorkItem *workitem, const char *nspname, const char *relname) |
bool | AutoVacuumingActive (void) |
bool | AutoVacuumRequestWork (AutoVacuumWorkItemType type, Oid relationId, BlockNumber blkno) |
void | autovac_init (void) |
Size | AutoVacuumShmemSize (void) |
void | AutoVacuumShmemInit (void) |
bool | check_autovacuum_work_mem (int *newval, void **extra, GucSource source) |
#define AutoVacNumSignals (AutoVacRebalance + 1) |
Definition at line 252 of file autovacuum.c.
#define MAX_AUTOVAC_ACTIV_LEN (NAMEDATALEN * 2 + 56) |
#define MAX_AUTOVAC_SLEEPTIME 300 /* seconds */ |
Definition at line 137 of file autovacuum.c.
#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */ |
Definition at line 136 of file autovacuum.c.
#define NUM_WORKITEMS 256 |
Definition at line 270 of file autovacuum.c.
typedef struct autovac_table autovac_table |
typedef struct AutoVacuumWorkItem AutoVacuumWorkItem |
typedef struct av_relation av_relation |
typedef struct WorkerInfoData* WorkerInfo |
Definition at line 239 of file autovacuum.c.
typedef struct WorkerInfoData WorkerInfoData |
enum AutoVacuumSignal |
void autovac_init | ( | void | ) |
Definition at line 3254 of file autovacuum.c.
References autovacuum_start_daemon, ereport, errhint(), errmsg(), pgstat_track_counts, and WARNING.
Referenced by PostmasterMain().
|
static |
Definition at line 1750 of file autovacuum.c.
References Assert, AutoVacuumShmem, AutoVacuumShmemStruct::av_nworkersForBalance, AutoVacuumShmemStruct::av_runningWorkers, dlist_iter::cur, dlist_container, dlist_foreach, LWLockHeldByMe(), pg_atomic_read_u32(), pg_atomic_unlocked_test_flag(), pg_atomic_write_u32(), WorkerInfoData::wi_dobalance, and WorkerInfoData::wi_proc.
Referenced by do_autovacuum().
|
static |
Definition at line 3125 of file autovacuum.c.
References autovac_table::at_nspname, autovac_table::at_params, autovac_table::at_relname, VacuumParams::is_wraparound, len, MAX_AUTOVAC_ACTIV_LEN, VacuumParams::options, pgstat_report_activity(), SetCurrentStatementStartTimestamp(), snprintf, STATE_RUNNING, VACOPT_ANALYZE, and VACOPT_VACUUM.
Referenced by autovacuum_do_vac_analyze().
|
static |
Definition at line 3160 of file autovacuum.c.
References AutoVacuumWorkItem::avw_blockNumber, AVW_BRINSummarizeRange, AutoVacuumWorkItem::avw_type, BlockNumberIsValid(), len, MAX_AUTOVAC_ACTIV_LEN, pgstat_report_activity(), relname, SetCurrentStatementStartTimestamp(), snprintf, and STATE_RUNNING.
Referenced by perform_work_item().
|
static |
Definition at line 318 of file autovacuum.c.
Referenced by HandleAutoVacLauncherInterrupts().
|
static |
Definition at line 3089 of file autovacuum.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, autovac_table::at_nspname, autovac_table::at_params, autovac_table::at_relid, autovac_table::at_relname, autovac_report_activity(), CurrentMemoryContext, list_make1, makeRangeVar(), makeVacuumRelation(), MemoryContextDelete(), NIL, and vacuum().
Referenced by do_autovacuum().
bool AutoVacuumingActive | ( | void | ) |
Definition at line 3200 of file autovacuum.c.
References autovacuum_start_daemon, and pgstat_track_counts.
Referenced by HandleAutoVacLauncherInterrupts(), LaunchMissingBackgroundProcesses(), and relation_needs_vacanalyze().
bool AutoVacuumRequestWork | ( | AutoVacuumWorkItemType | type, |
Oid | relationId, | ||
BlockNumber | blkno | ||
) |
Definition at line 3212 of file autovacuum.c.
References AutoVacuumShmem, AutoVacuumShmemStruct::av_workItems, AutoVacuumWorkItem::avw_active, AutoVacuumWorkItem::avw_blockNumber, AutoVacuumWorkItem::avw_database, AutoVacuumWorkItem::avw_relation, AutoVacuumWorkItem::avw_type, AutoVacuumWorkItem::avw_used, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyDatabaseId, NUM_WORKITEMS, and type.
Referenced by brininsert().
void AutoVacuumShmemInit | ( | void | ) |
Definition at line 3286 of file autovacuum.c.
References Assert, autovacuum_max_workers, AutoVacuumShmem, AutoVacuumShmemSize(), AutoVacuumShmemStruct::av_freeWorkers, AutoVacuumShmemStruct::av_launcherpid, AutoVacuumShmemStruct::av_nworkersForBalance, AutoVacuumShmemStruct::av_runningWorkers, AutoVacuumShmemStruct::av_startingWorker, AutoVacuumShmemStruct::av_workItems, dlist_init(), dlist_push_head(), i, IsUnderPostmaster, MAXALIGN, NUM_WORKITEMS, pg_atomic_init_flag(), pg_atomic_init_u32(), ShmemInitStruct(), and WorkerInfoData::wi_links.
Referenced by CreateOrAttachShmemStructs().
Size AutoVacuumShmemSize | ( | void | ) |
Definition at line 3267 of file autovacuum.c.
References add_size(), autovacuum_max_workers, MAXALIGN, mul_size(), and size.
Referenced by AutoVacuumShmemInit(), and CalculateShmemSize().
void AutoVacuumUpdateCostLimit | ( | void | ) |
Definition at line 1704 of file autovacuum.c.
References Assert, autovacuum_vac_cost_limit, AutoVacuumShmem, AutoVacuumShmemStruct::av_nworkersForBalance, av_storage_param_cost_limit, elog, ERROR, Max, MyWorkerInfo, pg_atomic_read_u32(), pg_atomic_unlocked_test_flag(), vacuum_cost_limit, VacuumCostLimit, and WorkerInfoData::wi_dobalance.
Referenced by vacuum_delay_point(), and VacuumUpdateCosts().
void AutoVacWorkerFailed | ( | void | ) |
Definition at line 1339 of file autovacuum.c.
References AutoVacForkFailed, AutoVacuumShmem, and AutoVacuumShmemStruct::av_signal.
Referenced by StartAutovacuumWorker().
void AutoVacWorkerMain | ( | char * | startup_data, |
size_t | startup_data_len | ||
) |
Definition at line 1361 of file autovacuum.c.
References Assert, AutoVacuumShmem, AutoVacuumShmemStruct::av_launcherpid, AutoVacuumShmemStruct::av_runningWorkers, AutoVacuumShmemStruct::av_startingWorker, B_AUTOVAC_WORKER, BaseInit(), dbname, DEBUG1, die, dlist_push_head(), do_autovacuum(), elog, EmitErrorReport(), ereport, errmsg_internal(), error_context_stack, FloatExceptionHandler(), FreeWorkerInfo(), GetProcessingMode, HOLD_INTERRUPTS, init_ps_display(), InitializeTimeouts(), InitPostgres(), InitProcess(), InitProcessing, InvalidOid, kill, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MemoryContextDelete(), MyBackendType, MyProc, MyWorkerInfo, NAMEDATALEN, NormalProcessing, OidIsValid, on_shmem_exit(), PG_exception_stack, pg_usleep(), PGC_S_OVERRIDE, PGC_SUSET, pgstat_report_autovac(), PostAuthDelay, PostmasterContext, pqsignal(), proc_exit(), procsignal_sigusr1_handler(), ReadNextMultiXactId(), ReadNextTransactionId(), recentMulti, recentXid, set_ps_display(), SetConfigOption(), SetProcessingMode, SIG_DFL, SIG_IGN, SIGCHLD, SIGHUP, SignalHandlerForConfigReload(), SIGPIPE, SIGUSR1, SIGUSR2, StatementCancelHandler(), synchronous_commit, SYNCHRONOUS_COMMIT_LOCAL_FLUSH, UnBlockSig, WARNING, WorkerInfoData::wi_dboid, WorkerInfoData::wi_links, and WorkerInfoData::wi_proc.
|
static |
|
static |
Definition at line 1057 of file autovacuum.c.
References a, b, and pg_cmp_s32().
Referenced by rebuild_database_list().
|
static |
Definition at line 1875 of file autovacuum.c.
References AbortOutOfAnyTransaction(), AccessExclusiveLock, AccessShareLock, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, av_relation::ar_hasrelopts, av_relation::ar_relid, av_relation::ar_reloptions, autovac_table::at_datname, autovac_table::at_dobalance, autovac_table::at_nspname, autovac_table::at_params, autovac_table::at_relid, autovac_table::at_relname, autovac_table::at_storage_param_vac_cost_delay, autovac_table::at_storage_param_vac_cost_limit, autovac_recalculate_workers_for_balance(), AutovacMemCxt, autovacuum_do_vac_analyze(), AutoVacuumShmem, AutoVacuumShmemStruct::av_runningWorkers, av_storage_param_cost_delay, av_storage_param_cost_limit, AutoVacuumShmemStruct::av_workItems, AutoVacuumWorkItem::avw_active, AutoVacuumWorkItem::avw_database, AutoVacuumWorkItem::avw_used, BAS_VACUUM, BTEqualStrategyNumber, CharGetDatum(), CHECK_FOR_INTERRUPTS, checkTempNamespaceStatus(), CommitTransactionCommand(), ConditionalLockDatabaseObject(), ConditionalLockRelationOid(), ConfigReloadPending, CreateTupleDescCopy(), ctl, dlist_iter::cur, default_freeze_min_age, default_freeze_table_age, default_multixact_freeze_min_age, default_multixact_freeze_table_age, dlist_container, dlist_foreach, DROP_CASCADE, elog, EmitErrorReport(), ereport, errcontext, errmsg(), ERROR, extract_autovac_opts(), FlushErrorState(), ForwardScanDirection, get_database_name(), get_namespace_name(), get_rel_name(), get_rel_namespace(), GetAccessStrategyWithSize(), GETSTRUCT, HASH_BLOBS, hash_create(), HASH_ELEM, HASH_ENTER, HASH_FIND, hash_search(), heap_getnext(), HeapTupleIsValid, HOLD_INTERRUPTS, i, INJECTION_POINT, InvalidOid, sort-test::key, lappend_oid(), lfirst_oid, LOG, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MemoryContextReset(), MemoryContextSwitchTo(), MultiXactMemberFreezeThreshold(), MyDatabaseId, MyWorkerInfo, NameStr, NIL, NUM_WORKITEMS, ObjectIdGetDatum(), OidIsValid, VacuumParams::options, PERFORM_DELETION_INTERNAL, PERFORM_DELETION_QUIETLY, PERFORM_DELETION_SKIP_EXTENSIONS, perform_work_item(), performDeletion(), pfree(), pg_atomic_clear_flag(), pg_atomic_test_set_flag(), PG_CATCH, PG_END_TRY, PG_TRY, PGC_SIGHUP, pgstat_fetch_stat_tabentry_ext(), PortalContext, ProcessConfigFile(), QueryCancelPending, relation_needs_vacanalyze(), RelationGetDescr, ReleaseSysCache(), RESUME_INTERRUPTS, ScanKeyInit(), SearchSysCache1(), SearchSysCacheCopy1, StartTransactionCommand(), table_beginscan_catalog(), table_close(), table_endscan(), table_open(), table_recheck_autovac(), TEMP_NAMESPACE_IDLE, TopMemoryContext, UnlockRelationOid(), vac_update_datfrozenxid(), VACOPT_VACUUM, vacuum_freeze_min_age, vacuum_freeze_table_age, vacuum_multixact_freeze_min_age, vacuum_multixact_freeze_table_age, VacuumBufferUsageLimit, VacuumUpdateCosts(), WorkerInfoData::wi_dboid, WorkerInfoData::wi_dobalance, WorkerInfoData::wi_sharedrel, and WorkerInfoData::wi_tableoid.
Referenced by AutoVacWorkerMain().
|
static |
Definition at line 1075 of file autovacuum.c.
References avl_dbase::adl_datid, avl_dbase::adl_next_worker, avw_dbase::adw_datid, avw_dbase::adw_entry, avw_dbase::adw_frozenxid, avw_dbase::adw_minmulti, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, autovacuum_freeze_max_age, autovacuum_naptime, AutoVacuumShmem, AutoVacuumShmemStruct::av_freeWorkers, AutoVacuumShmemStruct::av_startingWorker, dlist_iter::cur, CurrentMemoryContext, DatabaseList, dblist, dlist_container, dlist_is_empty(), dlist_pop_head_node(), dlist_reverse_foreach, FirstMultiXactId, FirstNormalTransactionId, get_database_list(), GetCurrentTimestamp(), InvalidOid, PgStat_StatDBEntry::last_autovac_time, lfirst, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MemoryContextDelete(), MemoryContextSwitchTo(), MultiXactIdPrecedes(), MultiXactMemberFreezeThreshold(), pgstat_fetch_stat_dbentry(), PMSIGNAL_START_AUTOVAC_WORKER, ReadNextMultiXactId(), ReadNextTransactionId(), rebuild_database_list(), recentMulti, recentXid, SendPostmasterSignal(), TimestampDifferenceExceeds(), TransactionIdPrecedes(), WorkerInfoData::wi_dboid, WorkerInfoData::wi_launchtime, and WorkerInfoData::wi_proc.
Referenced by launch_worker().
|
static |
Definition at line 2682 of file autovacuum.c.
References Assert, av, extractRelOptions(), GETSTRUCT, palloc(), and pfree().
Referenced by do_autovacuum(), and table_recheck_autovac().
|
static |
Definition at line 1587 of file autovacuum.c.
References AutoVacRebalance, AutovacuumLauncherPid, AutoVacuumShmem, AutoVacuumShmemStruct::av_freeWorkers, AutoVacuumShmemStruct::av_launcherpid, AutoVacuumShmemStruct::av_signal, dlist_delete(), dlist_push_head(), InvalidOid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyWorkerInfo, pg_atomic_clear_flag(), WorkerInfoData::wi_dboid, WorkerInfoData::wi_dobalance, WorkerInfoData::wi_launchtime, WorkerInfoData::wi_links, WorkerInfoData::wi_proc, WorkerInfoData::wi_sharedrel, and WorkerInfoData::wi_tableoid.
Referenced by AutoVacWorkerMain().
|
static |
Definition at line 1790 of file autovacuum.c.
References AccessShareLock, avw_dbase::adw_datid, avw_dbase::adw_entry, avw_dbase::adw_frozenxid, avw_dbase::adw_minmulti, avw_dbase::adw_name, CommitTransactionCommand(), CurrentMemoryContext, database_is_invalid_form(), dblist, DEBUG2, elog, ForwardScanDirection, GETSTRUCT, GetTransactionSnapshot(), heap_getnext(), HeapTupleIsValid, lappend(), MemoryContextSwitchTo(), NameStr, NIL, palloc(), pstrdup(), StartTransactionCommand(), table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by do_start_worker(), and rebuild_database_list().
|
static |
Definition at line 742 of file autovacuum.c.
References AutoVacLauncherShutdown(), AutoVacuumingActive(), ConfigReloadPending, InvalidOid, LogMemoryContextPending, PGC_SIGHUP, ProcessCatchupInterrupt(), ProcessConfigFile(), ProcessLogMemoryContextInterrupt(), ProcessProcSignalBarrier(), ProcSignalBarrierPending, rebuild_database_list(), and ShutdownRequestPending.
|
static |
Definition at line 1287 of file autovacuum.c.
References avl_dbase::adl_datid, avl_dbase::adl_next_worker, autovacuum_naptime, dlist_iter::cur, DatabaseList, dlist_container, dlist_foreach, dlist_move_head(), do_start_worker(), now(), OidIsValid, rebuild_database_list(), and TimestampTzPlusMilliseconds.
|
static |
Definition at line 794 of file autovacuum.c.
References avl_dbase::adl_next_worker, autovacuum_naptime, DatabaseList, dlist_is_empty(), dlist_tail_element, GetCurrentTimestamp(), InvalidOid, MAX_AUTOVAC_SLEEPTIME, MIN_AUTOVAC_SLEEPTIME, rebuild_database_list(), and TimestampDifference().
|
static |
Definition at line 2568 of file autovacuum.c.
References AbortOutOfAnyTransaction(), Assert, autovac_report_workitem(), AutovacMemCxt, AutoVacuumWorkItem::avw_blockNumber, AVW_BRINSummarizeRange, AutoVacuumWorkItem::avw_relation, AutoVacuumWorkItem::avw_type, brin_summarize_range(), CurrentMemoryContext, DirectFunctionCall2, elog, EmitErrorReport(), errcontext, FlushErrorState(), get_database_name(), get_namespace_name(), get_rel_name(), get_rel_namespace(), HOLD_INTERRUPTS, Int64GetDatum(), MemoryContextReset(), MemoryContextSwitchTo(), MyDatabaseId, ObjectIdGetDatum(), pfree(), PG_CATCH, PG_END_TRY, PG_TRY, PortalContext, QueryCancelPending, RESUME_INTERRUPTS, StartTransactionCommand(), and WARNING.
Referenced by do_autovacuum().
|
static |
Definition at line 878 of file autovacuum.c.
References avl_dbase::adl_datid, avl_dbase::adl_next_worker, avl_dbase::adl_node, avl_dbase::adl_score, avw_dbase::adw_datid, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, AutovacMemCxt, autovacuum_naptime, dlist_iter::cur, DatabaseList, DatabaseListCxt, db_comparator(), dblist, dlist_container, dlist_foreach, dlist_init(), dlist_push_head(), HASHCTL::entrysize, get_database_list(), GetCurrentTimestamp(), HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), hash_seq_init(), hash_seq_search(), HASHCTL::hcxt, i, HASHCTL::keysize, lfirst, MemoryContextDelete(), MemoryContextSwitchTo(), MIN_AUTOVAC_SLEEPTIME, OidIsValid, palloc(), pgstat_fetch_stat_dbentry(), qsort, and TimestampTzPlusMilliseconds.
Referenced by do_start_worker(), HandleAutoVacLauncherInterrupts(), launch_worker(), and launcher_determine_sleep().
|
static |
Definition at line 2852 of file autovacuum.c.
References pgstat_fetch_stat_tabentry_ext(), and relation_needs_vacanalyze().
Referenced by table_recheck_autovac().
|
static |
Definition at line 2913 of file autovacuum.c.
References AutoVacOpts::analyze_scale_factor, AutoVacOpts::analyze_threshold, Assert, autovacuum_anl_scale, autovacuum_anl_thresh, autovacuum_freeze_max_age, autovacuum_vac_ins_scale, autovacuum_vac_ins_thresh, autovacuum_vac_scale, autovacuum_vac_thresh, AutoVacuumingActive(), PgStat_StatTabEntry::dead_tuples, DEBUG3, elog, AutoVacOpts::enabled, FirstMultiXactId, FirstNormalTransactionId, AutoVacOpts::freeze_max_age, PgStat_StatTabEntry::ins_since_vacuum, Min, PgStat_StatTabEntry::mod_since_analyze, AutoVacOpts::multixact_freeze_max_age, MultiXactIdIsValid, MultiXactIdPrecedes(), NameStr, OidIsValid, PointerIsValid, recentMulti, recentXid, TransactionIdIsNormal, TransactionIdPrecedes(), AutoVacOpts::vacuum_ins_scale_factor, AutoVacOpts::vacuum_ins_threshold, AutoVacOpts::vacuum_scale_factor, and AutoVacOpts::vacuum_threshold.
Referenced by do_autovacuum(), and recheck_relation_needs_vacanalyze().
|
static |
Definition at line 2712 of file autovacuum.c.
References av_relation::ar_hasrelopts, av_relation::ar_reloptions, autovac_table::at_datname, autovac_table::at_dobalance, autovac_table::at_nspname, autovac_table::at_params, autovac_table::at_relid, autovac_table::at_relname, autovac_table::at_sharedrel, autovac_table::at_storage_param_vac_cost_delay, autovac_table::at_storage_param_vac_cost_limit, default_freeze_min_age, default_freeze_table_age, default_multixact_freeze_min_age, default_multixact_freeze_table_age, extract_autovac_opts(), VacuumParams::freeze_min_age, AutoVacOpts::freeze_min_age, VacuumParams::freeze_table_age, AutoVacOpts::freeze_table_age, GETSTRUCT, HASH_FIND, hash_search(), heap_freetuple(), HeapTupleIsValid, VacuumParams::index_cleanup, InvalidOid, VacuumParams::is_wraparound, Log_autovacuum_min_duration, VacuumParams::log_min_duration, AutoVacOpts::log_min_duration, VacuumParams::multixact_freeze_min_age, AutoVacOpts::multixact_freeze_min_age, VacuumParams::multixact_freeze_table_age, AutoVacOpts::multixact_freeze_table_age, VacuumParams::nworkers, ObjectIdGetDatum(), VacuumParams::options, palloc(), recheck_relation_needs_vacanalyze(), SearchSysCacheCopy1, VacuumParams::toast_parent, VacuumParams::truncate, VACOPT_ANALYZE, VACOPT_PROCESS_MAIN, VACOPT_SKIP_DATABASE_STATS, VACOPT_SKIP_LOCKED, VACOPT_VACUUM, VACOPTVALUE_UNSPECIFIED, AutoVacOpts::vacuum_cost_delay, and AutoVacOpts::vacuum_cost_limit.
Referenced by do_autovacuum().
void VacuumUpdateCosts | ( | void | ) |
Definition at line 1635 of file autovacuum.c.
References Assert, autovacuum_vac_cost_delay, AutoVacuumUpdateCostLimit(), av_storage_param_cost_delay, DEBUG2, elog, LW_SHARED, LWLockAcquire(), LWLockHeldByMe(), LWLockRelease(), message_level_is_interesting(), MyWorkerInfo, pg_atomic_unlocked_test_flag(), vacuum_cost_delay, vacuum_cost_limit, VacuumCostActive, VacuumCostBalance, VacuumCostDelay, VacuumCostLimit, VacuumFailsafeActive, WorkerInfoData::wi_dboid, WorkerInfoData::wi_dobalance, and WorkerInfoData::wi_tableoid.
Referenced by do_autovacuum(), parallel_vacuum_main(), vacuum(), and vacuum_delay_point().
|
static |
Definition at line 165 of file autovacuum.c.
Referenced by do_autovacuum(), perform_work_item(), and rebuild_database_list().
double autovacuum_anl_scale |
Definition at line 126 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
int autovacuum_anl_thresh |
Definition at line 125 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
int autovacuum_freeze_max_age |
Definition at line 127 of file autovacuum.c.
Referenced by do_start_worker(), relation_needs_vacanalyze(), SetTransactionIdLimit(), vacuum_get_cutoffs(), and vacuum_xid_failsafe_check().
int autovacuum_max_workers |
Definition at line 118 of file autovacuum.c.
Referenced by AutoVacuumShmemInit(), AutoVacuumShmemSize(), InitializeMaxBackends(), InitProcGlobal(), and MaxLivePostmasterChildren().
int autovacuum_multixact_freeze_max_age |
Definition at line 128 of file autovacuum.c.
Referenced by MultiXactMemberFreezeThreshold(), SetMultiXactIdLimit(), and vacuum_xid_failsafe_check().
int autovacuum_naptime |
Definition at line 120 of file autovacuum.c.
Referenced by do_start_worker(), launch_worker(), launcher_determine_sleep(), and rebuild_database_list().
Definition at line 117 of file autovacuum.c.
Referenced by autovac_init(), and AutoVacuumingActive().
double autovacuum_vac_cost_delay |
Definition at line 130 of file autovacuum.c.
Referenced by VacuumUpdateCosts().
int autovacuum_vac_cost_limit |
Definition at line 131 of file autovacuum.c.
Referenced by AutoVacuumUpdateCostLimit().
double autovacuum_vac_ins_scale |
Definition at line 124 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
int autovacuum_vac_ins_thresh |
Definition at line 123 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
double autovacuum_vac_scale |
Definition at line 122 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
int autovacuum_vac_thresh |
Definition at line 121 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
int autovacuum_work_mem = -1 |
Definition at line 119 of file autovacuum.c.
Referenced by dead_items_alloc(), and ginInsertCleanup().
int AutovacuumLauncherPid = 0 |
Definition at line 314 of file autovacuum.c.
Referenced by FreeWorkerInfo(), and ProcKill().
|
static |
Definition at line 301 of file autovacuum.c.
Referenced by autovac_recalculate_workers_for_balance(), AutoVacuumRequestWork(), AutoVacuumShmemInit(), AutoVacuumUpdateCostLimit(), AutoVacWorkerFailed(), AutoVacWorkerMain(), do_autovacuum(), do_start_worker(), and FreeWorkerInfo().
|
static |
Definition at line 148 of file autovacuum.c.
Referenced by do_autovacuum(), and VacuumUpdateCosts().
|
static |
Definition at line 149 of file autovacuum.c.
Referenced by AutoVacuumUpdateCostLimit(), and do_autovacuum().
|
static |
Definition at line 307 of file autovacuum.c.
Referenced by do_start_worker(), launch_worker(), launcher_determine_sleep(), and rebuild_database_list().
|
static |
Definition at line 308 of file autovacuum.c.
Referenced by rebuild_database_list().
|
static |
Definition at line 159 of file autovacuum.c.
Referenced by do_autovacuum(), and table_recheck_autovac().
|
static |
Definition at line 160 of file autovacuum.c.
Referenced by do_autovacuum(), and table_recheck_autovac().
|
static |
Definition at line 161 of file autovacuum.c.
Referenced by do_autovacuum(), and table_recheck_autovac().
|
static |
Definition at line 162 of file autovacuum.c.
Referenced by do_autovacuum(), and table_recheck_autovac().
|
static |
Definition at line 152 of file autovacuum.c.
Referenced by avl_sigusr2_handler().
int Log_autovacuum_min_duration = 600000 |
Definition at line 133 of file autovacuum.c.
Referenced by table_recheck_autovac().
|
static |
Definition at line 311 of file autovacuum.c.
Referenced by AutoVacuumUpdateCostLimit(), AutoVacWorkerMain(), do_autovacuum(), FreeWorkerInfo(), and VacuumUpdateCosts().
|
static |
Definition at line 156 of file autovacuum.c.
Referenced by AutoVacWorkerMain(), do_start_worker(), and relation_needs_vacanalyze().
|
static |
Definition at line 155 of file autovacuum.c.
Referenced by AutoVacWorkerMain(), do_start_worker(), and relation_needs_vacanalyze().