I noticed the commit and had a question and a comment. There is a small problem in func.sgml in the sentence "After that the changes made of primary". Should be "on primary".
In the for loop in WaitForLSNReplay, shouldn't the check for in-recovery be moved up above the call to GetXLogReplayRecPtr? If we get promoted while waiting for the timeout we could call GetXLogReplayRecPtr while not in recovery. Thanks, Kevin.