Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIZ7O-0003lk-S6 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Jan 2023 17:54:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pIZ7N-00067s-P9 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Jan 2023 17:54:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pIZ7N-00067j-BH for pgsql-hackers@lists.postgresql.org; Thu, 19 Jan 2023 17:54:29 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pIZ7K-0007cB-34 for pgsql-hackers@postgresql.org; Thu, 19 Jan 2023 17:54:28 +0000 Received: by mail-pg1-x535.google.com with SMTP id 7so2156078pga.1 for ; Thu, 19 Jan 2023 09:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=i1b+LaEewrehcLQfrF69U6ATZ/UL0wrrpFyNGfor32k=; b=BpyN4tB4WAxzpxbLaZFP2fEHL+owFw9u9o9jTH/1/tYiVJks/gvCYQy6r7m7kIlPXL 4oA0awjH3Fe1BT6Z+TJ1l3o0V22e6rfUzFX6thqmBP/aGuruiBHprPWUKPuEq2VxpO86 GaeZpVWW40jyBWb5O1XE8islCFt5tUie7awHBoN7JHrsOqy7lPz4mH3LlqOwuzqkNDIR FoPDI9MV5LI2x3NFOtsEGrFsSTzYp+652Exne6jLm46oz05bcslup8U5cRGJL9h+085M 4xJ4cTWpeKKmY46Yvj7us4ccWsBUq8edfsBuIA6tQhMRVra9BeKZvmjb4varDCMVFAvs fAUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=i1b+LaEewrehcLQfrF69U6ATZ/UL0wrrpFyNGfor32k=; b=G/7gXZRDip5e2EL2XrC/yoQCzBt5tMhw3v8pzXjqYXo0X/UGlTxS78qeFbHPml4JNO tGTknQ6SgaBnmOgXY/AhKHGbldjRkD5Bj2DxvK2BAwRDQIdyGd+XCITyiNlvgzfFq+tY mkC0YT59FhHZCiRmghelhLoncZJIkdf6epKFqYI6YwE0yfLj07uH9rwnxGZjjlOxVCn0 SlHhY8fNh7SDsCLEtDtEOnyiVcptq4vyauUFMGyQYqWXOnXHk53DBJLX3ET71tYD9DQK U+QPhhNrXyYFksKU560G2bmE2aEMXunsbaLjwsPrupiKm+185qTqzkTp0AXTA4XM3DpE by3Q== X-Gm-Message-State: AFqh2ko9iGGwGtN7UqZqBmxxIuma3S8ZoDDhGcgSoaPRFQbogaZvNyyk djv3RrAmk27SFzx3fH/z46Wiof5R2lE= X-Google-Smtp-Source: AMrXdXv3/E3xbO1OyZ1GIL3HFUIuuadjzFhFAWksPA7V87X0uVMQVg7gIAEwwS1eTVyo2iLZG703Ug== X-Received: by 2002:a05:6a00:1d23:b0:572:6d6b:2297 with SMTP id a35-20020a056a001d2300b005726d6b2297mr11369095pfx.21.1674150863747; Thu, 19 Jan 2023 09:54:23 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id x186-20020a6231c3000000b0058bcb42dd1asm9937845pfx.111.2023.01.19.09.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 09:54:22 -0800 (PST) Date: Thu, 19 Jan 2023 09:54:21 -0800 From: Nathan Bossart To: Robert Haas Cc: "pgsql-hackers@postgresql.org" Subject: Re: almost-super-user problems that we haven't fixed yet Message-ID: <20230119175421.GA3934756@nathanxps13> References: <20230116223728.GA2714038@nathanxps13> <20230117184230.GB3015764@nathanxps13> <20230118001523.GB3321806@nathanxps13> <20230118190012.GA3540486@nathanxps13> <20230118211414.GA3702050@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jan 19, 2023 at 11:40:53AM -0500, Robert Haas wrote: > On Wed, Jan 18, 2023 at 4:14 PM Nathan Bossart wrote: >> On Wed, Jan 18, 2023 at 02:51:38PM -0500, Robert Haas wrote: >> > Should (nfree < SuperuserReservedBackends) be using <=, or am I confused? >> >> I believe < is correct. At this point, the new backend will have already >> claimed a proc struct, so if the number of remaining free slots equals the >> number of reserved slots, it is okay. > > OK. Might be worth a short comment. I added one. >> > What's the deal with removing "and no new replication connections will >> > be accepted" from the documentation? Is the existing documentation >> > just wrong? If so, should we fix that first? And maybe delete >> > "non-replication" from the error message that says "remaining >> > connection slots are reserved for non-replication superuser >> > connections"? It seems like right now the comments say that >> > replication connections are a completely separate pool of connections, >> > but the documentation and the error message make it sound otherwise. >> > If that's true, then one of them is wrong, and I think it's the >> > docs/error message. Or am I just misreading it? >> >> I think you are right. This seems to have been missed in ea92368. I moved >> this part to a new patch that should probably be back-patched to v12. > > I'm inclined to commit it to master and not back-patch. It doesn't > seem important enough to perturb translations. That seems reasonable to me. > Tushar seems to have a point about pg_use_reserved_connections vs. > pg_use_reserved_backends. I think we should standardize on the former, > as backends is an internal term. Oops. This is what I meant to do. I probably flubbed it because I was wondering why the parameter uses "connections" and the variable uses "backends," especially considering that the variable for max_connections is called MaxConnections. I went ahead and renamed everything to use "connections." -- Nathan Bossart Amazon Web Services: https://aws.amazon.com --/04w6evG8XlLl3ft Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0001-Code-review-for-ea92368.patch" From 7be7e70aaf488a924d61b21b351a3b4f7e33aedc Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 18 Jan 2023 12:43:41 -0800 Subject: [PATCH v4 1/3] Code review for ea92368. This commit missed an error message and a line in the docs. --- doc/src/sgml/config.sgml | 3 +-- src/backend/utils/init/postinit.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 89d53f2a64..e019a1aac9 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -725,8 +725,7 @@ include_dir 'conf.d' number of active concurrent connections is at least max_connections minus superuser_reserved_connections, new - connections will be accepted only for superusers, and no - new replication connections will be accepted. + connections will be accepted only for superusers. diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index ae5a85ed65..9145d96b38 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -931,7 +931,7 @@ InitPostgres(const char *in_dbname, Oid dboid, !HaveNFreeProcs(ReservedBackends)) ereport(FATAL, (errcode(ERRCODE_TOO_MANY_CONNECTIONS), - errmsg("remaining connection slots are reserved for non-replication superuser connections"))); + errmsg("remaining connection slots are reserved for superusers"))); /* Check replication permissions needed for walsender processes. */ if (am_walsender) -- 2.25.1 --/04w6evG8XlLl3ft Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0002-Rename-ReservedBackends-to-SuperuserReservedConne.patch" From 058df2b3dcf50ecbe76c794f4f52751e6a9f765f Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 17 Jan 2023 13:58:56 -0800 Subject: [PATCH v4 2/3] Rename ReservedBackends to SuperuserReservedConnections. This is in preparation for adding a new reserved_connections GUC. --- src/backend/postmaster/postmaster.c | 20 ++++++++++---------- src/backend/utils/init/postinit.c | 4 ++-- src/backend/utils/misc/guc_tables.c | 2 +- src/include/postmaster/postmaster.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 9cedc1b9f0..3f799c4ac8 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -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) diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 9145d96b38..40f145e0ab 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -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"))); diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index cd0fc2cb8f..0fa9fdd3c5 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -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 }, diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h index 203177e1ff..0e4b8ded34 100644 --- a/src/include/postmaster/postmaster.h +++ b/src/include/postmaster/postmaster.h @@ -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; -- 2.25.1 --/04w6evG8XlLl3ft Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0003-Introduce-reserved_connections-and-pg_use_reserve.patch" From 3c137c30d287ea7388d77ee7f3a5757227638c51 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Tue, 17 Jan 2023 15:36:59 -0800 Subject: [PATCH v4 3/3] Introduce reserved_connections and pg_use_reserved_connections. This provides a way to reserve connection slots for non-superusers. superuser_reserved_connections remains as a final reserve in case reserved_connections has been exhausted. --- doc/src/sgml/config.sgml | 39 ++++++++++++++++++- doc/src/sgml/user-manag.sgml | 5 +++ src/backend/postmaster/postmaster.c | 29 +++++++++----- src/backend/storage/lmgr/proc.c | 16 +++++--- src/backend/utils/init/postinit.c | 31 +++++++++++---- src/backend/utils/misc/guc_tables.c | 11 ++++++ src/backend/utils/misc/postgresql.conf.sample | 1 + src/include/catalog/pg_authid.dat | 5 +++ src/include/postmaster/postmaster.h | 1 + src/include/storage/proc.h | 2 +- 10 files changed, 115 insertions(+), 25 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index e019a1aac9..626faa4d08 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -725,17 +725,52 @@ include_dir 'conf.d' number of active concurrent connections is at least max_connections minus superuser_reserved_connections, new - connections will be accepted only for superusers. + connections will be accepted only for superusers. The connection slots + reserved by this parameter are intended as final reserve for emergency + use after the slots reserved by + have been exhausted. The default value is three connections. The value must be less - than max_connections. + than max_connections minus + reserved_connections. This parameter can only be set at server start. + + reserved_connections (integer) + + reserved_connections configuration parameter + + + + + Determines the number of connection slots that are + reserved for connections by roles with privileges of the + pg_used_reserved_connections + role. Whenever the number of free connection slots is greater than + but less than or + equal to the sum of superuser_reserved_connections + and reserved_connections, new connections will be + accepted only for superusers and roles with privileges of + pg_use_reserved_connections. If + superuser_reserved_connections or fewer connection + slots are available, new connections will be accepted only for + superusers. + + + + The default value is zero connections. The value must be less than + max_connections minus + superuser_reserved_connections. This parameter can + only be set at server start. + + + + unix_socket_directories (string) diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml index 71a2d8f298..002c1e3aff 100644 --- a/doc/src/sgml/user-manag.sgml +++ b/doc/src/sgml/user-manag.sgml @@ -689,6 +689,11 @@ DROP ROLE doomed_role; and LOCK TABLE on all relations. + + pg_use_reserved_connections + Allow use of connection slots reserved via + . + diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 3f799c4ac8..aca1ef91b5 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -205,14 +205,24 @@ char *ListenAddresses; /* * 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. + * superuser use, and ReservedConnections is the number of backends reserved + * for use by roles with privileges of the pg_use_reserved_connections + * predefined role. These are taken out of the pool of MaxConnections backend + * slots, so the number of backend slots available for roles that are neither + * superuser nor have privileges of pg_use_reserved_connections is + * (MaxConnections - SuperuserReservedConnections - ReservedConnections). + * + * If the number of remaining slots is less than or equal to + * SuperuserReservedConnections, only superusers can make new connections. If + * the number of remaining slots is greater than SuperuserReservedConnections + * but less than or equal to + * (SuperuserReservedConnections + ReservedConnections), only superusers and + * roles with privileges of pg_use_reserved_connections can make new + * connections. Note that pre-existing superuser and + * pg_use_reserved_connections connections don't count against the limits. */ int SuperuserReservedConnections; +int ReservedConnections; /* The socket(s) we're listening to. */ #define MAXLISTEN 64 @@ -908,11 +918,12 @@ PostmasterMain(int argc, char *argv[]) /* * Check for invalid combinations of GUC settings. */ - if (SuperuserReservedConnections >= MaxConnections) + if (SuperuserReservedConnections + ReservedConnections >= MaxConnections) { - write_stderr("%s: superuser_reserved_connections (%d) must be less than max_connections (%d)\n", + write_stderr("%s: superuser_reserved_connections (%d) plus reserved_connections (%d) must be less than max_connections (%d)\n", progname, - SuperuserReservedConnections, MaxConnections); + SuperuserReservedConnections, ReservedConnections, + MaxConnections); ExitPostmaster(1); } if (XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level == WAL_LEVEL_MINIMAL) diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index f8ac4edd6f..22b4278610 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -645,27 +645,33 @@ GetStartupBufferPinWaitBufId(void) } /* - * Check whether there are at least N free PGPROC objects. + * Check whether there are at least N free PGPROC objects. If false is + * returned, *nfree will be set to the number of free PGPROC objects. + * Otherwise, *nfree will be set to n. * * Note: this is designed on the assumption that N will generally be small. */ bool -HaveNFreeProcs(int n) +HaveNFreeProcs(int n, int *nfree) { dlist_iter iter; + Assert(n > 0); + Assert(nfree); + SpinLockAcquire(ProcStructLock); + *nfree = 0; dlist_foreach(iter, &ProcGlobal->freeProcs) { - n--; - if (n == 0) + (*nfree)++; + if (*nfree == n) break; } SpinLockRelease(ProcStructLock); - return (n <= 0); + return (*nfree == n); } /* diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 40f145e0ab..2f07ca7a0e 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -719,6 +719,7 @@ InitPostgres(const char *in_dbname, Oid dboid, bool am_superuser; char *fullpath; char dbname[NAMEDATALEN]; + int nfree = 0; elog(DEBUG3, "InitPostgres"); @@ -922,16 +923,30 @@ InitPostgres(const char *in_dbname, Oid dboid, } /* - * The last few connection slots are reserved for superusers. Replication - * connections are drawn from slots reserved with max_wal_senders and not - * limited by max_connections or superuser_reserved_connections. + * The last few connection slots are reserved for superusers and roles with + * privileges of pg_use_reserved_connections. Replication connections are + * drawn from slots reserved with max_wal_senders and are not limited by + * max_connections, superuser_reserved_connections, or + * reserved_connections. + * + * Note: At this point, the new backend has already claimed a proc struct, + * so we must check whether the number of free slots is strictly less than + * the reserved connection limits. */ if (!am_superuser && !am_walsender && - SuperuserReservedConnections > 0 && - !HaveNFreeProcs(SuperuserReservedConnections)) - ereport(FATAL, - (errcode(ERRCODE_TOO_MANY_CONNECTIONS), - errmsg("remaining connection slots are reserved for superusers"))); + (SuperuserReservedConnections + ReservedConnections) > 0 && + !HaveNFreeProcs(SuperuserReservedConnections + ReservedConnections, &nfree)) + { + if (nfree < SuperuserReservedConnections) + ereport(FATAL, + (errcode(ERRCODE_TOO_MANY_CONNECTIONS), + errmsg("remaining connection slots are reserved for superusers"))); + + if (!has_privs_of_role(GetUserId(), ROLE_PG_USE_RESERVED_CONNECTIONS)) + ereport(FATAL, + (errcode(ERRCODE_TOO_MANY_CONNECTIONS), + errmsg("remaining connection slots are reserved for roles with privileges of pg_use_reserved_connections"))); + } /* Check replication permissions needed for walsender processes. */ if (am_walsender) diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 0fa9fdd3c5..e1753a40fa 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -2168,6 +2168,17 @@ struct config_int ConfigureNamesInt[] = NULL, NULL, NULL }, + { + {"reserved_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS, + gettext_noop("Sets the number of connection slots reserved for roles " + "with privileges of pg_use_reserved_connections."), + NULL + }, + &ReservedConnections, + 0, 0, MAX_BACKENDS, + NULL, NULL, NULL + }, + { {"min_dynamic_shared_memory", PGC_POSTMASTER, RESOURCES_MEM, gettext_noop("Amount of dynamic shared memory reserved at startup."), diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 4cceda4162..f701312225 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -64,6 +64,7 @@ #port = 5432 # (change requires restart) #max_connections = 100 # (change requires restart) #superuser_reserved_connections = 3 # (change requires restart) +#reserved_connections = 0 # (change requires restart) #unix_socket_directories = '/tmp' # comma-separated list of directories # (change requires restart) #unix_socket_group = '' # (change requires restart) diff --git a/src/include/catalog/pg_authid.dat b/src/include/catalog/pg_authid.dat index 2a2fee7d28..f2e5663c9f 100644 --- a/src/include/catalog/pg_authid.dat +++ b/src/include/catalog/pg_authid.dat @@ -89,5 +89,10 @@ rolcreaterole => 'f', rolcreatedb => 'f', rolcanlogin => 'f', rolreplication => 'f', rolbypassrls => 'f', rolconnlimit => '-1', rolpassword => '_null_', rolvaliduntil => '_null_' }, +{ oid => '4550', oid_symbol => 'ROLE_PG_USE_RESERVED_CONNECTIONS', + rolname => 'pg_use_reserved_connections', rolsuper => 'f', rolinherit => 't', + rolcreaterole => 'f', rolcreatedb => 'f', rolcanlogin => 'f', + rolreplication => 'f', rolbypassrls => 'f', rolconnlimit => '-1', + rolpassword => '_null_', rolvaliduntil => '_null_' }, ] diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h index 0e4b8ded34..3b3889c58c 100644 --- a/src/include/postmaster/postmaster.h +++ b/src/include/postmaster/postmaster.h @@ -16,6 +16,7 @@ /* GUC options */ extern PGDLLIMPORT bool EnableSSL; extern PGDLLIMPORT int SuperuserReservedConnections; +extern PGDLLIMPORT int ReservedConnections; extern PGDLLIMPORT int PostPortNumber; extern PGDLLIMPORT int Unix_socket_permissions; extern PGDLLIMPORT char *Unix_socket_group; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index dd45b8ee9b..4258cd92c9 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -445,7 +445,7 @@ extern void InitAuxiliaryProcess(void); extern void SetStartupBufferPinWaitBufId(int bufid); extern int GetStartupBufferPinWaitBufId(void); -extern bool HaveNFreeProcs(int n); +extern bool HaveNFreeProcs(int n, int *nfree); extern void ProcReleaseLocks(bool isCommit); extern ProcWaitStatus ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable); -- 2.25.1 --/04w6evG8XlLl3ft--