Go to the source code of this file.
Defines | |
#define | IsAnyAutoVacuumProcess() (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess()) |
Functions | |
bool | AutoVacuumingActive (void) |
bool | IsAutoVacuumLauncherProcess (void) |
bool | IsAutoVacuumWorkerProcess (void) |
void | autovac_init (void) |
int | StartAutoVacLauncher (void) |
int | StartAutoVacWorker (void) |
void | AutoVacWorkerFailed (void) |
void | AutoVacuumUpdateDelay (void) |
Size | AutoVacuumShmemSize (void) |
void | AutoVacuumShmemInit (void) |
Variables | |
bool | autovacuum_start_daemon |
int | autovacuum_max_workers |
int | autovacuum_naptime |
int | autovacuum_vac_thresh |
double | autovacuum_vac_scale |
int | autovacuum_anl_thresh |
double | autovacuum_anl_scale |
int | autovacuum_freeze_max_age |
int | autovacuum_vac_cost_delay |
int | autovacuum_vac_cost_limit |
int | AutovacuumLauncherPid |
int | Log_autovacuum_min_duration |
#define IsAnyAutoVacuumProcess | ( | ) | (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess()) |
Definition at line 40 of file autovacuum.h.
Referenced by InitProcess(), and ProcKill().
void autovac_init | ( | void | ) |
Definition at line 2831 of file autovacuum.c.
References autovacuum_start_daemon, ereport, errhint(), errmsg(), pgstat_track_counts, and WARNING.
Referenced by PostmasterMain().
{ if (autovacuum_start_daemon && !pgstat_track_counts) ereport(WARNING, (errmsg("autovacuum not started because of misconfiguration"), errhint("Enable the \"track_counts\" option."))); }
bool AutoVacuumingActive | ( | void | ) |
Definition at line 2817 of file autovacuum.c.
References autovacuum_start_daemon, and pgstat_track_counts.
Referenced by AutoVacLauncherMain(), reaper(), and ServerLoop().
{ if (!autovacuum_start_daemon || !pgstat_track_counts) return false; return true; }
void AutoVacuumShmemInit | ( | void | ) |
Definition at line 2881 of file autovacuum.c.
References Assert, autovacuum_max_workers, AutoVacuumShmemSize(), AutoVacuumShmemStruct::av_freeWorkers, AutoVacuumShmemStruct::av_launcherpid, AutoVacuumShmemStruct::av_runningWorkers, AutoVacuumShmemStruct::av_startingWorker, dlist_init(), dlist_push_head(), i, IsUnderPostmaster, MAXALIGN, ShmemInitStruct(), and WorkerInfoData::wi_links.
Referenced by CreateSharedMemoryAndSemaphores().
{ bool found; AutoVacuumShmem = (AutoVacuumShmemStruct *) ShmemInitStruct("AutoVacuum Data", AutoVacuumShmemSize(), &found); if (!IsUnderPostmaster) { WorkerInfo worker; int i; Assert(!found); AutoVacuumShmem->av_launcherpid = 0; dlist_init(&AutoVacuumShmem->av_freeWorkers); dlist_init(&AutoVacuumShmem->av_runningWorkers); AutoVacuumShmem->av_startingWorker = NULL; worker = (WorkerInfo) ((char *) AutoVacuumShmem + MAXALIGN(sizeof(AutoVacuumShmemStruct))); /* initialize the WorkerInfo free list */ for (i = 0; i < autovacuum_max_workers; i++) dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &worker[i].wi_links); } else Assert(found); }
Size AutoVacuumShmemSize | ( | void | ) |
Definition at line 2862 of file autovacuum.c.
References add_size(), autovacuum_max_workers, MAXALIGN, and mul_size().
Referenced by AutoVacuumShmemInit(), and CreateSharedMemoryAndSemaphores().
{ Size size; /* * Need the fixed struct and the array of WorkerInfoData. */ size = sizeof(AutoVacuumShmemStruct); size = MAXALIGN(size); size = add_size(size, mul_size(autovacuum_max_workers, sizeof(WorkerInfoData))); return size; }
void AutoVacuumUpdateDelay | ( | void | ) |
Definition at line 1737 of file autovacuum.c.
References VacuumCostDelay, VacuumCostLimit, WorkerInfoData::wi_cost_delay, and WorkerInfoData::wi_cost_limit.
Referenced by do_autovacuum(), and vacuum_delay_point().
{ if (MyWorkerInfo) { VacuumCostDelay = MyWorkerInfo->wi_cost_delay; VacuumCostLimit = MyWorkerInfo->wi_cost_limit; } }
void AutoVacWorkerFailed | ( | void | ) |
Definition at line 1348 of file autovacuum.c.
References AutoVacuumShmemStruct::av_signal.
Referenced by StartAutovacuumWorker().
{ AutoVacuumShmem->av_signal[AutoVacForkFailed] = true; }
bool IsAutoVacuumLauncherProcess | ( | void | ) |
Definition at line 2845 of file autovacuum.c.
References am_autovacuum_launcher.
Referenced by autovac_refresh_stats(), backend_read_statsfile(), InitPostgres(), InitProcess(), and ProcKill().
{ return am_autovacuum_launcher; }
bool IsAutoVacuumWorkerProcess | ( | void | ) |
Definition at line 2851 of file autovacuum.c.
References am_autovacuum_worker.
Referenced by analyze_rel(), backend_read_statsfile(), CheckMyDatabase(), do_analyze_rel(), ginvacuumcleanup(), InitializeSessionUserIdStandalone(), InitPostgres(), InitProcess(), lazy_vacuum_rel(), pgstat_report_analyze(), pgstat_report_vacuum(), proc_exit(), ProcessInterrupts(), vacuum(), and vacuum_rel().
{ return am_autovacuum_worker; }
int StartAutoVacLauncher | ( | void | ) |
Definition at line 360 of file autovacuum.c.
References AutoVacLauncherMain(), AutoVacPID, ClosePostmasterPorts(), ereport, errmsg(), fork_process(), LOG, NULL, and on_exit_reset().
Referenced by reaper(), and ServerLoop().
{ pid_t AutoVacPID; #ifdef EXEC_BACKEND switch ((AutoVacPID = avlauncher_forkexec())) #else switch ((AutoVacPID = fork_process())) #endif { case -1: ereport(LOG, (errmsg("could not fork autovacuum launcher process: %m"))); return 0; #ifndef EXEC_BACKEND case 0: /* in postmaster child ... */ /* Close the postmaster's sockets */ ClosePostmasterPorts(false); /* Lose the postmaster's on-exit routines */ on_exit_reset(); AutoVacLauncherMain(0, NULL); break; #endif default: return (int) AutoVacPID; } /* shouldn't get here */ return 0; }
int StartAutoVacWorker | ( | void | ) |
Definition at line 1435 of file autovacuum.c.
References AutoVacWorkerMain(), ClosePostmasterPorts(), ereport, errmsg(), fork_process(), LOG, NULL, and on_exit_reset().
Referenced by StartAutovacuumWorker().
{ pid_t worker_pid; #ifdef EXEC_BACKEND switch ((worker_pid = avworker_forkexec())) #else switch ((worker_pid = fork_process())) #endif { case -1: ereport(LOG, (errmsg("could not fork autovacuum worker process: %m"))); return 0; #ifndef EXEC_BACKEND case 0: /* in postmaster child ... */ /* Close the postmaster's sockets */ ClosePostmasterPorts(false); /* Lose the postmaster's on-exit routines */ on_exit_reset(); AutoVacWorkerMain(0, NULL); break; #endif default: return (int) worker_pid; } /* shouldn't get here */ return 0; }
double autovacuum_anl_scale |
Definition at line 117 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
Definition at line 116 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
Definition at line 118 of file autovacuum.c.
Referenced by do_start_worker(), relation_needs_vacanalyze(), SetTransactionIdLimit(), and vacuum_set_xid_limits().
Definition at line 112 of file autovacuum.c.
Referenced by AutoVacuumShmemInit(), AutoVacuumShmemSize(), check_maxconnections(), InitializeMaxBackends(), InitProcGlobal(), MaxLivePostmasterChildren(), and RegisterBackgroundWorker().
Definition at line 113 of file autovacuum.c.
Referenced by AutoVacLauncherMain(), do_start_worker(), launch_worker(), launcher_determine_sleep(), and rebuild_database_list().
Definition at line 111 of file autovacuum.c.
Referenced by autovac_init(), and AutoVacuumingActive().
Definition at line 120 of file autovacuum.c.
Referenced by autovac_balance_cost(), and table_recheck_autovac().
Definition at line 121 of file autovacuum.c.
Referenced by autovac_balance_cost(), and table_recheck_autovac().
double autovacuum_vac_scale |
Definition at line 115 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
Definition at line 114 of file autovacuum.c.
Referenced by relation_needs_vacanalyze().
Definition at line 276 of file autovacuum.c.
Referenced by FreeWorkerInfo(), and ProcKill().
Definition at line 123 of file autovacuum.c.
Referenced by analyze_rel(), do_analyze_rel(), lazy_vacuum_rel(), and vacuum_rel().