Re: walsender waiting_for_ping spuriously set

From: Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: walsender waiting_for_ping spuriously set
Date: 2020-08-07 05:38:50
Message-ID: CAG-ACPX_ouARUnzOL2tM2OWM5q62rDzRrFfs_BqUOc4Hf9zpOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The patch looks good to me. Thanks for improving comments around that code.
I like the change to set waiting_for_ping_response in WalSndKeepalive.
Thanks.

On Fri, 7 Aug 2020 at 04:26, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
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.
>
> [1]
> https://postgr.es/m/flat/BLU436-SMTP25712B7EF9FC2ADEB87C522DC040(at)phx(dot)gbl
>
> --
> Álvaro Herrera Valdivia, Chile
>

--
Best Wishes,
Ashutosh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2020-08-07 05:55:40 Re: Yet another issue with step generation in partition pruning
Previous Message Simon Riggs 2020-08-07 04:54:19 Re: PROC_IN_ANALYZE stillborn 13 years ago