Re: walsender waiting_for_ping spuriously set - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: walsender waiting_for_ping spuriously set
Date
Msg-id 20200807225512.GA28635@alvherre.pgsql
Whole thread Raw
In response to walsender waiting_for_ping spuriously set  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: walsender waiting_for_ping spuriously set
List 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



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Should the nbtree page split REDO routine's locking work more like the locking on the primary?
Next
From: Alvaro Herrera
Date:
Subject: Re: walsender waiting_for_ping spuriously set