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\")",
171 pg_log_warning(
"calculated CRC checksum does not match value stored in control file");
172 pg_log_warning_detail(
"Either the control file is corrupt, or it has a different layout than this program "
173 "is expecting. The results below are untrustworthy.");
182 "invalid WAL segment size in control file (%d bytes)",
199 strftime(pgctime_str,
sizeof(pgctime_str), strftime_fmt,
200 localtime(&time_tmp));
202 strftime(ckpttime_str,
sizeof(ckpttime_str), strftime_fmt,
203 localtime(&time_tmp));
221 strcpy(xlogfilename,
_(
"???"));
224 snprintf(&mock_auth_nonce_str[
i * 2], 3,
"%02x",
227 printf(
_(
"pg_control version number: %u\n"),
229 printf(
_(
"Catalog version number: %u\n"),
231 printf(
_(
"Database system identifier: %llu\n"),
233 printf(
_(
"Database cluster state: %s\n"),
235 printf(
_(
"pg_control last modified: %s\n"),
237 printf(
_(
"Latest checkpoint location: %X/%X\n"),
239 printf(
_(
"Latest checkpoint's REDO location: %X/%X\n"),
241 printf(
_(
"Latest checkpoint's REDO WAL file: %s\n"),
243 printf(
_(
"Latest checkpoint's TimeLineID: %u\n"),
245 printf(
_(
"Latest checkpoint's PrevTimeLineID: %u\n"),
247 printf(
_(
"Latest checkpoint's full_page_writes: %s\n"),
249 printf(
_(
"Latest checkpoint's NextXID: %u:%u\n"),
252 printf(
_(
"Latest checkpoint's NextOID: %u\n"),
254 printf(
_(
"Latest checkpoint's NextMultiXactId: %u\n"),
256 printf(
_(
"Latest checkpoint's NextMultiOffset: %u\n"),
258 printf(
_(
"Latest checkpoint's oldestXID: %u\n"),
260 printf(
_(
"Latest checkpoint's oldestXID's DB: %u\n"),
262 printf(
_(
"Latest checkpoint's oldestActiveXID: %u\n"),
264 printf(
_(
"Latest checkpoint's oldestMultiXid: %u\n"),
266 printf(
_(
"Latest checkpoint's oldestMulti's DB: %u\n"),
268 printf(
_(
"Latest checkpoint's oldestCommitTsXid:%u\n"),
270 printf(
_(
"Latest checkpoint's newestCommitTsXid:%u\n"),
272 printf(
_(
"Time of latest checkpoint: %s\n"),
274 printf(
_(
"Fake LSN counter for unlogged rels: %X/%X\n"),
276 printf(
_(
"Minimum recovery ending location: %X/%X\n"),
278 printf(
_(
"Min recovery ending loc's timeline: %u\n"),
280 printf(
_(
"Backup start location: %X/%X\n"),
282 printf(
_(
"Backup end location: %X/%X\n"),
284 printf(
_(
"End-of-backup record required: %s\n"),
286 printf(
_(
"wal_level setting: %s\n"),
288 printf(
_(
"wal_log_hints setting: %s\n"),
290 printf(
_(
"max_connections setting: %d\n"),
292 printf(
_(
"max_worker_processes setting: %d\n"),
294 printf(
_(
"max_wal_senders setting: %d\n"),
296 printf(
_(
"max_prepared_xacts setting: %d\n"),
298 printf(
_(
"max_locks_per_xact setting: %d\n"),
300 printf(
_(
"track_commit_timestamp setting: %s\n"),
302 printf(
_(
"Maximum data alignment: %u\n"),
305 printf(
_(
"Database block size: %u\n"),
307 printf(
_(
"Blocks per segment of large relation: %u\n"),
309 printf(
_(
"WAL block size: %u\n"),
311 printf(
_(
"Bytes per WAL segment: %u\n"),
313 printf(
_(
"Maximum length of identifiers: %u\n"),
315 printf(
_(
"Maximum columns in an index: %u\n"),
317 printf(
_(
"Maximum size of a TOAST chunk: %u\n"),
319 printf(
_(
"Size of a large-object chunk: %u\n"),
322 printf(
_(
"Date/time type storage: %s\n"),
323 _(
"64-bit integers"));
324 printf(
_(
"Float8 argument passing: %s\n"),
326 printf(
_(
"Data page checksum version: %u\n"),
328 printf(
_(
"Mock authentication nonce: %s\n"),
329 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 pg_log_warning_detail(...)
#define MOCK_AUTH_NONCE_LEN
@ DB_SHUTDOWNED_IN_RECOVERY
PGDLLIMPORT char * optarg
#define pg_log_warning(...)
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)