mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +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:
@ -2236,10 +2236,10 @@ include 'filename'
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-replication-timeout" xreflabel="replication_timeout">
|
||||
<term><varname>replication_timeout</varname> (<type>integer</type>)</term>
|
||||
<varlistentry id="guc-wal-sender-timeout" xreflabel="wal_sender_timeout">
|
||||
<term><varname>wal_sender_timeout</varname> (<type>integer</type>)</term>
|
||||
<indexterm>
|
||||
<primary><varname>replication_timeout</> configuration parameter</primary>
|
||||
<primary><varname>wal_sender_timeout</> configuration parameter</primary>
|
||||
</indexterm>
|
||||
<listitem>
|
||||
<para>
|
||||
@ -2251,12 +2251,6 @@ include 'filename'
|
||||
the <filename>postgresql.conf</> file or on the server command line.
|
||||
The default value is 60 seconds.
|
||||
</para>
|
||||
<para>
|
||||
To prevent connections from being terminated prematurely,
|
||||
<xref linkend="guc-wal-receiver-status-interval">
|
||||
must be enabled on the standby, and its value must be less than the
|
||||
value of <varname>replication_timeout</>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -2474,11 +2468,6 @@ include 'filename'
|
||||
the <filename>postgresql.conf</> file or on the server command line.
|
||||
The default value is 10 seconds.
|
||||
</para>
|
||||
<para>
|
||||
When <xref linkend="guc-replication-timeout"> is enabled on a sending server,
|
||||
<varname>wal_receiver_status_interval</> must be enabled, and its value
|
||||
must be less than the value of <varname>replication_timeout</>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -2507,6 +2496,25 @@ include 'filename'
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="guc-wal-receiver-timeout" xreflabel="wal_receiver_timeout">
|
||||
<term><varname>wal_receiver_timeout</varname> (<type>integer</type>)</term>
|
||||
<indexterm>
|
||||
<primary><varname>wal_receiver_timeout</> configuration parameter</primary>
|
||||
</indexterm>
|
||||
<listitem>
|
||||
<para>
|
||||
Terminate replication connections that are inactive longer
|
||||
than the specified number of milliseconds. This is useful for
|
||||
the receiving standby server to detect a primary node crash or network
|
||||
outage.
|
||||
A value of zero disables the timeout mechanism. This parameter
|
||||
can only be set in
|
||||
the <filename>postgresql.conf</> file or on the server command line.
|
||||
The default value is 60 seconds.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
@ -3322,7 +3322,7 @@
|
||||
<listitem>
|
||||
<para>
|
||||
Add
|
||||
<link linkend="guc-replication-timeout"><varname>replication_timeout</></link>
|
||||
<varname>replication_timeout</>
|
||||
setting (Fujii Masao, Heikki Linnakangas)
|
||||
</para>
|
||||
|
||||
|
Reference in New Issue
Block a user