Skip site navigation (1) Skip section navigation (2)

pgsql: Fix walsender timeouts when decoding a large transaction

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix walsender timeouts when decoding a large transaction
Date: 2017-12-14 16:34:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
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.




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

pgsql-committers by date

Next:From: Andres FreundDate: 2017-12-14 20:37:14
Subject: pgsql: Fix a number of copy & paste comment errors in common/int.h.
Previous:From: Teodor SigaevDate: 2017-12-14 11:30:42
Subject: pgsql: Add approximated Zipfian-distributed random generator to pgbench

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group