diff options
| author | Michael Paquier | 2019-02-12 01:07:56 +0000 |
|---|---|---|
| committer | Michael Paquier | 2019-02-12 01:07:56 +0000 |
| commit | ea92368cd1da1e290f9ab8efb7f60cb7598fc310 (patch) | |
| tree | 7a7970e2e34e61271e07e8adc2f2b40a8d7911cb /src/include | |
| parent | 1d92a0c9f7dd547ad14cd8a3974289c5ec7f04ce (diff) | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/xlog_internal.h | 3 | ||||
| -rw-r--r-- | src/include/catalog/pg_control.h | 3 | ||||
| -rw-r--r-- | src/include/storage/proc.h | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 3c860372515..42d1065d1e0 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -31,7 +31,7 @@ /* * Each page of XLOG file has a header like this: */ -#define XLOG_PAGE_MAGIC 0xD098 /* can be used as WAL version indicator */ +#define XLOG_PAGE_MAGIC 0xD099 /* can be used as WAL version indicator */ typedef struct XLogPageHeaderData { @@ -226,6 +226,7 @@ typedef struct xl_parameter_change { int MaxConnections; int max_worker_processes; + int max_wal_senders; int max_prepared_xacts; int max_locks_per_xact; int wal_level; diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index a4aa83bae8f..a3910a5f997 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -21,7 +21,7 @@ /* Version identifier for this pg_control format */ -#define PG_CONTROL_VERSION 1100 +#define PG_CONTROL_VERSION 1200 /* Nonce key length, see below */ #define MOCK_AUTH_NONCE_LEN 32 @@ -177,6 +177,7 @@ typedef struct ControlFileData bool wal_log_hints; int MaxConnections; int max_worker_processes; + int max_wal_senders; int max_prepared_xacts; int max_locks_per_xact; bool track_commit_timestamp; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index d203acbb30b..1cee7db89df 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -255,6 +255,8 @@ typedef struct PROC_HDR PGPROC *autovacFreeProcs; /* Head of list of bgworker free PGPROC structures */ PGPROC *bgworkerFreeProcs; + /* Head of list of walsender free PGPROC structures */ + PGPROC *walsenderFreeProcs; /* First pgproc waiting for group XID clear */ pg_atomic_uint32 procArrayGroupFirst; /* First pgproc waiting for group transaction status update */ |
