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 | */ |
23 | typedef enum |
24 | { |
25 | AVW_BRINSummarizeRange |
26 | } AutoVacuumWorkItemType; |
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_anl_thresh; |
37 | extern double autovacuum_anl_scale; |
38 | extern int autovacuum_freeze_max_age; |
39 | extern int autovacuum_multixact_freeze_max_age; |
40 | extern double autovacuum_vac_cost_delay; |
41 | extern int autovacuum_vac_cost_limit; |
42 | |
43 | /* autovacuum launcher PID, only valid when worker is shutting down */ |
44 | extern int AutovacuumLauncherPid; |
45 | |
46 | extern int Log_autovacuum_min_duration; |
47 | |
48 | /* Status inquiry functions */ |
49 | extern bool AutoVacuumingActive(void); |
50 | extern bool IsAutoVacuumLauncherProcess(void); |
51 | extern bool IsAutoVacuumWorkerProcess(void); |
52 | |
53 | #define IsAnyAutoVacuumProcess() \ |
54 | (IsAutoVacuumLauncherProcess() || IsAutoVacuumWorkerProcess()) |
55 | |
56 | /* Functions to start autovacuum process, called from postmaster */ |
57 | extern void autovac_init(void); |
58 | extern int StartAutoVacLauncher(void); |
59 | extern int StartAutoVacWorker(void); |
60 | |
61 | /* called from postmaster when a worker could not be forked */ |
62 | extern void AutoVacWorkerFailed(void); |
63 | |
64 | /* autovacuum cost-delay balancer */ |
65 | extern void AutoVacuumUpdateDelay(void); |
66 | |
67 | #ifdef EXEC_BACKEND |
68 | extern void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_noreturn(); |
69 | extern void AutoVacWorkerMain(int argc, char *argv[]) pg_attribute_noreturn(); |
70 | extern void AutovacuumWorkerIAm(void); |
71 | extern void AutovacuumLauncherIAm(void); |
72 | #endif |
73 | |
74 | extern bool AutoVacuumRequestWork(AutoVacuumWorkItemType type, |
75 | Oid relationId, BlockNumber blkno); |
76 | |
77 | /* shared memory stuff */ |
78 | extern Size AutoVacuumShmemSize(void); |
79 | extern void AutoVacuumShmemInit(void); |
80 | |
81 | #endif /* AUTOVACUUM_H */ |
82 | |