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