mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Improve replication connection timeouts.
Rename replication_timeout to wal_sender_timeout, and add a new setting called wal_receiver_timeout that does the same at the walreceiver side. There was previously no timeout in walreceiver, so if the network went down, for example, the walreceiver could take a long time to notice that the connection was lost. Now with the two settings, both sides of a replication connection will detect a broken connection similarly. It is no longer necessary to manually set wal_receiver_status_interval to a value smaller than the timeout. Both wal sender and receiver now automatically send a "ping" message if more than 1/2 of the configured timeout has elapsed, and it hasn't received any messages from the other end. Amit Kapila, heavily edited by me.
This commit is contained in:
@@ -1595,6 +1595,17 @@ static struct config_int ConfigureNamesInt[] =
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"wal_receiver_timeout", PGC_SIGHUP, REPLICATION_STANDBY,
|
||||
gettext_noop("Sets the maximum wait time to receive data from master."),
|
||||
NULL,
|
||||
GUC_UNIT_MS
|
||||
},
|
||||
&wal_receiver_timeout,
|
||||
60 * 1000, 0, INT_MAX,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"max_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
|
||||
gettext_noop("Sets the maximum number of concurrent connections."),
|
||||
@@ -2019,12 +2030,12 @@ static struct config_int ConfigureNamesInt[] =
|
||||
},
|
||||
|
||||
{
|
||||
{"replication_timeout", PGC_SIGHUP, REPLICATION_SENDING,
|
||||
{"wal_sender_timeout", PGC_SIGHUP, REPLICATION_SENDING,
|
||||
gettext_noop("Sets the maximum time to wait for WAL replication."),
|
||||
NULL,
|
||||
GUC_UNIT_MS
|
||||
},
|
||||
&replication_timeout,
|
||||
&wal_sender_timeout,
|
||||
60 * 1000, 0, INT_MAX,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
@@ -210,7 +210,7 @@
|
||||
#max_wal_senders = 0 # max number of walsender processes
|
||||
# (change requires restart)
|
||||
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
|
||||
#replication_timeout = 60s # in milliseconds; 0 disables
|
||||
#wal_sender_timeout = 60s # in milliseconds; 0 disables
|
||||
|
||||
# - Master Server -
|
||||
|
||||
@@ -237,6 +237,9 @@
|
||||
# 0 disables
|
||||
#hot_standby_feedback = off # send info from standby to prevent
|
||||
# query conflicts
|
||||
#wal_receiver_timeout = 60s # time that receiver waits for
|
||||
# communication from master
|
||||
# in milliseconds; 0 disables
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user