Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6ca23b1

Browse files
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.
1 parent 89a9db2 commit 6ca23b1

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/backend/access/transam/xlog.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.401 2010/04/20 11:15:06 rhaas Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.402 2010/04/23 19:57:18 sriggs Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -5568,7 +5568,12 @@ CheckRequiredParameterValues(CheckPoint checkPoint)
55685568
RecoveryRequiresIntParameter("max_locks_per_xact",
55695569
max_locks_per_xact, checkPoint.max_locks_per_xact);
55705570

5571-
if (!checkPoint.XLogStandbyInfoMode)
5571+
/*
5572+
* Hot Standby currently only depends upon the presence of WAL
5573+
* records as indicated by XLOG_MODE_HOT_STANDBY. There is no current
5574+
* dependency on whether archiving or streaming are enabled, if either.
5575+
*/
5576+
if (!(checkPoint.XLogModeFlags & XLOG_MODE_HOT_STANDBY))
55725577
ereport(ERROR,
55735578
(errmsg("recovery connections cannot start because the recovery_connections "
55745579
"parameter is disabled on the WAL source server")));
@@ -7002,7 +7007,13 @@ CreateCheckPoint(int flags)
70027007
checkPoint.MaxConnections = MaxConnections;
70037008
checkPoint.max_prepared_xacts = max_prepared_xacts;
70047009
checkPoint.max_locks_per_xact = max_locks_per_xact;
7005-
checkPoint.XLogStandbyInfoMode = XLogStandbyInfoActive();
7010+
7011+
if (XLogArchivingActive())
7012+
checkPoint.XLogModeFlags |= XLOG_MODE_ARCHIVING;
7013+
if (max_wal_senders > 0)
7014+
checkPoint.XLogModeFlags |= XLOG_MODE_STREAMING;
7015+
if (XLogRequestRecoveryConnections)
7016+
checkPoint.XLogModeFlags |= XLOG_MODE_HOT_STANDBY;
70067017

70077018
/*
70087019
* We must hold WALInsertLock while examining insert state to determine

src/include/catalog/pg_control.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.51 2010/02/26 02:01:21 momjian Exp $
11+
* $PostgreSQL: pgsql/src/include/catalog/pg_control.h,v 1.52 2010/04/23 19:57:19 sriggs Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -45,7 +45,7 @@ typedef struct CheckPoint
4545
int MaxConnections;
4646
int max_prepared_xacts;
4747
int max_locks_per_xact;
48-
bool XLogStandbyInfoMode;
48+
int XLogModeFlags;
4949

5050
/*
5151
* Oldest XID still running. This is only needed to initialize hot standby
@@ -65,6 +65,10 @@ typedef struct CheckPoint
6565
#define XLOG_BACKUP_END 0x50
6666
#define XLOG_UNLOGGED 0x60
6767

68+
/* XLogModeFlags */
69+
#define XLOG_MODE_ARCHIVING (1 << 0)
70+
#define XLOG_MODE_STREAMING (1 << 1)
71+
#define XLOG_MODE_HOT_STANDBY (1 << 2)
6872

6973
/* System status indicator */
7074
typedef enum DBState

0 commit comments

Comments
 (0)