Re: walsender waiting_for_ping spuriously set

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: ashutosh(dot)bapat(at)2ndquadrant(dot)com, Noah Misch <noah(at)leadboat(dot)com>
Subject: Re: walsender waiting_for_ping spuriously set
Date: 2020-08-07 22:55:12
Message-ID: 20200807225512.GA28635@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just noticed that part of this comment I'm modifying:

> @@ -1444,17 +1444,13 @@ WalSndWaitForWal(XLogRecPtr loc)
> * We only send regular messages to the client for full decoded
> * transactions, but a synchronous replication and walsender shutdown
> * possibly are waiting for a later location. So, before sleeping, we
> - * send a ping containing the flush location. If the receiver is
> - * otherwise idle, this keepalive will trigger a reply. Processing the
> - * reply will update these MyWalSnd locations.
> + * send a ping containing the flush location. A reply from standby is
> + * not needed and would be wasteful.

was added very recently, in f246ea3b2a5e ("In caught-up logical
walsender, sleep only in WalSndWaitForWal()."). Added Noah to CC.

I think the walreceiver will only send a reply if
wal_receiver_status_interval is set to a nonzero value. I don't
understand what reason could there possibly be for setting this
parameter to zero, but it seems better to be explicit about it, as this
code is confusing enough.

I'm thinking in keeping the sentences that were added in that commit,
maybe like so:

> * We only send regular messages to the client for full decoded
> * transactions, but a synchronous replication and walsender shutdown
> * possibly are waiting for a later location. So, before sleeping, we
> + * send a ping containing the flush location. A reply from standby is
> + * not needed and would be wasteful most of the time,
> + * but if the receiver is otherwise idle and walreceiver status messages
> + * are enabled, this keepalive will trigger a reply. Processing the
> + * reply will update these MyWalSnd locations.

(Also, the comment would be updated all the way back to 9.5, even if
f246ea3b2a5e itself was not.)

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-08-07 23:18:29 Re: walsender waiting_for_ping spuriously set
Previous Message Peter Geoghegan 2020-08-07 22:28:46 Re: Should the nbtree page split REDO routine's locking work more like the locking on the primary?