Replication to Postgres 10 on Windows is broken

Augustine, Jobin <jobin.augustine@openscg.com>

From: "Augustine, Jobin" <jobin.augustine@openscg.com>
To: pgsql-bugs@postgresql.org
Date: 2017-08-04T05:53:43Z
Lists: pgsql-bugs, pgsql-hackers
*Summary:*
Replica / Slave on Windows fails to conenct to Master.

*Scenario:*
Master: PostgreSQL 10 (beta1,beta2), Any OS (Linux, Windows, Mac)
Slave : PostgreSQL 10 (beta1,beta2), Windows (Any MS Windows OS)
Slave must be on Windows Machine running on a different server than the
Master


*Steps to reproduce:*
1. Setup a Postgres 10betaX master database can be on any platform
(Linux/Windows/Mac)
2. Try to setup a streaming replica on any of the MS Windows running a
different Server than the master
    (replication within the same server works!)


*Error in Postgres logs:*
Lines like below keep repeating in Slave side postgres log
----------------------
2017-08-03 10:49:41 UTC [2108]: [1-1] user=,db=,app=,client= FATAL:  could
not connect to the primary server: could not send data to server: Socket is
not connected (0x00002749/10057)
    could not send SSL negotiation packet: Socket is not connected
(0x00002749/10057)
2017-08-03 10:49:45 UTC [3600]: [1-1] user=,db=,app=,client= FATAL:  could
not connect to the primary server: could not send data to server: Socket is
not connected (0x00002749/10057)
    could not send SSL negotiation packet: Socket is not connected
(0x00002749/10057)
2017-08-03 10:49:50 UTC [4832]: [1-1] user=,db=,app=,client= FATAL:  could
not connect to the primary server: could not send data to server: Socket is
not connected (0x00002749/10057)
    could not send SSL negotiation packet: Socket is not connected
(0x00002749/10057)
-------------------------

*Additional Information:*
Stand alone tools like psql, pg_basebackup, pg_recivewal etc  are
successful in connecting to primary server and perform their
functionalities.
Postgres 9.6 replication works fine across same set of servers.
This Windows specific issue reproducible across pg10beta1 and beta2
This is tested and confirmed by multiple people from my team across
different Windows versions.


-Jobin Augustine

Commits

  1. Distinguish wait-for-connection from wait-for-write-ready on Windows.

  2. Use asynchronous connect API in libpqwalreceiver