From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: walsnd: Don't set waiting_for_ping_response spuriously |
Date: | 2020-08-08 16:42:35 |
Message-ID: | E1k4RvX-0003qT-St@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
walsnd: Don't set waiting_for_ping_response spuriously
Ashutosh Bapat noticed that when logical walsender needs to wait for
WAL, and it realizes that it must send a keepalive message to
walreceiver to update the sent-LSN, which *does not* request a reply
from walreceiver, it wrongly sets the flag that it's going to wait for
that reply. That means that any future would-be sender of feedback
messages ends up not sending a feedback message, because they all
believe that a reply is expected.
With built-in logical replication there's not much harm in this, because
WalReceiverMain will send a ping-back every wal_receiver_timeout/2
anyway; but with other logical replication systems (e.g. pglogical) it
can cause significant pain.
This problem was introduced in commit 41d5f8ad734, where the
request-reply flag was changed from true to false to WalSndKeepalive,
without at the same time removing the line that sets
waiting_for_ping_response.
Just removing that line would be a sufficient fix, but it seems better
to shift the responsibility of setting the flag to WalSndKeepalive
itself instead of requiring caller to do it; this is clearly less
error-prone.
Author: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reported-by: Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d81387da90feb55d26789ba8fa76fa97e66e69f8
Modified Files
--------------
src/backend/replication/walsender.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2020-08-08 18:12:55 | pgsql: Teach amcheck to verify sibling links in all cases. |
Previous Message | Amit Kapila | 2020-08-08 06:58:48 | pgsql: Fix the logical streaming test. |