postgresql/src/backend
Andres Freund 2e1b4adf39 Remember asking for feedback during walsender shutdown.
Since 5a991ef8 we're explicitly asking for feedback from the receiving
side when shutting down walsender, if there's not yet replicated
data.

Unfortunately we didn't remember (i.e. set waiting_for_ping_response to
true) having asked for feedback, leading to scenarios in which replies
were requested at a high frequency.

I can't reproduce this problem on my laptop, I think that's because the
problem requires a significant TCP window to manifest due to the
!pq_is_send_pending() condition. But since this clearly is a bug, let's
fix it.  There's quite possibly more wrong than just this though.

While fiddling with WalSndDone(), I rewrote a hard to understand comment
about looking at the flush vs. the write position.

Reported-By: Nick Cleaton, Magnus Hagander
Author: Nick Cleaton
Discussion: CAFgz3kus=rC_avEgBV=+hRK5HYJ8vXskJRh8yEAbahJGTzF2VQ@mail.gmail.com
    CABUevExsjROqDcD0A2rnJ6HK6FuKGyewJr3PL12pw85BHFGS2Q@mail.gmail.com
Backpatch: 9.4, were 5a991ef8 introduced the use of feedback messages
    during shutdown.
2016-04-28 22:11:18 -07:00
..
access Fix memory leak and other bugs in ginPlaceToPage() & subroutines. 2016-04-20 14:25:15 -04:00
bootstrap pgindent run for 9.5 2015-05-23 21:35:49 -04:00
catalog Split out pg_operator.h function declarations to new file pg_operator_fn.h. 2016-01-01 13:00:13 -05:00
commands Fix possible crash in ALTER TABLE ... REPLICA IDENTITY USING INDEX. 2016-04-15 12:11:27 -04:00
executor Remove trailing commas in enums. 2016-04-14 19:25:41 -07:00
foreign Code review for foreign/custom join pushdown patch. 2015-05-10 14:36:36 -04:00
lib Avoid use of float arithmetic in bipartite_match.c. 2015-08-23 13:02:19 -04:00
libpq Avoid possibly-unsafe use of Windows' FormatMessage() function. 2016-03-29 11:54:57 -04:00
main Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds 2016-03-10 14:10:32 +01:00
nodes Add defenses against putting expanded objects into Const nodes. 2016-01-21 12:55:59 -05:00
optimizer Fix planner failure with full join in RHS of left join. 2016-04-21 20:05:58 -04:00
parser Fix unexpected side-effects of operator_precedence_warning. 2016-04-21 23:17:36 -04:00
po Translation updates 2016-03-28 08:44:53 +02:00
port Improve TranslateSocketError() to handle more Windows error codes. 2016-04-21 16:58:59 -04:00
postmaster Avoid unlikely data-loss scenarios due to rename() without fsync. 2016-03-09 18:53:53 -08:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:11:52 -05:00
replication Remember asking for feedback during walsender shutdown. 2016-04-28 22:11:18 -07:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:44 -05:00
snowball Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
storage Introduce durable_rename() and durable_link_or_rename(). 2016-03-09 18:53:53 -08:00
tcop Message style improvements 2015-10-28 20:23:53 -04:00
tsearch Fix possible use of uninitialised value in ts_headline() 2016-04-08 21:25:32 +03:00
utils Rename strtoi() to strtoint(). 2016-04-23 16:53:15 -04:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile AIX: Link the postgres executable with -Wl,-brtllib. 2015-07-15 21:00:30 -04:00
nls.mk Translation updates 2015-02-01 23:23:40 -05:00