pgsql: In caught-up logical walsender, sleep only in WalSndWaitForWal()

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: In caught-up logical walsender, sleep only in WalSndWaitForWal()
Date: 2020-04-25 17:27:56
Message-ID: E1jSOaq-0000rX-HQ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In caught-up logical walsender, sleep only in WalSndWaitForWal().

Before sleeping, WalSndWaitForWal() sends a keepalive if MyWalSnd->write
< sentPtr. When the latest physical LSN yields no logical replication
messages (a common case), that keepalive elicits a reply. Processing
the reply updates pg_stat_replication.replay_lsn. WalSndLoop() lacks
that; when WalSndLoop() slept, replay_lsn advancement could stall until
wal_receiver_status_interval elapsed. This sometimes stalled
src/test/subscription/t/001_rep_changes.pl for up to 10s.

Reviewed by Fujii Masao and Michael Paquier.

Discussion: https://postgr.es/m/20200418070142.GA1075445@rfd.leadboat.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f246ea3b2a5e0b75e44f0f18157c4b5e10b5547f

Modified Files
--------------
src/backend/replication/walsender.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-04-25 21:17:30 pgsql: Fix minor nbtree page deletion buffer lock issue.
Previous Message Andrew Gierth 2020-04-25 04:21:05 pgsql: Fix error case for CREATE ROLE ... IN ROLE.