pgsql: When WalSndCaughtUp, sleep only in WalSndWaitForWal().

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: When WalSndCaughtUp, sleep only in WalSndWaitForWal().
Date: 2020-04-11 17:35:41
Message-ID: E1jNK2f-0000Vx-Fr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

When WalSndCaughtUp, sleep only in WalSndWaitForWal().

Before sleeping, WalSndWaitForWal() sends a keepalive if MyWalSnd->write
< sentPtr. That is important in logical replication. When the latest
physical LSN yields no logical replication messages (a common case),
that keepalive elicits a reply, and 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.

Discussion: https://postgr.es/m/20200406063649.GA3738151@rfd.leadboat.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/421685812290406daea58b78dfab0346eb683bbb

Modified Files
--------------
src/backend/replication/walsender.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-04-11 18:47:34 Re: pgsql: Support FETCH FIRST WITH TIES
Previous Message Tom Lane 2020-04-11 16:39:33 pgsql: Clear dangling pointer to avoid bogus EXPLAIN printout in a corn