pgsql: Move max_wal_senders out of max_connections for connectionslot - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Move max_wal_senders out of max_connections for connectionslot
Date
Msg-id E1gtMky-0005bu-Ji@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Move max_wal_senders out of max_connections for connection slot handling

Since its introduction, max_wal_senders is counted as part of
max_connections when it comes to define how many connection slots can be
used for replication connections with a WAL sender context.  This can
lead to confusion for some users, as it could be possible to block a
base backup or replication from happening because other backend sessions
are already taken for other purposes by an application, and
superuser-only connection slots are not a correct solution to handle
that case.

This commit makes max_wal_senders independent of max_connections for its
handling of PGPROC entries in ProcGlobal, meaning that connection slots
for WAL senders are handled using their own free queue, like autovacuum
workers and bgworkers.

One compatibility issue that this change creates is that a standby now
requires to have a value of max_wal_senders at least equal to its
primary.  So, if a standby created enforces the value of
max_wal_senders to be lower than that, then this could break failovers.
Normally this should not be an issue though, as any settings of a
standby are inherited from its primary as postgresql.conf gets normally
copied as part of a base backup, so parameters would be consistent.

Author: Alexander Kukushkin
Reviewed-by: Kyotaro Horiguchi, Petr Jelínek, Masahiko Sawada, Oleksii
Kliukin
Discussion: https://postgr.es/m/CAFh8B=nBzHQeYAu0b8fjK-AF1X4+_p6GRtwG+cCgs6Vci2uRuQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ea92368cd1da1e290f9ab8efb7f60cb7598fc310

Modified Files
--------------
doc/src/sgml/config.sgml                | 34 ++++++++++++++++-----------------
doc/src/sgml/high-availability.sgml     |  5 +++++
doc/src/sgml/runtime.sgml               | 10 +++++-----
src/backend/access/rmgrdesc/xlogdesc.c  |  7 ++++---
src/backend/access/transam/xlog.c       | 10 +++++++++-
src/backend/postmaster/postmaster.c     |  8 ++++----
src/backend/replication/walsender.c     | 12 ++++--------
src/backend/storage/lmgr/proc.c         | 23 +++++++++++++++++++---
src/backend/utils/init/postinit.c       | 11 +++++------
src/backend/utils/misc/guc.c            | 23 ++++++++++++++++------
src/bin/pg_controldata/pg_controldata.c |  2 ++
src/bin/pg_resetwal/pg_resetwal.c       |  2 ++
src/include/access/xlog_internal.h      |  3 ++-
src/include/catalog/pg_control.h        |  3 ++-
src/include/storage/proc.h              |  2 ++
15 files changed, 100 insertions(+), 55 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Stamp 9.4.21.
Next
From: Tom Lane
Date:
Subject: pgsql: Allow extensions to generate lossy index conditions.