]> granicus.if.org Git - postgresql/blob - src/backend/utils/init/globals.c
Add a multi-worker capability to autovacuum. This allows multiple worker
[postgresql] / src / backend / utils / init / globals.c
1 /*-------------------------------------------------------------------------
2  *
3  * globals.c
4  *        global variable declarations
5  *
6  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *        $PostgreSQL: pgsql/src/backend/utils/init/globals.c,v 1.101 2007/04/16 18:29:54 alvherre Exp $
12  *
13  * NOTES
14  *        Globals used all over the place should be declared here and not
15  *        in other modules.
16  *
17  *-------------------------------------------------------------------------
18  */
19 #include "postgres.h"
20
21 #include "libpq/pqcomm.h"
22 #include "miscadmin.h"
23 #include "storage/backendid.h"
24
25
26 ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
27
28 volatile bool InterruptPending = false;
29 volatile bool QueryCancelPending = false;
30 volatile bool ProcDiePending = false;
31 volatile bool ImmediateInterruptOK = false;
32 volatile uint32 InterruptHoldoffCount = 0;
33 volatile uint32 CritSectionCount = 0;
34
35 int                     MyProcPid;
36 struct Port *MyProcPort;
37 long            MyCancelKey;
38
39 /*
40  * DataDir is the absolute path to the top level of the PGDATA directory tree.
41  * Except during early startup, this is also the server's working directory;
42  * most code therefore can simply use relative paths and not reference DataDir
43  * explicitly.
44  */
45 char       *DataDir = NULL;
46
47 char            OutputFileName[MAXPGPATH];      /* debugging output file */
48
49 char            my_exec_path[MAXPGPATH];        /* full path to my executable */
50 char            pkglib_path[MAXPGPATH];         /* full path to lib directory */
51
52 #ifdef EXEC_BACKEND
53 char            postgres_exec_path[MAXPGPATH];          /* full path to backend */
54
55 /* note: currently this is not valid in backend processes */
56 #endif
57
58 BackendId       MyBackendId = InvalidBackendId;
59
60 Oid                     MyDatabaseId = InvalidOid;
61
62 Oid                     MyDatabaseTableSpace = InvalidOid;
63
64 /*
65  * DatabasePath is the path (relative to DataDir) of my database's
66  * primary directory, ie, its directory in the default tablespace.
67  */
68 char       *DatabasePath = NULL;
69
70 pid_t           PostmasterPid = 0;
71
72 /*
73  * IsPostmasterEnvironment is true in a postmaster process and any postmaster
74  * child process; it is false in a standalone process (bootstrap or
75  * standalone backend).  IsUnderPostmaster is true in postmaster child
76  * processes.  Note that "child process" includes all children, not only
77  * regular backends.  These should be set correctly as early as possible
78  * in the execution of a process, so that error handling will do the right
79  * things if an error should occur during process initialization.
80  *
81  * These are initialized for the bootstrap/standalone case.
82  */
83 bool            IsPostmasterEnvironment = false;
84 bool            IsUnderPostmaster = false;
85
86 bool            ExitOnAnyError = false;
87
88 int                     DateStyle = USE_ISO_DATES;
89 int                     DateOrder = DATEORDER_MDY;
90 bool            HasCTZSet = false;
91 int                     CTimeZone = 0;
92
93 bool            enableFsync = true;
94 bool            allowSystemTableMods = false;
95 int                     work_mem = 1024;
96 int                     maintenance_work_mem = 16384;
97
98 /*
99  * Primary determinants of sizes of shared-memory structures.  MaxBackends is
100  * MaxConnections + autovacuum_max_workers (it is computed by the GUC assign
101  * hook):
102  */
103 int                     NBuffers = 1000;
104 int                     MaxBackends = 100;
105 int                     MaxConnections = 90;
106
107 int                     VacuumCostPageHit = 1;          /* GUC parameters for vacuum */
108 int                     VacuumCostPageMiss = 10;
109 int                     VacuumCostPageDirty = 20;
110 int                     VacuumCostLimit = 200;
111 int                     VacuumCostDelay = 0;
112
113 int                     VacuumCostBalance = 0;          /* working state for vacuum */
114 bool            VacuumCostActive = false;
115
116 int                     GinFuzzySearchLimit = 0;