Remember asking for feedback during walsender shutdown.
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: b167db2e99c6fd072dae88d65300d370236c0bee@mail.gmail.com
    CABUevExsjROqDcD0A2rnJ6HK6FuKGyewJr3PL12pw85BHFGS2Q@mail.gmail.com
Backpatch: 9.4, were 5a991ef8 introduced the use of feedback messages
    during shutdown.

50wu/gpdb,50wu/gpdb,greenplum-db/gpdb,adam8157/gpdb,adam8157/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,lisakowen/gpdb,greenplum-db/gpdb,adam8157/gpdb,50wu/gpdb,lisakowen/gpdb,lisakowen/gpdb,greenplum-db/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,adam8157/gpdb,xinzweb/gpdb,ashwinstar/gpdb,xinzweb/gpdb,lisakowen/gpdb,50wu/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,50wu/gpdb,adam8157/gpdb,xinzweb/gpdb,adam8157/gpdb,greenplum-db/gpdb,adam8157/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,lisakowen/gpdb,xinzweb/gpdb,ashwinstar/gpdb,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,lisakowen/gpdb,50wu/gpdb,lisakowen/gpdb