Skip to content

Commit c80a85e

Browse files
committed
Minor editorializing on pg_controldata and pg_resetxlog: adjust some message
wording, deal explicitly with some fields that were being silently left zero.
1 parent 82e38ab commit c80a85e

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/bin/pg_controldata/pg_controldata.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
77
* licence: BSD
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.48 2010/04/28 17:35:35 tgl Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.49 2010/04/28 19:38:49 tgl Exp $
1010
*/
1111

1212
/*
@@ -230,13 +230,13 @@ main(int argc, char *argv[])
230230
printf(_("Backup start location: %X/%X\n"),
231231
ControlFile.backupStartPoint.xlogid,
232232
ControlFile.backupStartPoint.xrecoff);
233-
printf(_("Last wal_level setting: %s\n"),
233+
printf(_("Current wal_level setting: %s\n"),
234234
wal_level_str(ControlFile.wal_level));
235-
printf(_("Last max_connections setting: %d\n"),
235+
printf(_("Current max_connections setting: %d\n"),
236236
ControlFile.MaxConnections);
237-
printf(_("Last max_prepared_xacts setting: %d\n"),
237+
printf(_("Current max_prepared_xacts setting: %d\n"),
238238
ControlFile.max_prepared_xacts);
239-
printf(_("Last max_locks_per_xact setting: %d\n"),
239+
printf(_("Current max_locks_per_xact setting: %d\n"),
240240
ControlFile.max_locks_per_xact);
241241
printf(_("Maximum data alignment: %u\n"),
242242
ControlFile.maxAlign);

src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.79 2010/04/28 16:10:43 heikki Exp $
26+
* $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.80 2010/04/28 19:38:49 tgl Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -497,11 +497,19 @@ GuessControlValues(void)
497497
ControlFile.checkPointCopy.oldestXid = FirstNormalTransactionId;
498498
ControlFile.checkPointCopy.oldestXidDB = InvalidOid;
499499
ControlFile.checkPointCopy.time = (pg_time_t) time(NULL);
500+
ControlFile.checkPointCopy.oldestActiveXid = InvalidTransactionId;
500501

501502
ControlFile.state = DB_SHUTDOWNED;
502503
ControlFile.time = (pg_time_t) time(NULL);
503504
ControlFile.checkPoint = ControlFile.checkPointCopy.redo;
504505

506+
/* minRecoveryPoint and backupStartPoint can be left zero */
507+
508+
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
509+
ControlFile.MaxConnections = 100;
510+
ControlFile.max_prepared_xacts = 0;
511+
ControlFile.max_locks_per_xact = 64;
512+
505513
ControlFile.maxAlign = MAXIMUM_ALIGNOF;
506514
ControlFile.floatFormat = FLOATFORMAT_VALUE;
507515
ControlFile.blcksz = BLCKSZ;
@@ -574,6 +582,8 @@ PrintControlValues(bool guessed)
574582
ControlFile.checkPointCopy.oldestXid);
575583
printf(_("Latest checkpoint's oldestXID's DB: %u\n"),
576584
ControlFile.checkPointCopy.oldestXidDB);
585+
printf(_("Latest checkpoint's oldestActiveXID: %u\n"),
586+
ControlFile.checkPointCopy.oldestActiveXid);
577587
printf(_("Maximum data alignment: %u\n"),
578588
ControlFile.maxAlign);
579589
/* we don't print floatFormat since can't say much useful about it */
@@ -629,13 +639,14 @@ RewriteControlFile(void)
629639
ControlFile.backupStartPoint.xrecoff = 0;
630640

631641
/*
632-
* Use the defaults for max_* settings. The values don't matter
633-
* as long as wal_level='minimal'.
642+
* Force the defaults for max_* settings. The values don't really matter
643+
* as long as wal_level='minimal'; the postmaster will reset these fields
644+
* anyway at startup.
634645
*/
646+
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
635647
ControlFile.MaxConnections = 100;
636648
ControlFile.max_prepared_xacts = 0;
637649
ControlFile.max_locks_per_xact = 64;
638-
ControlFile.wal_level = WAL_LEVEL_MINIMAL;
639650

640651
/* Now we can force the recorded xlog seg size to the right thing. */
641652
ControlFile.xlog_seg_size = XLogSegSize;

0 commit comments

Comments
 (0)