pgsql: Send keepalives from walsender even when busy sending WAL. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Send keepalives from walsender even when busy sending WAL.
Date
Msg-id E1WLeAX-0002jf-T4@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Send keepalives from walsender even when busy sending WAL.

If walsender doesn't hear from the client for the time specified by
wal_sender_timeout, it will conclude the connection or client is dead, and
disconnect. When half of wal_sender_timeout has elapsed, it sends a ping
to the client, leaving it the remainig half of wal_sender_timeout to
respond. However, it only checked if half of wal_sender_timeout had elapsed
when it was about to sleep, so if it was busy sending WAL to the client for
long enough, it would not send the ping request in time. Then the client
would not know it needs to send a reply, and the walsender will disconnect
even though the client is still alive. Fix that.

Andres Freund, reviewed by Robert Haas, and some further changes by me.
Backpatch to 9.3. Earlier versions relied on the client to send the
keepalives on its own, and hence didn't have this problem.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/94ae6ba74dfc626efa271461902db1be35d2a551

Modified Files
--------------
src/backend/replication/walsender.c |   53 +++++++++++++++++++----------------
1 file changed, 29 insertions(+), 24 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: isdigit() needs an unsigned char argument.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Send keepalives from walsender even when busy sending WAL.