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

From Ashutosh Bapat
Subject Re: Postgres, fsync, and OSs (specifically linux)
Date
Msg-id CAFjFpRco+fapy2383raQhzNJRpVivEcSxFBxL5M-4YJZ8T-wbg@mail.gmail.com
Whole thread Raw
In response to Re: Postgres, fsync, and OSs (specifically linux)  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Postgres, fsync, and OSs (specifically linux)  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Thu, May 17, 2018 at 11:45 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, May 17, 2018 at 12:44 PM, 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.
>
> Maybe something like:
>
> ereport(promote_eio_to_panic(ERROR), ...)

Well, searching for places where error is reported with level PANIC,
using word PANIC would miss these instances. People will have to
remember to search with promote_eio_to_panic. May be handle the errors
inside FileSync() itself or a wrapper around that.

-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: pg_control read error message
Next
From: Bruce Momjian
Date:
Subject: Re: SCRAM with channel binding downgrade attack