Commit 470687b
committed
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 41d5f8a, 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@alvh.no-ip.org>
Reported-by: Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>
Backpatch: 9.5 and up
Discussion: https://postgr.es/m/20200806225558.GA22401@alvherre.pgsql1 parent 82a0ba7 commit 470687b
1 file changed
+12
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
1451 | 1451 | | |
1452 | 1452 | | |
1453 | 1453 | | |
1454 | | - | |
1455 | 1454 | | |
1456 | | - | |
1457 | | - | |
1458 | 1455 | | |
1459 | 1456 | | |
1460 | 1457 | | |
| |||
2932 | 2929 | | |
2933 | 2930 | | |
2934 | 2931 | | |
2935 | | - | |
2936 | 2932 | | |
2937 | | - | |
2938 | | - | |
2939 | 2933 | | |
2940 | 2934 | | |
2941 | 2935 | | |
| |||
3432 | 3426 | | |
3433 | 3427 | | |
3434 | 3428 | | |
3435 | | - | |
3436 | | - | |
3437 | | - | |
3438 | | - | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
3439 | 3436 | | |
3440 | 3437 | | |
3441 | 3438 | | |
| |||
3450 | 3447 | | |
3451 | 3448 | | |
3452 | 3449 | | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
3453 | 3454 | | |
3454 | 3455 | | |
3455 | 3456 | | |
| |||
3480 | 3481 | | |
3481 | 3482 | | |
3482 | 3483 | | |
3483 | | - | |
3484 | 3484 | | |
3485 | 3485 | | |
3486 | 3486 | | |
| |||
0 commit comments