pgsql: Fix walsender timeouts when decoding a large transaction

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема pgsql: Fix walsender timeouts when decoding a large transaction
Дата
Msg-id E1ePWSb-0002Kr-E9@gemulon.postgresql.org
обсуждение исходный текст
Список 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.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0fedb4ea6946e72c5c51130446b59b083ba3dd21

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


В списке pgsql-committers по дате отправления:

Предыдущее
От: Teodor Sigaev
Дата:
Сообщение: pgsql: Add approximated Zipfian-distributed random generator topgbench
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Fix a number of copy & paste comment errors in common/int.h.