Re: walsender waiting_for_ping spuriously set

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, ashutosh(dot)bapat(at)2ndquadrant(dot)com
Subject: Re: walsender waiting_for_ping spuriously set
Date: 2020-08-11 00:33:22
Message-ID: 20200811003322.yui472ozkrhqv34h@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-08-06 18:55:58 -0400, Alvaro Herrera wrote:
> Ashutosh Bapat noticed that WalSndWaitForWal() is setting
> waiting_for_ping_response after sending a keepalive that does *not*
> request a reply. The bad consequence is that other callers that do
> require a reply end up in not sending a keepalive, because they think it
> was already sent previously. So the whole thing gets stuck.
>
> He found that commit 41d5f8ad734 failed to remove the setting of
> waiting_for_ping_response after changing the "request" parameter
> WalSndKeepalive from true to false; that seems to have been an omission
> and it breaks the algorithm. Thread at [1].
>
> The simplest fix is just to remove the line that sets
> waiting_for_ping_response, but I think it is less error-prone to have
> WalSndKeepalive set the flag itself, instead of expecting its callers to
> do it (and know when to). Patch attached. Also rewords some related
> commentary.

Thanks for diagnosis and fix!

- Andres

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-08-11 00:37:46 Re: remove spurious CREATE INDEX CONCURRENTLY wait
Previous Message Andres Freund 2020-08-11 00:32:21 Re: Switch to multi-inserts for pg_depend