1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add support for TCP keepalives on Windows, both for backend and the new

libpq support.
This commit is contained in:
Magnus Hagander
2010-07-08 10:20:14 +00:00
parent d4d32eefdf
commit 44b0d1671a
4 changed files with 175 additions and 39 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.293 2010/07/06 22:55:26 rhaas Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.294 2010/07/08 10:20:13 mha Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
@ -523,12 +523,17 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm>
<listitem>
<para>
On systems that support the <symbol>TCP_KEEPIDLE</symbol> or
<symbol>TCP_KEEPALIVE</> socket option, specifies the
number of seconds between sending keepalives on an otherwise idle
connection. A value of zero uses the system default. If neither of
these socket options is supported, this parameter must be zero. This
parameter is ignored for connections made via a Unix-domain socket.
Specifies the number of seconds before sending a keepalive packet on an otherwise idle
connection. A value of 0 uses the system default. This parameter is supported
only on systems that support the <symbol>TCP_KEEPIDLE</> or <symbol>TCP_KEEPALIVE</>
symbols, and on Windows; on other systems, it must be zero. This parameter is
ignored for connections made via a Unix-domain socket.
<note>
<para>
On Windows, a value of 0 will set this parameter to 2 hours,
since Windows does not provide a way to read the default value.
</para>
</note>
</para>
</listitem>
</varlistentry>
@ -540,11 +545,17 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm>
<listitem>
<para>
On systems that support the <symbol>TCP_KEEPINTVL</symbol> socket option, specifies how
long, in seconds, to wait for a response to a keepalive before
retransmitting. A value of zero uses the system default. If <symbol>TCP_KEEPINTVL</symbol>
is not supported, this parameter must be zero. This parameter is ignored
for connections made via a Unix-domain socket.
Specifies the number of seconds between sending keepalives on an otherwise idle
connection. A value of 0 uses the system default. This parameter is supported
only on systems that support the <symbol>TCP_KEEPINTVL</>
symbol, and on Windows; on other systems, it must be zero. This parameter is
ignored for connections made via a Unix-domain socket.
<note>
<para>
On Windows, a value of 0 will set this parameter to 1 second,
since Windows does not provide a way to read the default value.
</para>
</note>
</para>
</listitem>
</varlistentry>
@ -556,11 +567,16 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm>
<listitem>
<para>
On systems that support the <symbol>TCP_KEEPCNT</symbol> socket option, specifies how
many keepalives can be lost before the connection is considered dead.
A value of zero uses the system default. If <symbol>TCP_KEEPCNT</symbol> is not
supported, this parameter must be zero. This parameter is ignored
for connections made via a Unix-domain socket.
Specifies the number of keepalive packets to send on an otherwise idle
connection. A value of 0 uses the system default. This parameter is supported
only on systems that support the <symbol>TCP_KEEPCNT</>
symbol; on other systems, it must be zero. This parameter is
ignored for connections made via a Unix-domain socket.
<note>
<para>
This parameter is not supported on Windows, and must be zero.
</para>
</note>
</para>
</listitem>
</varlistentry>

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.312 2010/07/06 21:14:25 rhaas Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.313 2010/07/08 10:20:14 mha Exp $ -->
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
@ -298,10 +298,11 @@
<para>
Controls the number of seconds of inactivity after which TCP should
send a keepalive message to the server. A value of zero uses the
system default. This parameter is ignored if the neither the
<symbol>TCP_KEEPIDLE</> nor the <symbol>TCP_KEEPALIVE</> socket
options are supported, for connections made via a Unix-domain
socket, or if keepalives are disabled.
system default. This parameter is ignored for connections made via a
Unix-domain socket, or if keepalives are disabled. It is only supported
on systems where the <symbol>TCP_KEEPIDLE</> or <symbol>TCP_KEEPALIVE</>
socket option is available, and on Windows; on other systems, it has no
effect.
</para>
</listitem>
</varlistentry>
@ -312,10 +313,11 @@
<para>
Controls the number of seconds after which a TCP keepalive message
that is not acknowledged by the server should be retransmitted. A
value of zero uses the system default. This parameter is ignored if
the <symbol>TCP_KEEPINTVL</> socket option is not supported, for
connections made via a Unix-domain socket, or if keepalives are
disabled.
value of zero uses the system default. This parameter is ignored for
connections made via a Unix-domain socket, or if keepalives are disabled.
It is only supported on systems where the <symbol>TCP_KEEPINTVL</>
socket option is available, and on Windows; on other systems, it has no
effect.
</para>
</listitem>
</varlistentry>
@ -326,10 +328,10 @@
<para>
Controls the number of TCP keepalives that can be lost before the
client's connection to the server is considered dead. A value of
zero uses the system default. This parameter is ignored if the
<symbol>TCP_KEEPCNT</> socket option is not supported, for
connections made via a Unix-domain socket, or if keepalives are
disabled.
zero uses the system default. This parameter is ignored for
connections made via a Unix-domain socket, or if keepalives are disabled.
It is only supported on systems where the <symbol>TCP_KEEPINTVL</>
socket option is available; on other systems, it has no effect.
</para>
</listitem>
</varlistentry>