Rename ReservedBackends variable to SuperuserReservedConnections.
authorRobert Haas <rhaas@postgresql.org>
Fri, 20 Jan 2023 20:32:08 +0000 (15:32 -0500)
committerRobert Haas <rhaas@postgresql.org>
Fri, 20 Jan 2023 20:32:08 +0000 (15:32 -0500)
This is in preparation for adding a new reserved_connections GUC,
but aligning the GUC name with the variable name is also a good
idea on general principle.

Patch by Nathan Bossart. Reviewed by Tushar Ahuja and by me.

Discussion: http://postgr.es/m/20230119194601.GA4105788@nathanxps13

src/backend/postmaster/postmaster.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/guc_tables.c
src/include/postmaster/postmaster.h

index 9cedc1b9f0d50ea414cc8dd24d8de1e619b159ff..3f799c4ac82b4953c80bf0d41f5b146417f401ca 100644 (file)
@@ -204,15 +204,15 @@ char     *Unix_socket_directories;
 char      *ListenAddresses;
 
 /*
- * ReservedBackends is the number of backends reserved for superuser use.
- * This number is taken out of the pool size given by MaxConnections so
- * number of backend slots available to non-superusers is
- * (MaxConnections - ReservedBackends).  Note what this really means is
- * "if there are <= ReservedBackends connections available, only superusers
- * can make new connections" --- pre-existing superuser connections don't
- * count against the limit.
+ * SuperuserReservedConnections is the number of backends reserved for
+ * superuser use.  This number is taken out of the pool size given by
+ * MaxConnections so number of backend slots available to non-superusers is
+ * (MaxConnections - SuperuserReservedConnections).  Note what this really
+ * means is "if there are <= SuperuserReservedConnections connections
+ * available, only superusers can make new connections" --- pre-existing
+ * superuser connections don't count against the limit.
  */
-int            ReservedBackends;
+int            SuperuserReservedConnections;
 
 /* The socket(s) we're listening to. */
 #define MAXLISTEN  64
@@ -908,11 +908,11 @@ PostmasterMain(int argc, char *argv[])
    /*
     * Check for invalid combinations of GUC settings.
     */
-   if (ReservedBackends >= MaxConnections)
+   if (SuperuserReservedConnections >= MaxConnections)
    {
        write_stderr("%s: superuser_reserved_connections (%d) must be less than max_connections (%d)\n",
                     progname,
-                    ReservedBackends, MaxConnections);
+                    SuperuserReservedConnections, MaxConnections);
        ExitPostmaster(1);
    }
    if (XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level == WAL_LEVEL_MINIMAL)
index 9145d96b385c7ec1fa8f1520933e503ee03b614c..40f145e0ab1966f6367a453a98fb386a062e8689 100644 (file)
@@ -927,8 +927,8 @@ InitPostgres(const char *in_dbname, Oid dboid,
     * limited by max_connections or superuser_reserved_connections.
     */
    if (!am_superuser && !am_walsender &&
-       ReservedBackends > 0 &&
-       !HaveNFreeProcs(ReservedBackends))
+       SuperuserReservedConnections > 0 &&
+       !HaveNFreeProcs(SuperuserReservedConnections))
        ereport(FATAL,
                (errcode(ERRCODE_TOO_MANY_CONNECTIONS),
                 errmsg("remaining connection slots are reserved for superusers")));
index cd0fc2cb8f90659e460a3f239d0db2298f5c14e1..0fa9fdd3c5866791c39b2c5a70d0fe01625bef3c 100644 (file)
@@ -2163,7 +2163,7 @@ struct config_int ConfigureNamesInt[] =
            gettext_noop("Sets the number of connection slots reserved for superusers."),
            NULL
        },
-       &ReservedBackends,
+       &SuperuserReservedConnections,
        3, 0, MAX_BACKENDS,
        NULL, NULL, NULL
    },
index 203177e1fff27a9103176374ffeb18834eff0daf..0e4b8ded34414811e7ea1b1a623dc207be620140 100644 (file)
@@ -15,7 +15,7 @@
 
 /* GUC options */
 extern PGDLLIMPORT bool EnableSSL;
-extern PGDLLIMPORT int ReservedBackends;
+extern PGDLLIMPORT int SuperuserReservedConnections;
 extern PGDLLIMPORT int PostPortNumber;
 extern PGDLLIMPORT int Unix_socket_permissions;
 extern PGDLLIMPORT char *Unix_socket_group;