]> granicus.if.org Git - postgresql/commitdiff
Refer to max_wal_senders in a more consistent fashion.
authorRobert Haas <rhaas@postgresql.org>
Thu, 1 Apr 2010 00:43:29 +0000 (00:43 +0000)
committerRobert Haas <rhaas@postgresql.org>
Thu, 1 Apr 2010 00:43:29 +0000 (00:43 +0000)
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
src/backend/replication/walsender.c
src/backend/utils/misc/guc.c
src/include/access/xlog.h

index 94003c0ce29d959f71e95b2c9df30e228a97f72b..dfe2593c9968f34b8af572dca3aa4c14aa1c824b 100644 (file)
@@ -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;
index 21058d10ba799ed5f62b68120b430c502c323618..e04e5ba65caf50019da8442b9c7e7fe89cf1a45b 100644 (file)
@@ -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];
index ea43b4171b04094ad2e48cf1d669ca7203543d58..5f8cc494893fb918ea4e51616f9d14a633183e83 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * 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
        },
 
index 9a6cd107614f7fd6d41ba12c23cb67af51ead11d..9a66e9134d4c04057207ecb43285ca93d9a7f970 100644 (file)
@@ -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())