Skip to content

Commit 754baa2

Browse files
committed
Automatically terminate replication connections that are idle for more
than replication_timeout (a new GUC) milliseconds. The TCP timeout is often too long, you want the master to notice a dead connection much sooner. People complained about that in 9.0 too, but with synchronous replication it's even more important to notice dead connections promptly. Fujii Masao and Heikki Linnakangas
1 parent bc03c59 commit 754baa2

File tree

11 files changed

+368
-129
lines changed

11 files changed

+368
-129
lines changed

doc/src/sgml/config.sgml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,29 @@ SET ENABLE_SEQSCAN TO OFF;
20192019
</para>
20202020
</listitem>
20212021
</varlistentry>
2022+
2023+
<varlistentry id="guc-replication-timeout" xreflabel="replication_timeout">
2024+
<term><varname>replication_timeout</varname> (<type>integer</type>)</term>
2025+
<indexterm>
2026+
<primary><varname>replication_timeout</> configuration parameter</primary>
2027+
</indexterm>
2028+
<listitem>
2029+
<para>
2030+
Terminate replication connections that are inactive longer
2031+
than the specified number of milliseconds. This is useful for
2032+
the primary server to detect a standby crash or network outage.
2033+
A value of zero means wait forever. This parameter can only be set in
2034+
the <filename>postgresql.conf</> file or on the server command line.
2035+
The default value is 60 seconds.
2036+
</para>
2037+
<para>
2038+
To prevent connections from being terminated prematurely,
2039+
<xref linkend="guc-wal-receiver-status-interval">
2040+
must be enabled on the standby, and its value must be less than the
2041+
value of <varname>replication_timeout</>.
2042+
</para>
2043+
</listitem>
2044+
</varlistentry>
20222045
</variablelist>
20232046
</sect2>
20242047

@@ -2216,6 +2239,11 @@ SET ENABLE_SEQSCAN TO OFF;
22162239
the <filename>postgresql.conf</> file or on the server command line.
22172240
The default value is 10 seconds.
22182241
</para>
2242+
<para>
2243+
When <xref linkend="guc-replication-timeout"> is enabled on the primary,
2244+
<varname>wal_receiver_status_interval</> must be enabled, and its value
2245+
must be less than the value of <varname>replication_timeout</>.
2246+
</para>
22192247
</listitem>
22202248
</varlistentry>
22212249

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy