Try again to work around Windows' ERROR_SHARING_VIOLATION in pg_ctl.
Commit 0da33c76 introduced an unfortunate regression in pg_ctl on Windows: if the log file specified with -l doesn't exist yet, and pg_ctl is running with Administrator privileges, then the log file might get created with permissions that prevent the postmaster from writing on it. (It seems that whether this happens depends on whether the log file is inside the user's home directory or not, and perhaps on other phase-of-the-moon conditions, which may explain why we failed to notice it sooner.) To fix, just don't create the log file if it doesn't exist yet. The case where we need to wait obviously only occurs with a pre-existing log file. In passing, switch from using fopen() to plain open(), saving a few cycles. Per bug #16259 from Jonathan Katz and Heath Lord. Back-patch to v12, as the faulty commit was. Alexander Lakhin Discussion: https://postgr.es/m/16259-c5ebed32a262a8b1@postgresql.org
Showing
Please register or sign in to comment