aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2010-04-23 19:57:19 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2010-04-23 19:57:19 +0000
commit6ca23b1a29497d496266e2ad47954d4fbc98065d (patch)
treeba7f3ad4482db51a06709ee75e2eb18f0179e3ae /src
parent89a9db2940f0cc7393f770bc25a36bca54399de8 (diff)
downloadpostgresql-6ca23b1a29497d496266e2ad47954d4fbc98065d.tar.gz
postgresql-6ca23b1a29497d496266e2ad47954d4fbc98065d.zip
Make CheckRequiredParameterValues() depend upon correct combination
of parameters. Fix bug report by Robert Haas that error message and hint was incorrect if wrong mode parameters specified on master. Internal changes only. Proposals for parameter simplification on master/primary still under way.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c17
-rw-r--r--src/include/catalog/pg_control.h8
2 files changed, 20 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index f887dc28788..ba839f941fc 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.401 2010/04/20 11:15:06 rhaas Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.402 2010/04/23 19:57:18 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@@ -5568,7 +5568,12 @@ CheckRequiredParameterValues(CheckPoint checkPoint)
RecoveryRequiresIntParameter("max_locks_per_xact",
max_locks_per_xact, checkPoint.max_locks_per_xact);
- if (!checkPoint.XLogStandbyInfoMode)
+ /*
+ * Hot Standby currently only depends upon the presence of WAL
+ * records as indicated by XLOG_MODE_HOT_STANDBY. There is no current
+ * dependency on whether archiving or streaming are enabled, if either.
+ */
+ if (!(checkPoint.XLogModeFlags & XLOG_MODE_HOT_STANDBY))
ereport(ERROR,
(errmsg("recovery connections cannot start because the recovery_connections "
"parameter is disabled on the WAL source server")));
@@ -7002,7 +7007,13 @@ CreateCheckPoint(int flags)
checkPoint.MaxConnections = MaxConnections;
checkPoint.max_prepared_xacts = max_prepared_xacts;
checkPoint.max_locks_per_xact = max_locks_per_xact;
- checkPoint.XLogStandbyInfoMode = XLogStandbyInfoActive();
+
+ if (XLogArchivingActive())
+ checkPoint.XLogModeFlags |= XLOG_MODE_ARCHIVING;
+ if (max_wal_senders > 0)
+ checkPoint.XLogModeFlags |= XLOG_MODE_STREAMING;
+ if (XLogRequestRecoveryConnections)
+ checkPoint.XLogModeFlags |= XLOG_MODE_HOT_STANDBY;
/*
* We must hold WALInsertLock while examining insert state to determine
diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h
index b2f4a5c5a46..4637610af79 100644
--- a/src/include/catalog/pg_control.h
+++ b/src/include/catalog/pg_control.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.51 2010/02/26 02:01:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.52 2010/04/23 19:57:19 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ typedef struct CheckPoint
int MaxConnections;
int max_prepared_xacts;
int max_locks_per_xact;
- bool XLogStandbyInfoMode;
+ int XLogModeFlags;
/*
* Oldest XID still running. This is only needed to initialize hot standby
@@ -65,6 +65,10 @@ typedef struct CheckPoint
#define XLOG_BACKUP_END 0x50
#define XLOG_UNLOGGED 0x60
+/* XLogModeFlags */
+#define XLOG_MODE_ARCHIVING (1 << 0)
+#define XLOG_MODE_STREAMING (1 << 1)
+#define XLOG_MODE_HOT_STANDBY (1 << 2)
/* System status indicator */
typedef enum DBState