|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* globals.c
|
|
|
|
* global variable declarations
|
|
|
|
*
|
|
|
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/init/globals.c,v 1.104 2008/01/01 19:45:53 momjian Exp $
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Globals used all over the place should be declared here and not
|
|
|
|
* in other modules.
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
XLOG (and related) changes:
* Store two past checkpoint locations, not just one, in pg_control.
On startup, we fall back to the older checkpoint if the newer one
is unreadable. Also, a physical copy of the newest checkpoint record
is kept in pg_control for possible use in disaster recovery (ie,
complete loss of pg_xlog). Also add a version number for pg_control
itself. Remove archdir from pg_control; it ought to be a GUC
parameter, not a special case (not that it's implemented yet anyway).
* Suppress successive checkpoint records when nothing has been entered
in the WAL log since the last one. This is not so much to avoid I/O
as to make it actually useful to keep track of the last two
checkpoints. If the things are right next to each other then there's
not a lot of redundancy gained...
* Change CRC scheme to a true 64-bit CRC, not a pair of 32-bit CRCs
on alternate bytes. Polynomial borrowed from ECMA DLT1 standard.
* Fix XLOG record length handling so that it will work at BLCKSZ = 32k.
* Change XID allocation to work more like OID allocation. (This is of
dubious necessity, but I think it's a good idea anyway.)
* Fix a number of minor bugs, such as off-by-one logic for XLOG file
wraparound at the 4 gig mark.
* Add documentation and clean up some coding infelicities; move file
format declarations out to include files where planned contrib
utilities can get at them.
* Checkpoint will now occur every CHECKPOINT_SEGMENTS log segments or
every CHECKPOINT_TIMEOUT seconds, whichever comes first. It is also
possible to force a checkpoint by sending SIGUSR1 to the postmaster
(undocumented feature...)
* Defend against kill -9 postmaster by storing shmem block's key and ID
in postmaster.pid lockfile, and checking at startup to ensure that no
processes are still connected to old shmem block (if it still exists).
* Switch backends to accept SIGQUIT rather than SIGUSR1 for emergency
stop, for symmetry with postmaster and xlog utilities. Clean up signal
handling in bootstrap.c so that xlog utilities launched by postmaster
will react to signals better.
* Standalone bootstrap now grabs lockfile in target directory, as added
insurance against running it in parallel with live postmaster.
25 years ago
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include "libpq/pqcomm.h"
|
|
|
|
#include "miscadmin.h"
|
|
|
|
#include "storage/backendid.h"
|
|
|
|
|
|
|
|
|
|
|
|
ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
|
|
|
|
|
|
|
|
volatile bool InterruptPending = false;
|
|
|
|
volatile bool QueryCancelPending = false;
|
|
|
|
volatile bool ProcDiePending = false;
|
|
|
|
volatile bool ImmediateInterruptOK = false;
|
|
|
|
volatile uint32 InterruptHoldoffCount = 0;
|
|
|
|
volatile uint32 CritSectionCount = 0;
|
|
|
|
|
|
|
|
int MyProcPid;
|
|
|
|
time_t MyStartTime;
|
|
|
|
struct Port *MyProcPort;
|
|
|
|
long MyCancelKey;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DataDir is the absolute path to the top level of the PGDATA directory tree.
|
|
|
|
* Except during early startup, this is also the server's working directory;
|
|
|
|
* most code therefore can simply use relative paths and not reference DataDir
|
|
|
|
* explicitly.
|
|
|
|
*/
|
|
|
|
char *DataDir = NULL;
|
|
|
|
|
|
|
|
char OutputFileName[MAXPGPATH]; /* debugging output file */
|
|
|
|
|
|
|
|
char my_exec_path[MAXPGPATH]; /* full path to my executable */
|
|
|
|
char pkglib_path[MAXPGPATH]; /* full path to lib directory */
|
|
|
|
|
|
|
|
#ifdef EXEC_BACKEND
|
|
|
|
char postgres_exec_path[MAXPGPATH]; /* full path to backend */
|
|
|
|
|
|
|
|
/* note: currently this is not valid in backend processes */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BackendId MyBackendId = InvalidBackendId;
|
|
|
|
|
|
|
|
Oid MyDatabaseId = InvalidOid;
|
|
|
|
|
|
|
|
Oid MyDatabaseTableSpace = InvalidOid;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DatabasePath is the path (relative to DataDir) of my database's
|
|
|
|
* primary directory, ie, its directory in the default tablespace.
|
|
|
|
*/
|
|
|
|
char *DatabasePath = NULL;
|
|
|
|
|
|
|
|
pid_t PostmasterPid = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IsPostmasterEnvironment is true in a postmaster process and any postmaster
|
|
|
|
* child process; it is false in a standalone process (bootstrap or
|
|
|
|
* standalone backend). IsUnderPostmaster is true in postmaster child
|
|
|
|
* processes. Note that "child process" includes all children, not only
|
|
|
|
* regular backends. These should be set correctly as early as possible
|
|
|
|
* in the execution of a process, so that error handling will do the right
|
|
|
|
* things if an error should occur during process initialization.
|
|
|
|
*
|
|
|
|
* These are initialized for the bootstrap/standalone case.
|
|
|
|
*/
|
|
|
|
bool IsPostmasterEnvironment = false;
|
|
|
|
bool IsUnderPostmaster = false;
|
|
|
|
|
|
|
|
bool ExitOnAnyError = false;
|
|
|
|
|
Make ISO date style (e.g. "2000-02-16 09:33") the default.
Implement "date/time grand unification".
Transform datetime and timespan into timestamp and interval.
Deprecate datetime and timespan, though translate to new types in gram.y.
Transform all datetime and timespan catalog entries into new types.
Make "INTERVAL" reserved word allowed as a column identifier in gram.y.
Remove dt.h, dt.c files, and retarget datetime.h, datetime.c as utility
routines for all date/time types.
date.{h,c} now deals with date, time types.
timestamp.{h,c} now deals with timestamp, interval types.
nabstime.{h,c} now deals with abstime, reltime, tinterval types.
Make NUMERIC a known native type for purposes of type coersion. Not tested.
26 years ago
|
|
|
int DateStyle = USE_ISO_DATES;
|
|
|
|
int DateOrder = DATEORDER_MDY;
|
|
|
|
bool HasCTZSet = false;
|
|
|
|
int CTimeZone = 0;
|
|
|
|
|
|
|
|
bool enableFsync = true;
|
|
|
|
bool allowSystemTableMods = false;
|
|
|
|
int work_mem = 1024;
|
|
|
|
int maintenance_work_mem = 16384;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Primary determinants of sizes of shared-memory structures. MaxBackends is
|
|
|
|
* MaxConnections + autovacuum_max_workers (it is computed by the GUC assign
|
|
|
|
* hook):
|
|
|
|
*/
|
|
|
|
int NBuffers = 1000;
|
|
|
|
int MaxBackends = 100;
|
|
|
|
int MaxConnections = 90;
|
|
|
|
|
|
|
|
int VacuumCostPageHit = 1; /* GUC parameters for vacuum */
|
|
|
|
int VacuumCostPageMiss = 10;
|
|
|
|
int VacuumCostPageDirty = 20;
|
|
|
|
int VacuumCostLimit = 200;
|
|
|
|
int VacuumCostDelay = 0;
|
|
|
|
|
|
|
|
int VacuumCostBalance = 0; /* working state for vacuum */
|
|
|
|
bool VacuumCostActive = false;
|
|
|
|
|
|
|
|
int GinFuzzySearchLimit = 0;
|