Refer to max_wal_senders in a more consistent fashion.

The error message now makes explicit reference to the GUC that must be changed
to fix the problem, using wording suggested by Tom Lane.  Along the way,
rename the GUC from MaxWalSenders to max_wal_senders for consistency and
grep-ability.
This commit is contained in:
Robert Haas 2010-04-01 00:43:29 +00:00
parent 38672aaaa1
commit 54943734f8
4 changed files with 16 additions and 14 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.385 2010/03/30 16:23:57 heikki Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.386 2010/04/01 00:43:29 rhaas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -7092,7 +7092,7 @@ CreateCheckPoint(int flags)
* disconnected (e.g because of network problems), but at least it avoids * disconnected (e.g because of network problems), but at least it avoids
* an open replication connection from failing because of that. * an open replication connection from failing because of that.
*/ */
if ((_logId || _logSeg) && MaxWalSenders > 0) if ((_logId || _logSeg) && max_wal_senders > 0)
{ {
XLogRecPtr oldest; XLogRecPtr oldest;
uint32 log; uint32 log;

View File

@ -30,7 +30,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.13 2010/03/26 12:23:34 heikki Exp $ * $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.14 2010/04/01 00:43:29 rhaas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -64,7 +64,7 @@ static WalSnd *MyWalSnd = NULL;
bool am_walsender = false; /* Am I a walsender process ? */ bool am_walsender = false; /* Am I a walsender process ? */
/* User-settable parameters for walsender */ /* User-settable parameters for walsender */
int MaxWalSenders = 0; /* the maximum number of concurrent walsenders */ int max_wal_senders = 0; /* the maximum number of concurrent walsenders */
int WalSndDelay = 200; /* max sleep time between some actions */ int WalSndDelay = 200; /* max sleep time between some actions */
#define NAPTIME_PER_CYCLE 100000L /* max sleep time between cycles (100ms) */ #define NAPTIME_PER_CYCLE 100000L /* max sleep time between cycles (100ms) */
@ -452,7 +452,7 @@ InitWalSnd(void)
* Find a free walsender slot and reserve it. If this fails, we must be * Find a free walsender slot and reserve it. If this fails, we must be
* out of WalSnd structures. * out of WalSnd structures.
*/ */
for (i = 0; i < MaxWalSenders; i++) for (i = 0; i < max_wal_senders; i++)
{ {
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i]; volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
@ -476,7 +476,9 @@ InitWalSnd(void)
if (MyWalSnd == NULL) if (MyWalSnd == NULL)
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_TOO_MANY_CONNECTIONS), (errcode(ERRCODE_TOO_MANY_CONNECTIONS),
errmsg("sorry, too many standbys already"))); errmsg("number of requested standby connections "
"exceeds max_wal_senders (currently %d)",
max_wal_senders)));
/* Arrange to clean up at walsender exit */ /* Arrange to clean up at walsender exit */
on_shmem_exit(WalSndKill, 0); on_shmem_exit(WalSndKill, 0);
@ -766,7 +768,7 @@ WalSndShmemSize(void)
Size size = 0; Size size = 0;
size = offsetof(WalSndCtlData, walsnds); size = offsetof(WalSndCtlData, walsnds);
size = add_size(size, mul_size(MaxWalSenders, sizeof(WalSnd))); size = add_size(size, mul_size(max_wal_senders, sizeof(WalSnd)));
return size; return size;
} }
@ -791,7 +793,7 @@ WalSndShmemInit(void)
/* Initialize the data structures */ /* Initialize the data structures */
MemSet(WalSndCtl, 0, WalSndShmemSize()); MemSet(WalSndCtl, 0, WalSndShmemSize());
for (i = 0; i < MaxWalSenders; i++) for (i = 0; i < max_wal_senders; i++)
{ {
WalSnd *walsnd = &WalSndCtl->walsnds[i]; WalSnd *walsnd = &WalSndCtl->walsnds[i];
@ -810,7 +812,7 @@ GetOldestWALSendPointer(void)
int i; int i;
bool found = false; bool found = false;
for (i = 0; i < MaxWalSenders; i++) for (i = 0; i < max_wal_senders; i++)
{ {
/* use volatile pointer to prevent code rearrangement */ /* use volatile pointer to prevent code rearrangement */
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i]; volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.545 2010/03/25 14:44:33 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.546 2010/04/01 00:43:29 rhaas Exp $
* *
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
@ -1705,7 +1705,7 @@ static struct config_int ConfigureNamesInt[] =
gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."), gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."),
NULL NULL
}, },
&MaxWalSenders, &max_wal_senders,
0, 0, INT_MAX / 4, NULL, NULL 0, 0, INT_MAX / 4, NULL, NULL
}, },

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.104 2010/03/19 11:05:15 sriggs Exp $ * $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.105 2010/04/01 00:43:29 rhaas Exp $
*/ */
#ifndef XLOG_H #ifndef XLOG_H
#define XLOG_H #define XLOG_H
@ -202,13 +202,13 @@ extern int MaxStandbyDelay;
* This is in walsender.c, but declared here so that we don't need to include * This is in walsender.c, but declared here so that we don't need to include
* walsender.h in all files that check XLogIsNeeded() * walsender.h in all files that check XLogIsNeeded()
*/ */
extern int MaxWalSenders; extern int max_wal_senders;
/* /*
* Is WAL-logging necessary? We need to log an XLOG record iff either * Is WAL-logging necessary? We need to log an XLOG record iff either
* WAL archiving is enabled or XLOG streaming is allowed. * WAL archiving is enabled or XLOG streaming is allowed.
*/ */
#define XLogIsNeeded() (XLogArchivingActive() || (MaxWalSenders > 0)) #define XLogIsNeeded() (XLogArchivingActive() || (max_wal_senders > 0))
/* Do we need to WAL-log information required only for Hot Standby? */ /* Do we need to WAL-log information required only for Hot Standby? */
#define XLogStandbyInfoActive() (XLogRequestRecoveryConnections && XLogIsNeeded()) #define XLogStandbyInfoActive() (XLogRequestRecoveryConnections && XLogIsNeeded())