Re: Intermittent pg_ctl failures on Windows

r.zharkov@postgrespro.ru

From: Жарков Роман <r.zharkov@postgrespro.ru>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Badrul Chowdhury <bachow@microsoft.com>, pgsql-hackers@lists.postgresql.org
Date: 2019-07-18T07:04:34Z
Lists: pgsql-hackers

Attachments

Hello,

Therefore, we suggest replace the deletion of a lock file by renaming it.
unlink in windows is not an atomic operation.
When we try to open the file between 
SetDispositionInformationFile and CloseFile we get ERROR_DELETE_PENDING ( see screenshot )

Commits

  1. Allow concurrent-safe open() and fopen() in frontend code for Windows

  2. Change pg_ctl to detect server-ready by watching status in postmaster.pid.