Make LC_COLLATE and LC_CTYPE database-level settings. Collation and
[PostgreSQL.git] / src / include / catalog / pg_control.h
blob38a82087973f1fa33ac8cc5a6485674c699ec4cb
1 /*-------------------------------------------------------------------------
3 * pg_control.h
4 * The system control file "pg_control" is not a heap relation.
5 * However, we define it here so that the format is documented.
8 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $PostgreSQL$
13 *-------------------------------------------------------------------------
15 #ifndef PG_CONTROL_H
16 #define PG_CONTROL_H
18 #include "access/xlogdefs.h"
19 #include "pgtime.h" /* for pg_time_t */
20 #include "utils/pg_crc.h"
23 /* Version identifier for this pg_control format */
24 #define PG_CONTROL_VERSION 843
27 * Body of CheckPoint XLOG records. This is declared here because we keep
28 * a copy of the latest one in pg_control for possible disaster recovery.
30 typedef struct CheckPoint
32 XLogRecPtr redo; /* next RecPtr available when we began to
33 * create CheckPoint (i.e. REDO start point) */
34 TimeLineID ThisTimeLineID; /* current TLI */
35 uint32 nextXidEpoch; /* higher-order bits of nextXid */
36 TransactionId nextXid; /* next free XID */
37 Oid nextOid; /* next free OID */
38 MultiXactId nextMulti; /* next free MultiXactId */
39 MultiXactOffset nextMultiOffset; /* next free MultiXact offset */
40 pg_time_t time; /* time stamp of checkpoint */
41 } CheckPoint;
43 /* XLOG info values for XLOG rmgr */
44 #define XLOG_CHECKPOINT_SHUTDOWN 0x00
45 #define XLOG_CHECKPOINT_ONLINE 0x10
46 #define XLOG_NOOP 0x20
47 #define XLOG_NEXTOID 0x30
48 #define XLOG_SWITCH 0x40
51 /* System status indicator */
52 typedef enum DBState
54 DB_STARTUP = 0,
55 DB_SHUTDOWNED,
56 DB_SHUTDOWNING,
57 DB_IN_CRASH_RECOVERY,
58 DB_IN_ARCHIVE_RECOVERY,
59 DB_IN_PRODUCTION
60 } DBState;
63 * Contents of pg_control.
65 * NOTE: try to keep this under 512 bytes so that it will fit on one physical
66 * sector of typical disk drives. This reduces the odds of corruption due to
67 * power failure midway through a write.
70 typedef struct ControlFileData
73 * Unique system identifier --- to ensure we match up xlog files with the
74 * installation that produced them.
76 uint64 system_identifier;
79 * Version identifier information. Keep these fields at the same offset,
80 * especially pg_control_version; they won't be real useful if they move
81 * around. (For historical reasons they must be 8 bytes into the file
82 * rather than immediately at the front.)
84 * pg_control_version identifies the format of pg_control itself.
85 * catalog_version_no identifies the format of the system catalogs.
87 * There are additional version identifiers in individual files; for
88 * example, WAL logs contain per-page magic numbers that can serve as
89 * version cues for the WAL log.
91 uint32 pg_control_version; /* PG_CONTROL_VERSION */
92 uint32 catalog_version_no; /* see catversion.h */
95 * System status data
97 DBState state; /* see enum above */
98 pg_time_t time; /* time stamp of last pg_control update */
99 XLogRecPtr checkPoint; /* last check point record ptr */
100 XLogRecPtr prevCheckPoint; /* previous check point record ptr */
102 CheckPoint checkPointCopy; /* copy of last check point record */
104 XLogRecPtr minRecoveryPoint; /* must replay xlog to here */
107 * This data is used to check for hardware-architecture compatibility of
108 * the database and the backend executable. We need not check endianness
109 * explicitly, since the pg_control version will surely look wrong to a
110 * machine of different endianness, but we do need to worry about MAXALIGN
111 * and floating-point format. (Note: storage layout nominally also
112 * depends on SHORTALIGN and INTALIGN, but in practice these are the same
113 * on all architectures of interest.)
115 * Testing just one double value is not a very bulletproof test for
116 * floating-point compatibility, but it will catch most cases.
118 uint32 maxAlign; /* alignment requirement for tuples */
119 double floatFormat; /* constant 1234567.0 */
120 #define FLOATFORMAT_VALUE 1234567.0
123 * This data is used to make sure that configuration of this database is
124 * compatible with the backend executable.
126 uint32 blcksz; /* data block size for this DB */
127 uint32 relseg_size; /* blocks per segment of large relation */
129 uint32 xlog_blcksz; /* block size within WAL files */
130 uint32 xlog_seg_size; /* size of each WAL segment */
132 uint32 nameDataLen; /* catalog name field width */
133 uint32 indexMaxKeys; /* max number of columns in an index */
135 uint32 toast_max_chunk_size; /* chunk size in TOAST tables */
137 /* flag indicating internal format of timestamp, interval, time */
138 bool enableIntTimes; /* int64 storage enabled? */
140 /* flags indicating pass-by-value status of various types */
141 bool float4ByVal; /* float4 pass-by-value? */
142 bool float8ByVal; /* float8, int8, etc pass-by-value? */
144 /* CRC of all above ... MUST BE LAST! */
145 pg_crc32 crc;
146 } ControlFileData;
149 * Physical size of the pg_control file. Note that this is considerably
150 * bigger than the actually used size (ie, sizeof(ControlFileData)).
151 * The idea is to keep the physical size constant independent of format
152 * changes, so that ReadControlFile will deliver a suitable wrong-version
153 * message instead of a read error if it's looking at an incompatible file.
155 #define PG_CONTROL_SIZE 8192
157 #endif /* PG_CONTROL_H */