Make logical WAL sender report streaming state appropriately
Make logical WAL sender report streaming state appropriately

WAL senders sending logically-decoded data fail to properly report in
"streaming" state when starting up, hence as long as one extra record is
not replayed, such WAL senders would remain in a "catchup" state, which
is inconsistent with the physical cousin.

This can be easily reproduced by for example using pg_recvlogical and
restarting the upstream server.  The TAP tests have been slightly
modified to detect the failure and strengthened so as future tests also
make sure that a node is in streaming state when waiting for its
catchup.

Backpatch down to 9.4 where this code has been introduced.

Reported-by: Sawada Masahiko
Author: Simon Riggs, Sawada Masahiko
Reviewed-by: Petr Jelinek, Michael Paquier, Vaishnavi Prabakaran
Discussion: c0186d272016c0b062db775a737b9cfa7c601d20@mail.gmail.com

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