Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi
Date: 2018-09-18 02:42:27
Message-ID: 20180918024227.GI31460@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Sep 18, 2018 at 09:11:43AM +0900, Michael Paquier wrote:
> What I think I broke is that CreateFile ignores what _fmode uses, which
> has caused the breakage, while calling directly open() or fopen() does
> the work. There are also other things assuming that binary mode is
> used, you can grep for "setmode" and see how miscinit.c or pg_basebackup
> do the job.

I have been playing with this stuff, and hacked the attached. Now, while
TAP tests of initdb and pgbench are happy (I can actually see the past
failure as well), pg_dump complains at authentication time when using
plain-text mode when using databases with all ASCII characters. That's
not something I expected first, but _get_fmode also influences
operations like pipe(), which is something that pg_dump uses, and
setmode is enforced to binary mode only when adapted.

I am getting to wonder if what's present on HEAD represents actually the
best deal we could get. Attached is the patch I used for reference.
Thoughts?
--
Michael

Attachment Content-Type Size
win32-open-mode-v1.patch text/x-diff 1.4 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2018-09-18 03:01:54 pgsql: Refactor routines for subscription and publication lookups
Previous Message Michael Paquier 2018-09-18 00:11:43 Re: pgsql: Allow concurrent-safe open() and fopen() in frontend code for Wi

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-09-18 02:47:58 Re: Changing the setting of wal_sender_timeout per standby
Previous Message Kyotaro HORIGUCHI 2018-09-18 02:38:50 Re: Problem while setting the fpw with SIGHUP