pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: Ravi Krishna <srkrishna@yahoo.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2
Date: Tue, 19 Feb 2019 11:14:16 +1300
Message-ID: <CAEepm=1Hx+t3O2u+UE9RLC-jvTXp-CLLtdfDfapAGEBk_-0Tsw@mail.gmail.com> (raw)
In-Reply-To: <20190218170148.3brs5tofzbjekwxu@alap3.anarazel.de>
References: <18784.1550250790@sss.pgh.pa.us>
	<653E7ADD-3473-4F6E-B2EB-7FEF494DC5E1@anarazel.de>
	<17265.1550252690@sss.pgh.pa.us>
	<8B8CCA3A-83AF-43BA-A773-9C4160BF866E@anarazel.de>
	<CAEepm=3njGdqCCPRvTGYmdCo3WqDQR6_d86hsiUKY9shDFXU7w@mail.gmail.com>
	<26906.1550332575@sss.pgh.pa.us>
	<CAEepm=1FGo=ACPKRmAxvb53mBwyVC=TDwTE0DMzkWjdbAYw7sw@mail.gmail.com>
	<20190217185454.tqhy2qcldytnllm4@alap3.anarazel.de>
	<20190218011915.GG1864@paquier.xyz>
	<0F72D2E6-642F-4304-9079-17CA08D73A47@yahoo.com>
	<20190218170148.3brs5tofzbjekwxu@alap3.anarazel.de>

On Tue, Feb 19, 2019 at 6:01 AM Andres Freund <andres@anarazel.de> wrote:
> On 2019-02-18 10:33:50 -0500, Ravi Krishna wrote:
> > Are there any plans to support PG on WSL ?  Just curious.

Hi Ravi,

I definitely want to fix this particular issue for 11.3.

> I think if somebody wanted to start investing efforts to improve testing
> of that setup, and then fix the resulting issues, nobody would seriously
> object. But also most people working on PG are already busy.  Please
> feel free to create a buildfarm test machine with postgres running on
> WSL.

Right, the first step would be for a WSL user to figure out what's
wrong with builds on the WSL and show us how to fix it; I heard
through the grapevine that if you try it, initdb doesn't work (it must
be something pretty subtle in the configure phase or something like
that, since the Ubuntu .deb apparently works, except for the issue
reported in this thread).  Then, confirm that they're happy with
whatever patch we come up with.  Then if someone wants to make sure we
don't accidentally break it in future, yeah, a build farm animal would
help a lot.

Here's a starter patch that shows one of the approaches discussed.  It
gets WSL users to a better place than they were before, by suppressing
further warnings after the first one.

-- 
Thomas Munro
http://www.enterprisedb.com

-- 
 <https://postgresvision.com/;
 <https://postgresvision.com/;

Attachments:

0001-Tolerate-ENOSYS-failure-from-sync_file_range.patch (application/octet-stream, 1.9K) download From 940a61dc0650d12d47ba2dbbe6f1cfcc5fa9f09d Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.munro@enterprisedb.com> Date: Tue, 19 Feb 2019 10:47:14 +1300 Subject: [PATCH] Tolerate ENOSYS failure from sync_file_range(). One unintended consequence of commit 9ccdd7f6 was that Windows WSL users now get a PANIC whenever PostgreSQL attempt to start flushing data with sync_file_range(), because Windows does not implement that system call. Previously, it generated a stream of periodic warnings. Prevent that by handling ENOSYS specially to avoid promotion to PANIC, and suppress all attempts after the first. Reported-by: Bruce Klein Discussion: https://postgr.es/m/CA+mCpegfOUph2U4ZADtQT16dfbkjjYNJL1bSTWErsazaFjQW9A@mail.gmail.com --- src/backend/storage/file/fd.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 213de7698a..be3f1e17f1 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -420,6 +420,10 @@ pg_flush_data(int fd, off_t offset, off_t nbytes) #if defined(HAVE_SYNC_FILE_RANGE) { int rc; + static bool not_implemented_by_kernel = false; + + if (not_implemented_by_kernel) + return; /* * sync_file_range(SYNC_FILE_RANGE_WRITE), currently linux specific, @@ -434,7 +438,22 @@ pg_flush_data(int fd, off_t offset, off_t nbytes) SYNC_FILE_RANGE_WRITE); if (rc != 0) { - ereport(data_sync_elevel(WARNING), + int elevel; + + /* + * For systems that don't have an implementation of + * sync_file_range() such as Windows WSL, generate only one + * warning and then suppress all further attempts by this process. + */ + if (rc == ENOSYS) + { + elevel = WARNING; + not_implemented_by_kernel = true; + } + else + elevel = data_sync_elevel(WARNING); + + ereport(elevel, (errcode_for_file_access(), errmsg("could not flush dirty data: %m"))); } -- 2.20.1

view thread (35+ messages)  latest in thread

Message-ID: <CAEepm=1Hx+t3O2u+UE9RLC-jvTXp-CLLtdfDfapAGEBk_-0Tsw@mail.gmail.com>
Permalink:  ../CAEepm=1Hx+t3O2u+UE9RLC-jvTXp-CLLtdfDfapAGEBk_-0Tsw@mail.gmail.com/
Also on:    postgresql.org/message-id/CAEepm=1Hx+t3O2u+UE9RLC-jvTXp-CLLtdfDfapAGEBk_-0Tsw@mail.gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: thomas.munro@enterprisedb.com, andres@anarazel.de, srkrishna@yahoo.com
  Subject: Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2
  In-Reply-To: <CAEepm=1Hx+t3O2u+UE9RLC-jvTXp-CLLtdfDfapAGEBk_-0Tsw@mail.gmail.com>
  References: <18784.1550250790@sss.pgh.pa.us> <653E7ADD-3473-4F6E-B2EB-7FEF494DC5E1@anarazel.de> <17265.1550252690@sss.pgh.pa.us> <8B8CCA3A-83AF-43BA-A773-9C4160BF866E@anarazel.de> <CAEepm=3njGdqCCPRvTGYmdCo3WqDQR6_d86hsiUKY9shDFXU7w@mail.gmail.com> <26906.1550332575@sss.pgh.pa.us> <CAEepm=1FGo=ACPKRmAxvb53mBwyVC=TDwTE0DMzkWjdbAYw7sw@mail.gmail.com> <20190217185454.tqhy2qcldytnllm4@alap3.anarazel.de> <20190218011915.GG1864@paquier.xyz> <0F72D2E6-642F-4304-9079-17CA08D73A47@yahoo.com> <20190218170148.3brs5tofzbjekwxu@alap3.anarazel.de> <CAEepm=1Hx+t3O2u+UE9RLC-jvTXp-CLLtdfDfapAGEBk_-0Tsw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox