Skip to content

Commit db361db

Browse files
committed
Make GUC wal_sender_timeout user-settable
Being able to use a value that can be changed on a connection basis is useful with clusters distributed geographically, and makes failure detection more flexible. A note is added in the documentation about the use of "options" in primary_conninfo, which can be hard to grasp for newcomers with the need of two single quotes when listing a set of parameters. Author: Tsunakawa Takayuki Reviewed-by: Masahiko Sawada, Michael Paquier Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1FAAD3AE@G01JPEXMBYT05
1 parent 4f3b38f commit db361db

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

doc/src/sgml/config.sgml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,10 +3127,14 @@ include_dir 'conf.d'
31273127
Terminate replication connections that are inactive longer
31283128
than the specified number of milliseconds. This is useful for
31293129
the sending server to detect a standby crash or network outage.
3130-
A value of zero disables the timeout mechanism. This parameter
3131-
can only be set in
3132-
the <filename>postgresql.conf</filename> file or on the server command line.
3133-
The default value is 60 seconds.
3130+
A value of zero disables the timeout mechanism. The default value
3131+
is 60 seconds. With a cluster distributed across multiple geographic
3132+
locations, using different values per location brings more flexibility
3133+
in the cluster management. A smaller value is useful for faster
3134+
failure detection with a standby having a low-latency network
3135+
connection, and a larger value helps in judging better the health
3136+
of a standby if located on a remote location, with a high-latency
3137+
network connection.
31343138
</para>
31353139
</listitem>
31363140
</varlistentry>

doc/src/sgml/high-availability.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ protocol to make nodes agree on a serializable transactional order.
738738
A simple example of a <filename>recovery.conf</filename> is:
739739
<programlisting>
740740
standby_mode = 'on'
741-
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass'
741+
primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass options=''-c wal_sender_timeout=5000'''
742742
restore_command = 'cp /path/to/archive/%f %p'
743743
archive_cleanup_command = 'pg_archivecleanup /path/to/archive %r'
744744
</programlisting>

src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2539,7 +2539,7 @@ static struct config_int ConfigureNamesInt[] =
25392539
},
25402540

25412541
{
2542-
{"wal_sender_timeout", PGC_SIGHUP, REPLICATION_SENDING,
2542+
{"wal_sender_timeout", PGC_USERSET, REPLICATION_SENDING,
25432543
gettext_noop("Sets the maximum time to wait for WAL replication."),
25442544
NULL,
25452545
GUC_UNIT_MS

0 commit comments

Comments
 (0)