walsender waiting_for_ping spuriously set
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: ashutosh.bapat@2ndquadrant.com
Date: 2020-08-06T22:55:58Z
Lists: pgsql-hackers
Attachments
- 0001-Fix-waiting_for_ping-in-walsender.patch (text/x-diff)
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@phx.gbl -- Álvaro Herrera Valdivia, Chile
Commits
-
walsnd: Don't set waiting_for_ping_response spuriously
- d81387da90fe 10.14 landed
- ca8e87ea04a4 9.5.23 landed
- 900429d0c036 13.0 landed
- 85cb4ec509c3 12.4 landed
- 55d42c917830 9.6.19 landed
- 470687b4a5bb 14.0 landed
- 1fa6eec974f8 11.9 landed
-
Be less aggressive in asking for feedback of logical walsender clients.
- 41d5f8ad734f 9.5.0 cited