Re: Loaded footgun open_datasync on Windows

From: Noah Misch <noah(at)leadboat(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Loaded footgun open_datasync on Windows
Date: 2018-09-02 00:07:21
Message-ID: 20180902000721.GA1794193@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 27, 2018 at 12:09:24PM +0200, Laurenz Albe wrote:
> Michael Paquier wrote:
> > > I have added it to the July commitfest.
> >
> > Have you looked at the possibility of removing the log file constraints
> > in pg_upgrade with the change you are doing here so as things would be
> > more consistent with non-Windows platforms, simplifying some code on the
> > way?
>
> Can you explain what the "log file constraints" are?
> If it is in any way related, and I can handle it, sure.

See this comment in pg_upgrade.h:

/*
* WIN32 files do not accept writes from multiple processes
*
* On Win32, we can't send both pg_upgrade output and command output to the
* same file because we get the error: "The process cannot access the file
* because it is being used by another process." so send the pg_ctl
* command-line output to a new file, rather than into the server log file.
* Ideally we could use UTILITY_LOG_FILE for this, but some Windows platforms
* keep the pg_ctl output file open by the running postmaster, even after
* pg_ctl exits.
*
* We could use the Windows pgwin32_open() flags to allow shared file
* writes but is unclear how all other tools would use those flags, so
* we just avoid it and log a little differently on Windows; we adjust
* the error message appropriately.
*/

If you grep src/bin/pg_upgrade for WIN32, roughly a third of the hits are
workarounds for this problem. I agree with Michael that removing those
workarounds would be a good test of frontend pgwin32_open() and worth
including in the initial commit.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-09-02 03:04:20 Re: pread() and pwrite()
Previous Message Michael Paquier 2018-09-01 23:19:00 Re: pg_verify_checksums and -fno-strict-aliasing