1 /*-------------------------------------------------------------------------
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-2002, PostgreSQL Global Development Group
9 * Portions Copyright (c) 1994, Regents of the University of California
11 * $Id: pg_control.h,v 1.10 2002/09/04 20:31:37 momjian Exp $
13 *-------------------------------------------------------------------------
20 #include "access/xlogdefs.h"
21 #include "utils/pg_crc.h"
24 /* Version identifier for this pg_control format */
25 #define PG_CONTROL_VERSION 72
28 * Body of CheckPoint XLOG records. This is declared here because we keep
29 * a copy of the latest one in pg_control for possible disaster recovery.
31 typedef struct CheckPoint
33 XLogRecPtr redo; /* next RecPtr available when we */
34 /* began to create CheckPoint */
35 /* (i.e. REDO start point) */
36 XLogRecPtr undo; /* first record of oldest in-progress */
37 /* transaction when we started */
38 /* (i.e. UNDO end point) */
39 StartUpID ThisStartUpID; /* current SUI */
40 TransactionId nextXid; /* next free XID */
41 Oid nextOid; /* next free OID */
42 time_t time; /* time stamp of checkpoint */
45 /* XLOG info values for XLOG rmgr */
46 #define XLOG_CHECKPOINT_SHUTDOWN 0x00
47 #define XLOG_CHECKPOINT_ONLINE 0x10
48 #define XLOG_NEXTOID 0x30
51 /* System status indicator */
61 #define LOCALE_NAME_BUFLEN 128
64 * Contents of pg_control.
66 * NOTE: try to keep this under 512 bytes so that it will fit on one physical
67 * sector of typical disk drives. This reduces the odds of corruption due to
68 * power failure midway through a write. Currently it fits comfortably,
69 * but we could probably reduce LOCALE_NAME_BUFLEN if things get tight.
72 typedef struct ControlFileData
74 crc64 crc; /* CRC for remainder of struct */
77 * Version identifier information. Keep these fields at the front,
78 * especially pg_control_version; they won't be real useful if they
81 * pg_control_version identifies the format of pg_control itself.
82 * catalog_version_no identifies the format of the system catalogs.
84 * There are additional version identifiers in individual files; for
85 * example, WAL logs contain per-page magic numbers that can serve as
86 * version cues for the WAL log.
88 uint32 pg_control_version; /* PG_CONTROL_VERSION */
89 uint32 catalog_version_no; /* see catversion.h */
94 DBState state; /* see enum above */
95 time_t time; /* time stamp of last pg_control update */
96 uint32 logId; /* current log file id */
97 uint32 logSeg; /* current log file segment, + 1 */
98 XLogRecPtr checkPoint; /* last check point record ptr */
99 XLogRecPtr prevCheckPoint; /* previous check point record ptr */
101 CheckPoint checkPointCopy; /* copy of last check point record */
104 * This data is used to make sure that configuration of this database
105 * is compatible with the backend executable.
107 uint32 blcksz; /* block size for this DB */
108 uint32 relseg_size; /* blocks per segment of large relation */
110 uint32 nameDataLen; /* catalog name field width */
111 uint32 funcMaxArgs; /* maximum number of function arguments */
113 /* flag indicating internal format of timestamp, interval, time */
114 uint32 enableIntTimes; /* int64 storage enabled? */
118 char lc_collate[LOCALE_NAME_BUFLEN];
119 char lc_ctype[LOCALE_NAME_BUFLEN];
122 #endif /* PG_CONTROL_H */