Re: Postgres, fsync, and OSs (specifically linux) - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: Postgres, fsync, and OSs (specifically linux)
Date
Msg-id CAMsr+YGhFKq1LcabtY61YQtweF7bvp7krYZkCJhXw_JAoa=dvg@mail.gmail.com
Whole thread Raw
In response to Re: Postgres, fsync, and OSs (specifically linux)  (Andres Freund <andres@anarazel.de>)
Responses Re: Postgres, fsync, and OSs (specifically linux)  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
On 18 May 2018 at 00:44, Andres Freund <andres@anarazel.de> wrote:
Hi,

On 2018-05-10 09:50:03 +0800, Craig Ringer wrote:
>       while ((src = (RewriteMappingFile *) hash_seq_search(&seq_status)) != NULL)
>       {
>               if (FileSync(src->vfd, WAIT_EVENT_LOGICAL_REWRITE_SYNC) != 0)
> -                     ereport(ERROR,
> +                     ereport(PANIC,
>                                       (errcode_for_file_access(),
>                                        errmsg("could not fsync file \"%s\": %m", src->path)));

To me this (and the other callers) doesn't quite look right. First, I
think we should probably be a bit more restrictive about when PANIC
out. It seems like we should PANIC on ENOSPC and EIO, but possibly not
others.  Secondly, I think we should centralize the error handling. It
seems likely that we'll acrue some platform specific workarounds, and I
don't want to copy that knowledge everywhere.

Also, don't we need the same on close()?


Yes, we do, and that expands the scope a bit.

I agree with Robert that some sort of filter/macro is wise, though naming it clearly will be tricky.

I'll have a look.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: Postgres, fsync, and OSs (specifically linux)
Next
From: Ashutosh Bapat
Date:
Subject: Re: [HACKERS] Transactions involving multiple postgres foreign servers