postgresql/src/backend
Alvaro Herrera 470687b4a5
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 41d5f8ad73, 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.pgsql
2020-08-08 12:31:55 -04:00
..
access Implement streaming mode in ReorderBuffer. 2020-08-08 07:47:06 +05:30
bootstrap Be more careful about marking catalog columns NOT NULL by default. 2020-07-21 13:03:48 -04:00
catalog Minimize slot creation for multi-inserts of pg_shdepend 2020-08-01 11:49:13 +09:00
commands Remove PROC_IN_ANALYZE and derived flags 2020-08-07 17:24:40 -04:00
executor Fix matching of sub-partitions when a partitioned plan is stale. 2020-08-05 15:38:55 -04:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit Register llvm_shutdown using on_proc_exit, not before_shmem_exit. 2020-08-06 14:13:03 -04:00
lib Use pg_bitutils for HyperLogLog. 2020-07-30 09:14:23 -07:00
libpq code: replace most remaining uses of 'master'. 2020-07-08 13:24:35 -07:00
main Clean up includes of s_lock.h. 2020-06-18 19:41:05 -07:00
nodes Rename field "relkind" to "objtype" for CTAS and ALTER TABLE nodes 2020-07-11 13:32:28 +09:00
optimizer Add hash_mem_multiplier GUC. 2020-07-29 14:14:58 -07:00
parser Rename field "relkind" to "objtype" for CTAS and ALTER TABLE nodes 2020-07-11 13:32:28 +09:00
partitioning Fix yet another issue with step generation in partition pruning. 2020-08-07 14:45:00 +09:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Add huge_page_size setting for use on Linux. 2020-07-17 14:33:00 +12:00
postmaster Introduce a WaitEventSet for the stats collector. 2020-07-30 17:44:28 +12:00
regex Dial back -Wimplicit-fallthrough to level 3 2020-05-13 15:31:14 -04:00
replication walsnd: Don't set waiting_for_ping_response spuriously 2020-08-08 12:31:55 -04:00
rewrite Add missing invocations to object access hooks 2020-05-23 14:03:04 +09:00
snowball code: replace most remaining uses of 'master'. 2020-07-08 13:24:35 -07:00
statistics Run pgindent with new pg_bsd_indent version 2.1.1. 2020-05-16 11:54:51 -04:00
storage Preallocate some DSM space at startup. 2020-07-31 17:49:58 +12:00
tcop Rename field "relkind" to "objtype" for CTAS and ALTER TABLE nodes 2020-07-11 13:32:28 +09:00
tsearch Fix recently-introduced performance problem in ts_headline(). 2020-07-31 11:43:12 -04:00
utils Add %P to log_line_prefix for parallel group leader 2020-08-03 13:38:48 +09:00
.gitignore
common.mk
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00