]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix walsender timeouts when decoding a large transaction
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 14 Dec 2017 16:31:13 +0000 (11:31 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 14 Dec 2017 16:31:13 +0000 (11:31 -0500)
commitc28e0b1e0ab951a434cc4774a82876628092f166
treea3bcb2f80e63a6e4e25bd26f64f16ed71bb42dea
parentc26d46ff6d6e10e8ac1ecf80f8cf9014e3efe418
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
src/backend/replication/walsender.c