From 54943734f8fca3a9092564f31a7c9c6b8a58c7bc Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 1 Apr 2010 00:43:29 +0000 Subject: [PATCH] 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. --- src/backend/access/transam/xlog.c | 4 ++-- src/backend/replication/walsender.c | 16 +++++++++------- src/backend/utils/misc/guc.c | 4 ++-- src/include/access/xlog.h | 6 +++--- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 94003c0ce2..dfe2593c99 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.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 * an open replication connection from failing because of that. */ - if ((_logId || _logSeg) && MaxWalSenders > 0) + if ((_logId || _logSeg) && max_wal_senders > 0) { XLogRecPtr oldest; uint32 log; diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 21058d10ba..e04e5ba65c 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -30,7 +30,7 @@ * * * 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 ? */ /* 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 */ #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 * out of WalSnd structures. */ - for (i = 0; i < MaxWalSenders; i++) + for (i = 0; i < max_wal_senders; i++) { volatile WalSnd *walsnd = &WalSndCtl->walsnds[i]; @@ -476,7 +476,9 @@ InitWalSnd(void) if (MyWalSnd == NULL) ereport(FATAL, (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 */ on_shmem_exit(WalSndKill, 0); @@ -766,7 +768,7 @@ WalSndShmemSize(void) Size size = 0; 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; } @@ -791,7 +793,7 @@ WalSndShmemInit(void) /* Initialize the data structures */ MemSet(WalSndCtl, 0, WalSndShmemSize()); - for (i = 0; i < MaxWalSenders; i++) + for (i = 0; i < max_wal_senders; i++) { WalSnd *walsnd = &WalSndCtl->walsnds[i]; @@ -810,7 +812,7 @@ GetOldestWALSendPointer(void) int i; bool found = false; - for (i = 0; i < MaxWalSenders; i++) + for (i = 0; i < max_wal_senders; i++) { /* use volatile pointer to prevent code rearrangement */ volatile WalSnd *walsnd = &WalSndCtl->walsnds[i]; diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index ea43b4171b..5f8cc49489 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * 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."), NULL }, - &MaxWalSenders, + &max_wal_senders, 0, 0, INT_MAX / 4, NULL, NULL }, diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 9a6cd10761..9a66e9134d 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * 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 #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 * 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 * 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? */ #define XLogStandbyInfoActive() (XLogRequestRecoveryConnections && XLogIsNeeded()) -- GitLab