PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
globals.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * globals.c
4  * global variable declarations
5  *
6  * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/utils/init/globals.c
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/libpq-be.h"
22 #include "libpq/pqcomm.h"
23 #include "miscadmin.h"
24 #include "storage/backendid.h"
25 
26 
28 
29 volatile bool InterruptPending = false;
30 volatile bool QueryCancelPending = false;
31 volatile bool ProcDiePending = false;
32 volatile bool ClientConnectionLost = false;
35 volatile uint32 CritSectionCount = 0;
36 
39 struct Port *MyProcPort;
42 
43 /*
44  * MyLatch points to the latch that should be used for signal handling by the
45  * current process. It will either point to a process local latch if the
46  * current process does not have a PGPROC entry in that moment, or to
47  * PGPROC->procLatch if it has. Thus it can always be used in signal handlers,
48  * without checking for its existence.
49  */
50 struct Latch *MyLatch;
51 
52 /*
53  * DataDir is the absolute path to the top level of the PGDATA directory tree.
54  * Except during early startup, this is also the server's working directory;
55  * most code therefore can simply use relative paths and not reference DataDir
56  * explicitly.
57  */
58 char *DataDir = NULL;
59 
60 char OutputFileName[MAXPGPATH]; /* debugging output file */
61 
62 char my_exec_path[MAXPGPATH]; /* full path to my executable */
63 char pkglib_path[MAXPGPATH]; /* full path to lib directory */
64 
65 #ifdef EXEC_BACKEND
66 char postgres_exec_path[MAXPGPATH]; /* full path to backend */
67 
68 /* note: currently this is not valid in backend processes */
69 #endif
70 
72 
74 
76 
77 /*
78  * DatabasePath is the path (relative to DataDir) of my database's
79  * primary directory, ie, its directory in the default tablespace.
80  */
82 
83 pid_t PostmasterPid = 0;
84 
85 /*
86  * IsPostmasterEnvironment is true in a postmaster process and any postmaster
87  * child process; it is false in a standalone process (bootstrap or
88  * standalone backend). IsUnderPostmaster is true in postmaster child
89  * processes. Note that "child process" includes all children, not only
90  * regular backends. These should be set correctly as early as possible
91  * in the execution of a process, so that error handling will do the right
92  * things if an error should occur during process initialization.
93  *
94  * These are initialized for the bootstrap/standalone case.
95  */
97 bool IsUnderPostmaster = false;
98 bool IsBinaryUpgrade = false;
99 bool IsBackgroundWorker = false;
100 
101 bool ExitOnAnyError = false;
102 
106 
107 bool enableFsync = true;
108 bool allowSystemTableMods = false;
109 int work_mem = 1024;
111 
112 /*
113  * Primary determinants of sizes of shared-memory structures.
114  *
115  * MaxBackends is computed by PostmasterMain after modules have had a chance to
116  * register background workers.
117  */
118 int NBuffers = 1000;
119 int MaxConnections = 90;
121 int MaxBackends = 0;
122 
123 int VacuumCostPageHit = 1; /* GUC parameters for vacuum */
126 int VacuumCostLimit = 200;
128 
132 
133 int VacuumCostBalance = 0; /* working state for vacuum */
134 bool VacuumCostActive = false;
bool IsPostmasterEnvironment
Definition: globals.c:96
volatile uint32 InterruptHoldoffCount
Definition: globals.c:33
int MyProcPid
Definition: globals.c:37
BackendId MyBackendId
Definition: globals.c:71
int64 pg_time_t
Definition: pgtime.h:23
int VacuumCostBalance
Definition: globals.c:133
struct Port * MyProcPort
Definition: globals.c:39
int VacuumPageHit
Definition: globals.c:129
pg_time_t MyStartTime
Definition: globals.c:38
volatile uint32 QueryCancelHoldoffCount
Definition: globals.c:34
Definition: libpq-be.h:118
int IntervalStyle
Definition: globals.c:105
unsigned int Oid
Definition: postgres_ext.h:31
volatile bool QueryCancelPending
Definition: globals.c:30
int VacuumCostPageDirty
Definition: globals.c:125
bool IsBinaryUpgrade
Definition: globals.c:98
Oid MyDatabaseTableSpace
Definition: globals.c:75
#define USE_ISO_DATES
Definition: miscadmin.h:208
bool IsBackgroundWorker
Definition: globals.c:99
volatile bool ClientConnectionLost
Definition: globals.c:32
int VacuumCostLimit
Definition: globals.c:126
#define MAXPGPATH
int MaxBackends
Definition: globals.c:121
Definition: latch.h:88
char OutputFileName[MAXPGPATH]
Definition: globals.c:60
bool IsUnderPostmaster
Definition: globals.c:97
unsigned int uint32
Definition: c.h:254
long MyCancelKey
Definition: globals.c:40
volatile uint32 CritSectionCount
Definition: globals.c:35
int VacuumCostPageHit
Definition: globals.c:123
int DateOrder
Definition: globals.c:104
pid_t PostmasterPid
Definition: globals.c:83
uint32 ProtocolVersion
Definition: pqcomm.h:113
bool ExitOnAnyError
Definition: globals.c:101
char my_exec_path[MAXPGPATH]
Definition: globals.c:62
int VacuumPageDirty
Definition: globals.c:131
#define InvalidBackendId
Definition: backendid.h:23
int BackendId
Definition: backendid.h:21
Oid MyDatabaseId
Definition: globals.c:73
int MaxConnections
Definition: globals.c:119
int work_mem
Definition: globals.c:109
bool allowSystemTableMods
Definition: globals.c:108
#define InvalidOid
Definition: postgres_ext.h:36
int VacuumCostDelay
Definition: globals.c:127
int maintenance_work_mem
Definition: globals.c:110
#define DATEORDER_MDY
Definition: miscadmin.h:216
volatile bool InterruptPending
Definition: globals.c:29
char * DatabasePath
Definition: globals.c:81
#define NULL
Definition: c.h:215
int DateStyle
Definition: globals.c:103
bool enableFsync
Definition: globals.c:107
volatile bool ProcDiePending
Definition: globals.c:31
int MyPMChildSlot
Definition: globals.c:41
int NBuffers
Definition: globals.c:118
char * DataDir
Definition: globals.c:58
int max_worker_processes
Definition: globals.c:120
struct Latch * MyLatch
Definition: globals.c:50
int VacuumPageMiss
Definition: globals.c:130
int VacuumCostPageMiss
Definition: globals.c:124
ProtocolVersion FrontendProtocol
Definition: globals.c:27
char pkglib_path[MAXPGPATH]
Definition: globals.c:63
bool VacuumCostActive
Definition: globals.c:134
#define INTSTYLE_POSTGRES
Definition: miscadmin.h:228