1/*-------------------------------------------------------------------------
2 *
3 * autovacuum.h
4 * header file for integrated autovacuum daemon
5 *
6 *
7 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/postmaster/autovacuum.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef AUTOVACUUM_H
15#define AUTOVACUUM_H
16
17#include "storage/block.h"
18
19/*
20 * Other processes can request specific work from autovacuum, identified by
21 * AutoVacuumWorkItem elements.
22 */
23typedef enum
24{
25 AVW_BRINSummarizeRange
26} AutoVacuumWorkItemType;
27
28
29/* GUC variables */
30extern bool autovacuum_start_daemon;
31extern int autovacuum_max_workers;
32extern int autovacuum_work_mem;
33extern int autovacuum_naptime;
34extern int autovacuum_vac_thresh;
35extern double autovacuum_vac_scale;
36extern int autovacuum_anl_thresh;
37extern double autovacuum_anl_scale;
38extern int autovacuum_freeze_max_age;
39extern int autovacuum_multixact_freeze_max_age;
40extern double autovacuum_vac_cost_delay;
41extern int autovacuum_vac_cost_limit;
42
43/* autovacuum launcher PID, only valid when worker is shutting down */
44extern int AutovacuumLauncherPid;
45
46extern int Log_autovacuum_min_duration;
47
48/* Status inquiry functions */
49extern bool AutoVacuumingActive(void);
50extern bool IsAutoVacuumLauncherProcess(void);
51extern bool IsAutoVacuumWorkerProcess(void);
52
53#define IsAnyAutoVacuumProcess() \
54 (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())
55
56/* Functions to start autovacuum process, called from postmaster */
57extern void autovac_init(void);
58extern int StartAutoVacLauncher(void);
59extern int StartAutoVacWorker(void);
60
61/* called from postmaster when a worker could not be forked */
62extern void AutoVacWorkerFailed(void);
63
64/* autovacuum cost-delay balancer */
65extern void AutoVacuumUpdateDelay(void);
66
67#ifdef EXEC_BACKEND
68extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn();
69extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn();
70extern void AutovacuumWorkerIAm(void);
71extern void AutovacuumLauncherIAm(void);
72#endif
73
74extern bool AutoVacuumRequestWork(AutoVacuumWorkItemType type,
75 Oid relationId, BlockNumber blkno);
76
77/* shared memory stuff */
78extern Size AutoVacuumShmemSize(void);
79extern void AutoVacuumShmemInit(void);
80
81#endif /* AUTOVACUUM_H */
82