Header And Logo

PostgreSQL
| The world's most advanced open source database.

globals.c

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * globals.c
00004  *    global variable declarations
00005  *
00006  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00007  * Portions Copyright (c) 1994, Regents of the University of California
00008  *
00009  *
00010  * IDENTIFICATION
00011  *    src/backend/utils/init/globals.c
00012  *
00013  * NOTES
00014  *    Globals used all over the place should be declared here and not
00015  *    in other modules.
00016  *
00017  *-------------------------------------------------------------------------
00018  */
00019 #include "postgres.h"
00020 
00021 #include "libpq/pqcomm.h"
00022 #include "miscadmin.h"
00023 #include "storage/backendid.h"
00024 
00025 
00026 ProtocolVersion FrontendProtocol;
00027 
00028 volatile bool InterruptPending = false;
00029 volatile bool QueryCancelPending = false;
00030 volatile bool ProcDiePending = false;
00031 volatile bool ClientConnectionLost = false;
00032 volatile bool ImmediateInterruptOK = false;
00033 volatile uint32 InterruptHoldoffCount = 0;
00034 volatile uint32 CritSectionCount = 0;
00035 
00036 int         MyProcPid;
00037 pg_time_t   MyStartTime;
00038 struct Port *MyProcPort;
00039 long        MyCancelKey;
00040 int         MyPMChildSlot;
00041 
00042 /*
00043  * DataDir is the absolute path to the top level of the PGDATA directory tree.
00044  * Except during early startup, this is also the server's working directory;
00045  * most code therefore can simply use relative paths and not reference DataDir
00046  * explicitly.
00047  */
00048 char       *DataDir = NULL;
00049 
00050 char        OutputFileName[MAXPGPATH];  /* debugging output file */
00051 
00052 char        my_exec_path[MAXPGPATH];    /* full path to my executable */
00053 char        pkglib_path[MAXPGPATH];     /* full path to lib directory */
00054 
00055 #ifdef EXEC_BACKEND
00056 char        postgres_exec_path[MAXPGPATH];      /* full path to backend */
00057 
00058 /* note: currently this is not valid in backend processes */
00059 #endif
00060 
00061 BackendId   MyBackendId = InvalidBackendId;
00062 
00063 Oid         MyDatabaseId = InvalidOid;
00064 
00065 Oid         MyDatabaseTableSpace = InvalidOid;
00066 
00067 /*
00068  * DatabasePath is the path (relative to DataDir) of my database's
00069  * primary directory, ie, its directory in the default tablespace.
00070  */
00071 char       *DatabasePath = NULL;
00072 
00073 pid_t       PostmasterPid = 0;
00074 
00075 /*
00076  * IsPostmasterEnvironment is true in a postmaster process and any postmaster
00077  * child process; it is false in a standalone process (bootstrap or
00078  * standalone backend).  IsUnderPostmaster is true in postmaster child
00079  * processes.  Note that "child process" includes all children, not only
00080  * regular backends.  These should be set correctly as early as possible
00081  * in the execution of a process, so that error handling will do the right
00082  * things if an error should occur during process initialization.
00083  *
00084  * These are initialized for the bootstrap/standalone case.
00085  */
00086 bool        IsPostmasterEnvironment = false;
00087 bool        IsUnderPostmaster = false;
00088 bool        IsBinaryUpgrade = false;
00089 bool        IsBackgroundWorker = false;
00090 
00091 bool        ExitOnAnyError = false;
00092 
00093 int         DateStyle = USE_ISO_DATES;
00094 int         DateOrder = DATEORDER_MDY;
00095 int         IntervalStyle = INTSTYLE_POSTGRES;
00096 bool        HasCTZSet = false;
00097 int         CTimeZone = 0;
00098 
00099 bool        enableFsync = true;
00100 bool        allowSystemTableMods = false;
00101 int         work_mem = 1024;
00102 int         maintenance_work_mem = 16384;
00103 
00104 /*
00105  * Primary determinants of sizes of shared-memory structures.
00106  *
00107  * MaxBackends is computed by PostmasterMain after modules have had a chance to
00108  * register background workers.
00109  */
00110 int         NBuffers = 1000;
00111 int         MaxConnections = 90;
00112 int         MaxBackends = 0;
00113 
00114 int         VacuumCostPageHit = 1;      /* GUC parameters for vacuum */
00115 int         VacuumCostPageMiss = 10;
00116 int         VacuumCostPageDirty = 20;
00117 int         VacuumCostLimit = 200;
00118 int         VacuumCostDelay = 0;
00119 
00120 int         VacuumPageHit = 0;
00121 int         VacuumPageMiss = 0;
00122 int         VacuumPageDirty = 0;
00123 
00124 int         VacuumCostBalance = 0;      /* working state for vacuum */
00125 bool        VacuumCostActive = false;
00126 
00127 int         GinFuzzySearchLimit = 0;