PostgreSQL Source Code  git master
autovacuum.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * autovacuum.h
4  * header file for integrated autovacuum daemon
5  *
6  *
7  * Portions Copyright (c) 1996-2020, 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  */
23 typedef enum
24 {
27 
28 
29 /* GUC variables */
30 extern bool autovacuum_start_daemon;
31 extern int autovacuum_max_workers;
32 extern int autovacuum_work_mem;
33 extern int autovacuum_naptime;
34 extern int autovacuum_vac_thresh;
35 extern double autovacuum_vac_scale;
36 extern int autovacuum_vac_ins_thresh;
37 extern double autovacuum_vac_ins_scale;
38 extern int autovacuum_anl_thresh;
39 extern double autovacuum_anl_scale;
40 extern int autovacuum_freeze_max_age;
42 extern double autovacuum_vac_cost_delay;
43 extern int autovacuum_vac_cost_limit;
44 
45 /* autovacuum launcher PID, only valid when worker is shutting down */
46 extern int AutovacuumLauncherPid;
47 
49 
50 /* Status inquiry functions */
51 extern bool AutoVacuumingActive(void);
52 extern bool IsAutoVacuumLauncherProcess(void);
53 extern bool IsAutoVacuumWorkerProcess(void);
54 
55 #define IsAnyAutoVacuumProcess() \
56  (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess())
57 
58 /* Functions to start autovacuum process, called from postmaster */
59 extern void autovac_init(void);
60 extern int StartAutoVacLauncher(void);
61 extern int StartAutoVacWorker(void);
62 
63 /* called from postmaster when a worker could not be forked */
64 extern void AutoVacWorkerFailed(void);
65 
66 /* autovacuum cost-delay balancer */
67 extern void AutoVacuumUpdateDelay(void);
68 
69 #ifdef EXEC_BACKEND
70 extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn();
71 extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn();
72 extern void AutovacuumWorkerIAm(void);
73 extern void AutovacuumLauncherIAm(void);
74 #endif
75 
77  Oid relationId, BlockNumber blkno);
78 
79 /* shared memory stuff */
80 extern Size AutoVacuumShmemSize(void);
81 extern void AutoVacuumShmemInit(void);
82 
83 #endif /* AUTOVACUUM_H */
bool AutoVacuumRequestWork(AutoVacuumWorkItemType type, Oid relationId, BlockNumber blkno)
Definition: autovacuum.c:3263
#define pg_attribute_noreturn()
Definition: c.h:146
AutoVacuumWorkItemType
Definition: autovacuum.h:23
Size AutoVacuumShmemSize(void)
Definition: autovacuum.c:3336
int autovacuum_max_workers
Definition: autovacuum.c:115
NON_EXEC_STATIC void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn()
Definition: autovacuum.c:432
void AutoVacuumUpdateDelay(void)
Definition: autovacuum.c:1775
int autovacuum_vac_thresh
Definition: autovacuum.c:118
int autovacuum_freeze_max_age
Definition: autovacuum.c:124
void AutoVacWorkerFailed(void)
Definition: autovacuum.c:1412
double autovacuum_vac_scale
Definition: autovacuum.c:119
uint32 BlockNumber
Definition: block.h:31
void autovac_init(void)
Definition: autovacuum.c:3305
unsigned int Oid
Definition: postgres_ext.h:31
NON_EXEC_STATIC void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn()
Definition: autovacuum.c:1510
bool IsAutoVacuumWorkerProcess(void)
Definition: autovacuum.c:3325
int autovacuum_multixact_freeze_max_age
Definition: autovacuum.c:125
int autovacuum_naptime
Definition: autovacuum.c:117
bool AutoVacuumingActive(void)
Definition: autovacuum.c:3251
int autovacuum_vac_ins_thresh
Definition: autovacuum.c:120
bool IsAutoVacuumLauncherProcess(void)
Definition: autovacuum.c:3319
void AutoVacuumShmemInit(void)
Definition: autovacuum.c:3355
int autovacuum_vac_cost_limit
Definition: autovacuum.c:128
double autovacuum_vac_cost_delay
Definition: autovacuum.c:127
int AutovacuumLauncherPid
Definition: autovacuum.c:305
bool autovacuum_start_daemon
Definition: autovacuum.c:114
double autovacuum_anl_scale
Definition: autovacuum.c:123
int autovacuum_anl_thresh
Definition: autovacuum.c:122
size_t Size
Definition: c.h:474
int StartAutoVacLauncher(void)
int StartAutoVacWorker(void)
Definition: autovacuum.c:1472
int Log_autovacuum_min_duration
Definition: autovacuum.c:130
double autovacuum_vac_ins_scale
Definition: autovacuum.c:121
int autovacuum_work_mem
Definition: autovacuum.c:116