You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postgres/src/backend/utils/init/globals.c

120 lines
2.8 KiB

/*-------------------------------------------------------------------------
*
* globals.c
* global variable declarations
*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.57 2001/05/14 20:30:21 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 <fcntl.h>
#include <sys/file.h>
#include <sys/types.h>
#include <math.h>
#include <unistd.h>
27 years ago
#include "catalog/catname.h"
#include "catalog/indexing.h"
27 years ago
#include "libpq/pqcomm.h"
#include "miscadmin.h"
#include "storage/backendid.h"
ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
bool Noversion = false;
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;
struct Port *MyProcPort;
long MyCancelKey;
char *DataDir = NULL;
/*
* The PGDATA directory user says to use, or defaults to via environment
* variable. NULL if no option given and no environment variable set
*/
Relation reldesc; /* current relation descriptor */
char OutputFileName[MAXPGPATH] = "";
BackendId MyBackendId;
char *DatabaseName = NULL;
char *DatabasePath = NULL;
Oid MyDatabaseId = InvalidOid;
bool IsUnderPostmaster = false;
int DebugLvl = 0;
int DateStyle = USE_ISO_DATES;
bool EuroDates = false;
bool HasCTZSet = false;
bool CDayLight = false;
int CTimeZone = 0;
char CTZName[MAXTZLEN + 1] = "";
char DateFormat[20] = "%d-%m-%Y"; /* mjl: sizes! or better
* malloc? XXX */
char FloatFormat[20] = "%f";
bool enableFsync = true;
bool allowSystemTableMods = false;
int SortMem = 512;
int NBuffers = DEF_NBUFFERS;
char *IndexedCatalogNames[] = {
AttributeRelationName,
ProcedureRelationName,
TypeRelationName,
RelationRelationName,
0
};
/* ----------------
* we just do a linear search now so there's no requirement that the list
* be ordered. The list is so small it shouldn't make much difference.
* make sure the list is null-terminated
* - jolly 8/19/95
*
* OLD COMMENT
* WARNING WARNING WARNING WARNING WARNING WARNING
*
* keep SharedSystemRelationNames[] in SORTED order! A binary search
* is done on it in catalog.c!
*
* XXX this is a serious hack which should be fixed -cim 1/26/90
* ----------------
*/
char *SharedSystemRelationNames[] = {
DatabaseRelationName,
GroupRelationName,
GroupNameIndex,
GroupSysidIndex,
LogRelationName,
ShadowRelationName,
0
};