Re: Potential data loss of 2PC files

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Potential data loss of 2PC files
Date: 2016-12-23 01:27:14
Message-ID: CAB7nPqTBs53+HnvBP2Z7wEwCbEmap0Sk0y-5qE_gHVwgz+e6YA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 23, 2016 at 6:33 AM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:
> On 12/22/16 12:02 PM, Andres Freund wrote:
>>
>>
>> On December 22, 2016 6:44:22 PM GMT+01:00, Robert Haas
>> <robertmhaas(at)gmail(dot)com> wrote:
>>>
>>> On Thu, Dec 22, 2016 at 12:39 PM, Andres Freund <andres(at)anarazel(dot)de>
>>> wrote:
>>>>
>>>> It makes more sense of you mentally separate between filename(s) and
>>>
>>> file contents. Having to do filesystem metatata transactions for an
>>> fsync intended to sync contents would be annoying...
>>>
>>> I thought that's why there's fdatasync.
>>
>> Not quite IIRC: that doesn't deal with file size increase. All this would
>> be easier if hardlinks wouldn't exist IIUC. It's basically a question
>> whether dentry, inode or contents need to be synced. Yes, it sucks.
>
>
> IIRC this isn't the first time we've run into this problem... should
> pg_fsync() automatically fsync the directory as well? I guess we'd need a
> flag to disable that for performance critical areas where we know we don't
> need it (presumably just certain WAL fsyncs).

I am not sure if that would be performance-wise. The case of the 2PC
files is quite special anyway as just doing the sync at checkpoint
phase for everything would be enough.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2016-12-23 01:44:39 Re: varlena beyond 1GB and matrix
Previous Message Amit Kapila 2016-12-23 01:10:04 Re: Write Ahead Logging for Hash Indexes