35 printf(
_(
"%s displays control information of a PostgreSQL database cluster.\n\n"),
progname);
39 printf(
_(
" [-D, --pgdata=]DATADIR data directory\n"));
40 printf(
_(
" -V, --version output version information, then exit\n"));
41 printf(
_(
" -?, --help show this help, then exit\n"));
42 printf(
_(
"\nIf no data directory (DATADIR) is specified, "
43 "the environment variable PGDATA\nis used.\n\n"));
44 printf(
_(
"Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
45 printf(
_(
"%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
55 return _(
"starting up");
57 return _(
"shut down");
59 return _(
"shut down in recovery");
61 return _(
"shutting down");
63 return _(
"in crash recovery");
65 return _(
"in archive recovery");
67 return _(
"in production");
69 return _(
"unrecognized status code");
84 return _(
"unrecognized wal_level");
89 main(
int argc,
char *argv[])
91 static struct option long_options[] = {
100 char pgctime_str[128];
101 char ckpttime_str[128];
103 const char *strftime_fmt =
"%c";
116 if (strcmp(argv[1],
"--help") == 0 || strcmp(argv[1],
"-?") == 0)
121 if (strcmp(argv[1],
"--version") == 0 || strcmp(argv[1],
"-V") == 0)
123 puts(
"pg_controldata (PostgreSQL) " PG_VERSION);
128 while ((
c =
getopt_long(argc, argv,
"D:", long_options, NULL)) != -1)
154 pg_log_error(
"too many command-line arguments (first is \"%s\")",
170 printf(
_(
"WARNING: Calculated CRC checksum does not match value stored in file.\n"
171 "Either the file is corrupt, or it has a different layout than this program\n"
172 "is expecting. The results below are untrustworthy.\n\n"));
179 printf(
_(
"WARNING: invalid WAL segment size\n"));
180 printf(
ngettext(
"The WAL segment size stored in the file, %d byte, is not a power of two\n"
181 "between 1 MB and 1 GB. The file is corrupt and the results below are\n"
182 "untrustworthy.\n\n",
183 "The WAL segment size stored in the file, %d bytes, is not a power of two\n"
184 "between 1 MB and 1 GB. The file is corrupt and the results below are\n"
185 "untrustworthy.\n\n",
200 strftime(pgctime_str,
sizeof(pgctime_str), strftime_fmt,
201 localtime(&time_tmp));
203 strftime(ckpttime_str,
sizeof(ckpttime_str), strftime_fmt,
204 localtime(&time_tmp));
222 strcpy(xlogfilename,
_(
"???"));
225 snprintf(&mock_auth_nonce_str[
i * 2], 3,
"%02x",
228 printf(
_(
"pg_control version number: %u\n"),
230 printf(
_(
"Catalog version number: %u\n"),
232 printf(
_(
"Database system identifier: %llu\n"),
234 printf(
_(
"Database cluster state: %s\n"),
236 printf(
_(
"pg_control last modified: %s\n"),
238 printf(
_(
"Latest checkpoint location: %X/%X\n"),
240 printf(
_(
"Latest checkpoint's REDO location: %X/%X\n"),
242 printf(
_(
"Latest checkpoint's REDO WAL file: %s\n"),
244 printf(
_(
"Latest checkpoint's TimeLineID: %u\n"),
246 printf(
_(
"Latest checkpoint's PrevTimeLineID: %u\n"),
248 printf(
_(
"Latest checkpoint's full_page_writes: %s\n"),
250 printf(
_(
"Latest checkpoint's NextXID: %u:%u\n"),
253 printf(
_(
"Latest checkpoint's NextOID: %u\n"),
255 printf(
_(
"Latest checkpoint's NextMultiXactId: %u\n"),
257 printf(
_(
"Latest checkpoint's NextMultiOffset: %u\n"),
259 printf(
_(
"Latest checkpoint's oldestXID: %u\n"),
261 printf(
_(
"Latest checkpoint's oldestXID's DB: %u\n"),
263 printf(
_(
"Latest checkpoint's oldestActiveXID: %u\n"),
265 printf(
_(
"Latest checkpoint's oldestMultiXid: %u\n"),
267 printf(
_(
"Latest checkpoint's oldestMulti's DB: %u\n"),
269 printf(
_(
"Latest checkpoint's oldestCommitTsXid:%u\n"),
271 printf(
_(
"Latest checkpoint's newestCommitTsXid:%u\n"),
273 printf(
_(
"Time of latest checkpoint: %s\n"),
275 printf(
_(
"Fake LSN counter for unlogged rels: %X/%X\n"),
277 printf(
_(
"Minimum recovery ending location: %X/%X\n"),
279 printf(
_(
"Min recovery ending loc's timeline: %u\n"),
281 printf(
_(
"Backup start location: %X/%X\n"),
283 printf(
_(
"Backup end location: %X/%X\n"),
285 printf(
_(
"End-of-backup record required: %s\n"),
287 printf(
_(
"wal_level setting: %s\n"),
289 printf(
_(
"wal_log_hints setting: %s\n"),
291 printf(
_(
"max_connections setting: %d\n"),
293 printf(
_(
"max_worker_processes setting: %d\n"),
295 printf(
_(
"max_wal_senders setting: %d\n"),
297 printf(
_(
"max_prepared_xacts setting: %d\n"),
299 printf(
_(
"max_locks_per_xact setting: %d\n"),
301 printf(
_(
"track_commit_timestamp setting: %s\n"),
303 printf(
_(
"Maximum data alignment: %u\n"),
306 printf(
_(
"Database block size: %u\n"),
308 printf(
_(
"Blocks per segment of large relation: %u\n"),
310 printf(
_(
"WAL block size: %u\n"),
312 printf(
_(
"Bytes per WAL segment: %u\n"),
314 printf(
_(
"Maximum length of identifiers: %u\n"),
316 printf(
_(
"Maximum columns in an index: %u\n"),
318 printf(
_(
"Maximum size of a TOAST chunk: %u\n"),
320 printf(
_(
"Size of a large-object chunk: %u\n"),
323 printf(
_(
"Date/time type storage: %s\n"),
324 _(
"64-bit integers"));
325 printf(
_(
"Float8 argument passing: %s\n"),
327 printf(
_(
"Data page checksum version: %u\n"),
329 printf(
_(
"Mock authentication nonce: %s\n"),
330 mock_auth_nonce_str);
static void usage(const char *progname)
int main(int argc, char *argv[])
static const char * dbState(DBState state)
static const char * wal_level_str(WalLevel wal_level)
#define ngettext(s, p, n)
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
ControlFileData * get_controlfile(const char *DataDir, bool *crc_ok_p)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
#define MOCK_AUTH_NONCE_LEN
@ DB_SHUTDOWNED_IN_RECOVERY
PGDLLIMPORT char * optarg
const char * get_progname(const char *argv0)
MultiXactOffset nextMultiOffset
TransactionId newestCommitTsXid
TimeLineID PrevTimeLineID
TimeLineID ThisTimeLineID
TransactionId oldestActiveXid
FullTransactionId nextXid
TransactionId oldestCommitTsXid
char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]
uint32 pg_control_version
XLogRecPtr backupStartPoint
bool track_commit_timestamp
CheckPoint checkPointCopy
XLogRecPtr backupEndPoint
XLogRecPtr minRecoveryPoint
uint32 data_checksum_version
uint32 catalog_version_no
TimeLineID minRecoveryPointTLI
uint32 toast_max_chunk_size
#define EpochFromFullTransactionId(x)
#define XidFromFullTransactionId(x)
static ControlFileData * ControlFile
#define IsValidWalSegSize(size)
#define XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes)
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
#define LSN_FORMAT_ARGS(lsn)