pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix walsender timeouts when decoding a large transaction
Date: Thu, 14 Dec 2017 16:34:13 +0000
Message-ID: <E1ePWSb-0002Kx-EV@gemulon.postgresql.org> (raw)

Fix walsender timeouts when decoding a large transaction

The logical slots have a fast code path for sending data so as not to
impose too high a per message overhead. The fast path skips checks for
interrupts and timeouts. However, the existing coding failed to consider
the fact that a transaction with a large number of changes may take a
very long time to be processed and sent to the client. This causes the
walsender to ignore interrupts for potentially a long time and more
importantly it will result in the walsender being killed due to
timeout at the end of such a transaction.

This commit changes the fast path to also check for interrupts and only
allows calling the fast path when the last keepalive check happened less
than half the walsender timeout ago. Otherwise the slower code path will
be taken.

Backpatched to 9.4

Petr Jelinek, reviewed by  Kyotaro HORIGUCHI, Yura Sokolov,  Craig
Ringer and Robert Haas.

Discussion: https://postgr.es/m/e082a56a-fd95-a250-3bae-0fff93832510@2ndquadrant.com

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/87056267eb85268d49670fd7b27fe2d1a9b4de7a

Modified Files
--------------
src/backend/replication/walsender.c | 66 +++++++++++++++++++++----------------
1 file changed, 38 insertions(+), 28 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1ePWSb-0002Kx-EV@gemulon.postgresql.org>
Permalink:  ../E1ePWSb-0002Kx-EV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ePWSb-0002Kx-EV@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net
  Subject: Re: pgsql: Fix walsender timeouts when decoding a large transaction
  In-Reply-To: <E1ePWSb-0002Kx-EV@gemulon.postgresql.org>
  References: <E1ePWSb-0002Kx-EV@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox