|
|
|
/*
|
|
|
|
* pg_controldata
|
|
|
|
*
|
|
|
|
* reads the data from $PGDATA/global/pg_control
|
|
|
|
*
|
|
|
|
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
|
|
|
|
* licence: BSD
|
|
|
|
*
|
|
|
|
* src/bin/pg_controldata/pg_controldata.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We have to use postgres.h not postgres_fe.h here, because there's so much
|
|
|
|
* backend-only stuff in the XLOG include files we need. But we need a
|
|
|
|
* frontend-ish environment otherwise. Hence this ugly hack.
|
|
|
|
*/
|
|
|
|
#define FRONTEND 1
|
|
|
|
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
#include "postgres.h"
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
#include "access/xlog.h"
|
|
|
|
#include "access/xlog_internal.h"
|
|
|
|
#include "catalog/pg_control.h"
|
|
|
|
#include "pg_getopt.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
usage(const char *progname)
|
|
|
|
{
|
|
|
|
printf(_("%s displays control information of a PostgreSQL database cluster.\n\n"), progname);
|
|
|
|
printf(_("Usage:\n"));
|
|
|
|
printf(_(" %s [OPTION] [[-D] DATADIR]\n"), progname);
|
|
|
|
printf(_("\nOptions:\n"));
|
|
|
|
printf(_(" -V, --version output version information, then exit\n"));
|
|
|
|
printf(_(" -?, --help show this help, then exit\n"));
|
|
|
|
printf(_("\nIf no data directory (DATADIR) is specified, "
|
|
|
|
"the environment variable PGDATA\nis used.\n\n"));
|
|
|
|
printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
dbState(DBState state)
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case DB_STARTUP:
|
|
|
|
return _("starting up");
|
|
|
|
case DB_SHUTDOWNED:
|
|
|
|
return _("shut down");
|
|
|
|
case DB_SHUTDOWNED_IN_RECOVERY:
|
|
|
|
return _("shut down in recovery");
|
|
|
|
case DB_SHUTDOWNING:
|
|
|
|
return _("shutting down");
|
|
|
|
case DB_IN_CRASH_RECOVERY:
|
|
|
|
return _("in crash recovery");
|
|
|
|
case DB_IN_ARCHIVE_RECOVERY:
|
|
|
|
return _("in archive recovery");
|
|
|
|
case DB_IN_PRODUCTION:
|
|
|
|
return _("in production");
|
|
|
|
}
|
|
|
|
return _("unrecognized status code");
|
|
|
|
}
|
|
|
|
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
static const char *
|
|
|
|
wal_level_str(WalLevel wal_level)
|
|
|
|
{
|
|
|
|
switch (wal_level)
|
|
|
|
{
|
|
|
|
case WAL_LEVEL_MINIMAL:
|
|
|
|
return "minimal";
|
|
|
|
case WAL_LEVEL_ARCHIVE:
|
|
|
|
return "archive";
|
|
|
|
case WAL_LEVEL_HOT_STANDBY:
|
|
|
|
return "hot_standby";
|
Add new wal_level, logical, sufficient for logical decoding.
When wal_level=logical, we'll log columns from the old tuple as
configured by the REPLICA IDENTITY facility added in commit
07cacba983ef79be4a84fcd0e0ca3b5fcb85dd65. This makes it possible
a properly-configured logical replication solution to correctly
follow table updates even if they change the chosen key columns,
or, with REPLICA IDENTITY FULL, even if the table has no key at
all. Note that updates which do not modify the replica identity
column won't log anything extra, making the choice of a good key
(i.e. one that will rarely be changed) important to performance
when wal_level=logical is configured.
Each insert, update, or delete to a catalog table will also log
the CMIN and/or CMAX values of stamped by the current transaction.
This is necessary because logical decoding will require access to
historical snapshots of the catalog in order to decode some data
types, and the CMIN/CMAX values that we may need in order to judge
row visibility may have been overwritten by the time we need them.
Andres Freund, reviewed in various versions by myself, Heikki
Linnakangas, KONDO Mitsumasa, and many others.
12 years ago
|
|
|
case WAL_LEVEL_LOGICAL:
|
|
|
|
return "logical";
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
}
|
|
|
|
return _("unrecognized wal_level");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
ControlFileData ControlFile;
|
|
|
|
int fd;
|
|
|
|
char ControlFilePath[MAXPGPATH];
|
|
|
|
char *DataDir = NULL;
|
|
|
|
pg_crc32 crc;
|
|
|
|
time_t time_tmp;
|
|
|
|
char pgctime_str[128];
|
|
|
|
char ckpttime_str[128];
|
|
|
|
char sysident_str[32];
|
|
|
|
const char *strftime_fmt = "%c";
|
|
|
|
const char *progname;
|
|
|
|
XLogSegNo segno;
|
|
|
|
char xlogfilename[MAXFNAMELEN];
|
|
|
|
int c;
|
|
|
|
|
|
|
|
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_controldata"));
|
|
|
|
|
|
|
|
progname = get_progname(argv[0]);
|
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
{
|
|
|
|
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
|
|
|
|
{
|
|
|
|
usage(progname);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
|
|
|
|
{
|
|
|
|
puts("pg_controldata (PostgreSQL) " PG_VERSION);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((c = getopt(argc, argv, "D:")) != -1)
|
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case 'D':
|
|
|
|
DataDir = optarg;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DataDir == NULL)
|
|
|
|
{
|
|
|
|
if (optind < argc)
|
|
|
|
DataDir = argv[optind++];
|
|
|
|
else
|
|
|
|
DataDir = getenv("PGDATA");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Complain if any arguments remain */
|
|
|
|
if (optind < argc)
|
|
|
|
{
|
|
|
|
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
|
|
|
|
progname, argv[optind]);
|
|
|
|
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
|
|
|
|
progname);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DataDir == NULL)
|
|
|
|
{
|
|
|
|
fprintf(stderr, _("%s: no data directory specified\n"), progname);
|
|
|
|
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
|
|
|
|
|
|
|
|
if ((fd = open(ControlFilePath, O_RDONLY | PG_BINARY, 0)) == -1)
|
|
|
|
{
|
|
|
|
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
|
|
|
|
progname, ControlFilePath, strerror(errno));
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read(fd, &ControlFile, sizeof(ControlFileData)) != sizeof(ControlFileData))
|
|
|
|
{
|
|
|
|
fprintf(stderr, _("%s: could not read file \"%s\": %s\n"),
|
|
|
|
progname, ControlFilePath, strerror(errno));
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
/* Check the CRC. */
|
|
|
|
INIT_CRC32(crc);
|
|
|
|
COMP_CRC32(crc,
|
|
|
|
(char *) &ControlFile,
|
|
|
|
offsetof(ControlFileData, crc));
|
|
|
|
FIN_CRC32(crc);
|
|
|
|
|
|
|
|
if (!EQ_CRC32(crc, ControlFile.crc))
|
|
|
|
printf(_("WARNING: Calculated CRC checksum does not match value stored in file.\n"
|
|
|
|
"Either the file is corrupt, or it has a different layout than this program\n"
|
|
|
|
"is expecting. The results below are untrustworthy.\n\n"));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This slightly-chintzy coding will work as long as the control file
|
|
|
|
* timestamps are within the range of time_t; that should be the case in
|
|
|
|
* all foreseeable circumstances, so we don't bother importing the
|
|
|
|
* backend's timezone library into pg_controldata.
|
|
|
|
*
|
|
|
|
* Use variable for format to suppress overly-anal-retentive gcc warning
|
|
|
|
* about %c
|
|
|
|
*/
|
|
|
|
time_tmp = (time_t) ControlFile.time;
|
|
|
|
strftime(pgctime_str, sizeof(pgctime_str), strftime_fmt,
|
|
|
|
localtime(&time_tmp));
|
|
|
|
time_tmp = (time_t) ControlFile.checkPointCopy.time;
|
|
|
|
strftime(ckpttime_str, sizeof(ckpttime_str), strftime_fmt,
|
|
|
|
localtime(&time_tmp));
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate name of the WAL file containing the latest checkpoint's REDO
|
|
|
|
* start point.
|
|
|
|
*/
|
|
|
|
XLByteToSeg(ControlFile.checkPointCopy.redo, segno);
|
|
|
|
XLogFileName(xlogfilename, ControlFile.checkPointCopy.ThisTimeLineID, segno);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Format system_identifier separately to keep platform-dependent format
|
|
|
|
* code out of the translatable message string.
|
|
|
|
*/
|
|
|
|
snprintf(sysident_str, sizeof(sysident_str), UINT64_FORMAT,
|
|
|
|
ControlFile.system_identifier);
|
|
|
|
|
|
|
|
printf(_("pg_control version number: %u\n"),
|
|
|
|
ControlFile.pg_control_version);
|
|
|
|
if (ControlFile.pg_control_version % 65536 == 0 && ControlFile.pg_control_version / 65536 != 0)
|
|
|
|
printf(_("WARNING: possible byte ordering mismatch\n"
|
|
|
|
"The byte ordering used to store the pg_control file might not match the one\n"
|
|
|
|
"used by this program. In that case the results below would be incorrect, and\n"
|
|
|
|
"the PostgreSQL installation would be incompatible with this data directory.\n"));
|
|
|
|
printf(_("Catalog version number: %u\n"),
|
|
|
|
ControlFile.catalog_version_no);
|
|
|
|
printf(_("Database system identifier: %s\n"),
|
|
|
|
sysident_str);
|
|
|
|
printf(_("Database cluster state: %s\n"),
|
|
|
|
dbState(ControlFile.state));
|
|
|
|
printf(_("pg_control last modified: %s\n"),
|
|
|
|
pgctime_str);
|
|
|
|
printf(_("Latest checkpoint location: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.checkPoint >> 32),
|
|
|
|
(uint32) ControlFile.checkPoint);
|
|
|
|
printf(_("Prior checkpoint location: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.prevCheckPoint >> 32),
|
|
|
|
(uint32) ControlFile.prevCheckPoint);
|
|
|
|
printf(_("Latest checkpoint's REDO location: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.checkPointCopy.redo >> 32),
|
|
|
|
(uint32) ControlFile.checkPointCopy.redo);
|
|
|
|
printf(_("Latest checkpoint's REDO WAL file: %s\n"),
|
|
|
|
xlogfilename);
|
|
|
|
printf(_("Latest checkpoint's TimeLineID: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.ThisTimeLineID);
|
|
|
|
printf(_("Latest checkpoint's PrevTimeLineID: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.PrevTimeLineID);
|
|
|
|
printf(_("Latest checkpoint's full_page_writes: %s\n"),
|
|
|
|
ControlFile.checkPointCopy.fullPageWrites ? _("on") : _("off"));
|
|
|
|
printf(_("Latest checkpoint's NextXID: %u/%u\n"),
|
|
|
|
ControlFile.checkPointCopy.nextXidEpoch,
|
|
|
|
ControlFile.checkPointCopy.nextXid);
|
|
|
|
printf(_("Latest checkpoint's NextOID: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.nextOid);
|
|
|
|
printf(_("Latest checkpoint's NextMultiXactId: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.nextMulti);
|
|
|
|
printf(_("Latest checkpoint's NextMultiOffset: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.nextMultiOffset);
|
|
|
|
printf(_("Latest checkpoint's oldestXID: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.oldestXid);
|
|
|
|
printf(_("Latest checkpoint's oldestXID's DB: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.oldestXidDB);
|
|
|
|
printf(_("Latest checkpoint's oldestActiveXID: %u\n"),
|
Allow read only connections during recovery, known as Hot Standby.
Enabled by recovery_connections = on (default) and forcing archive recovery using a recovery.conf. Recovery processing now emulates the original transactions as they are replayed, providing full locking and MVCC behaviour for read only queries. Recovery must enter consistent state before connections are allowed, so there is a delay, typically short, before connections succeed. Replay of recovering transactions can conflict and in some cases deadlock with queries during recovery; these result in query cancellation after max_standby_delay seconds have expired. Infrastructure changes have minor effects on normal running, though introduce four new types of WAL record.
New test mode "make standbycheck" allows regression tests of static command behaviour on a standby server while in recovery. Typical and extreme dynamic behaviours have been checked via code inspection and manual testing. Few port specific behaviours have been utilised, though primary testing has been on Linux only so far.
This commit is the basic patch. Additional changes will follow in this release to enhance some aspects of behaviour, notably improved handling of conflicts, deadlock detection and query cancellation. Changes to VACUUM FULL are also required.
Simon Riggs, with significant and lengthy review by Heikki Linnakangas, including streamlined redesign of snapshot creation and two-phase commit.
Important contributions from Florian Pflug, Mark Kirkwood, Merlin Moncure, Greg Stark, Gianni Ciolli, Gabriele Bartolini, Hannu Krosing, Robert Haas, Tatsuo Ishii, Hiroyuki Yamada plus support and feedback from many other community members.
16 years ago
|
|
|
ControlFile.checkPointCopy.oldestActiveXid);
|
|
|
|
printf(_("Latest checkpoint's oldestMultiXid: %u\n"),
|
Improve concurrency of foreign key locking
This patch introduces two additional lock modes for tuples: "SELECT FOR
KEY SHARE" and "SELECT FOR NO KEY UPDATE". These don't block each
other, in contrast with already existing "SELECT FOR SHARE" and "SELECT
FOR UPDATE". UPDATE commands that do not modify the values stored in
the columns that are part of the key of the tuple now grab a SELECT FOR
NO KEY UPDATE lock on the tuple, allowing them to proceed concurrently
with tuple locks of the FOR KEY SHARE variety.
Foreign key triggers now use FOR KEY SHARE instead of FOR SHARE; this
means the concurrency improvement applies to them, which is the whole
point of this patch.
The added tuple lock semantics require some rejiggering of the multixact
module, so that the locking level that each transaction is holding can
be stored alongside its Xid. Also, multixacts now need to persist
across server restarts and crashes, because they can now represent not
only tuple locks, but also tuple updates. This means we need more
careful tracking of lifetime of pg_multixact SLRU files; since they now
persist longer, we require more infrastructure to figure out when they
can be removed. pg_upgrade also needs to be careful to copy
pg_multixact files over from the old server to the new, or at least part
of multixact.c state, depending on the versions of the old and new
servers.
Tuple time qualification rules (HeapTupleSatisfies routines) need to be
careful not to consider tuples with the "is multi" infomask bit set as
being only locked; they might need to look up MultiXact values (i.e.
possibly do pg_multixact I/O) to find out the Xid that updated a tuple,
whereas they previously were assured to only use information readily
available from the tuple header. This is considered acceptable, because
the extra I/O would involve cases that would previously cause some
commands to block waiting for concurrent transactions to finish.
Another important change is the fact that locking tuples that have
previously been updated causes the future versions to be marked as
locked, too; this is essential for correctness of foreign key checks.
This causes additional WAL-logging, also (there was previously a single
WAL record for a locked tuple; now there are as many as updated copies
of the tuple there exist.)
With all this in place, contention related to tuples being checked by
foreign key rules should be much reduced.
As a bonus, the old behavior that a subtransaction grabbing a stronger
tuple lock than the parent (sub)transaction held on a given tuple and
later aborting caused the weaker lock to be lost, has been fixed.
Many new spec files were added for isolation tester framework, to ensure
overall behavior is sane. There's probably room for several more tests.
There were several reviewers of this patch; in particular, Noah Misch
and Andres Freund spent considerable time in it. Original idea for the
patch came from Simon Riggs, after a problem report by Joel Jacobson.
Most code is from me, with contributions from Marti Raudsepp, Alexander
Shulgin, Noah Misch and Andres Freund.
This patch was discussed in several pgsql-hackers threads; the most
important start at the following message-ids:
AANLkTimo9XVcEzfiBR-ut3KVNDkjm2Vxh+t8kAmWjPuv@mail.gmail.com
1290721684-sup-3951@alvh.no-ip.org
1294953201-sup-2099@alvh.no-ip.org
1320343602-sup-2290@alvh.no-ip.org
1339690386-sup-8927@alvh.no-ip.org
4FE5FF020200002500048A3D@gw.wicourts.gov
4FEAB90A0200002500048B7D@gw.wicourts.gov
13 years ago
|
|
|
ControlFile.checkPointCopy.oldestMulti);
|
|
|
|
printf(_("Latest checkpoint's oldestMulti's DB: %u\n"),
|
|
|
|
ControlFile.checkPointCopy.oldestMultiDB);
|
|
|
|
printf(_("Time of latest checkpoint: %s\n"),
|
|
|
|
ckpttime_str);
|
|
|
|
printf(_("Fake LSN counter for unlogged rels: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.unloggedLSN >> 32),
|
|
|
|
(uint32) ControlFile.unloggedLSN);
|
|
|
|
printf(_("Minimum recovery ending location: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.minRecoveryPoint >> 32),
|
|
|
|
(uint32) ControlFile.minRecoveryPoint);
|
|
|
|
printf(_("Min recovery ending loc's timeline: %u\n"),
|
|
|
|
ControlFile.minRecoveryPointTLI);
|
|
|
|
printf(_("Backup start location: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.backupStartPoint >> 32),
|
|
|
|
(uint32) ControlFile.backupStartPoint);
|
|
|
|
printf(_("Backup end location: %X/%X\n"),
|
|
|
|
(uint32) (ControlFile.backupEndPoint >> 32),
|
|
|
|
(uint32) ControlFile.backupEndPoint);
|
|
|
|
printf(_("End-of-backup record required: %s\n"),
|
|
|
|
ControlFile.backupEndRequired ? _("yes") : _("no"));
|
|
|
|
printf(_("Current wal_level setting: %s\n"),
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
wal_level_str(ControlFile.wal_level));
|
|
|
|
printf(_("Current wal_log_hints setting: %s\n"),
|
|
|
|
ControlFile.wal_log_hints ? _("on") : _("off"));
|
|
|
|
printf(_("Current max_connections setting: %d\n"),
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
ControlFile.MaxConnections);
|
Add new GUC, max_worker_processes, limiting number of bgworkers.
In 9.3, there's no particular limit on the number of bgworkers;
instead, we just count up the number that are actually registered,
and use that to set MaxBackends. However, that approach causes
problems for Hot Standby, which needs both MaxBackends and the
size of the lock table to be the same on the standby as on the
master, yet it may not be desirable to run the same bgworkers in
both places. 9.3 handles that by failing to notice the problem,
which will probably work fine in nearly all cases anyway, but is
not theoretically sound.
A further problem with simply counting the number of registered
workers is that new workers can't be registered without a
postmaster restart. This is inconvenient for administrators,
since bouncing the postmaster causes an interruption of service.
Moreover, there are a number of applications for background
processes where, by necessity, the background process must be
started on the fly (e.g. parallel query). While this patch
doesn't actually make it possible to register new background
workers after startup time, it's a necessary prerequisite.
Patch by me. Review by Michael Paquier.
12 years ago
|
|
|
printf(_("Current max_worker_processes setting: %d\n"),
|
|
|
|
ControlFile.max_worker_processes);
|
|
|
|
printf(_("Current max_prepared_xacts setting: %d\n"),
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
ControlFile.max_prepared_xacts);
|
|
|
|
printf(_("Current max_locks_per_xact setting: %d\n"),
|
Introduce wal_level GUC to explicitly control if information needed for
archival or hot standby should be WAL-logged, instead of deducing that from
other options like archive_mode. This replaces recovery_connections GUC in
the primary, where it now has no effect, but it's still used in the standby
to enable/disable hot standby.
Remove the WAL-logging of "unlogged operations", like creating an index
without WAL-logging and fsyncing it at the end. Instead, we keep a copy of
the wal_mode setting and the settings that affect how much shared memory a
hot standby server needs to track master transactions (max_connections,
max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings
change, at server restart, write a WAL record noting the new settings and
update pg_control. This allows us to notice the change in those settings in
the standby at the right moment, they used to be included in checkpoint
records, but that meant that a changed value was not reflected in the
standby until the first checkpoint after the change.
Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to
the sequence it used to follow, before hot standby and subsequent patches
changed it to 0x9003.
16 years ago
|
|
|
ControlFile.max_locks_per_xact);
|
|
|
|
printf(_("Maximum data alignment: %u\n"),
|
|
|
|
ControlFile.maxAlign);
|
|
|
|
/* we don't print floatFormat since can't say much useful about it */
|
|
|
|
printf(_("Database block size: %u\n"),
|
|
|
|
ControlFile.blcksz);
|
|
|
|
printf(_("Blocks per segment of large relation: %u\n"),
|
|
|
|
ControlFile.relseg_size);
|
|
|
|
printf(_("WAL block size: %u\n"),
|
|
|
|
ControlFile.xlog_blcksz);
|
|
|
|
printf(_("Bytes per WAL segment: %u\n"),
|
|
|
|
ControlFile.xlog_seg_size);
|
|
|
|
printf(_("Maximum length of identifiers: %u\n"),
|
|
|
|
ControlFile.nameDataLen);
|
|
|
|
printf(_("Maximum columns in an index: %u\n"),
|
|
|
|
ControlFile.indexMaxKeys);
|
|
|
|
printf(_("Maximum size of a TOAST chunk: %u\n"),
|
|
|
|
ControlFile.toast_max_chunk_size);
|
|
|
|
printf(_("Size of a large-object chunk: %u\n"),
|
|
|
|
ControlFile.loblksize);
|
|
|
|
printf(_("Date/time type storage: %s\n"),
|
|
|
|
(ControlFile.enableIntTimes ? _("64-bit integers") : _("floating-point numbers")));
|
|
|
|
printf(_("Float4 argument passing: %s\n"),
|
|
|
|
(ControlFile.float4ByVal ? _("by value") : _("by reference")));
|
|
|
|
printf(_("Float8 argument passing: %s\n"),
|
|
|
|
(ControlFile.float8ByVal ? _("by value") : _("by reference")));
|
|
|
|
printf(_("Data page checksum version: %u\n"),
|
|
|
|
ControlFile.data_checksum_version);
|
|
|
|
return 0;
|
|
|
|
}
|