Re: Potential data loss of 2PC files

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
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: 2017-03-21 15:46:45
Message-ID: 1ba0a71a-0821-5003-8b8c-5bd7c8abc3e7@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>> If that can happen, don't we have the same problem in many other places?
>>> Like, all the SLRUs? They don't fsync the directory either.
>> Right, pg_commit_ts and pg_clog enter in this category.
>
> Implemented as attached.
>
>>> Is unlink() guaranteed to be durable, without fsyncing the directory? If
>>> not, then we need to fsync() the directory even if there are no files in it
>>> at the moment, because some might've been removed earlier in the checkpoint
>>> cycle.

What is protection if pg crashes after unlimk() but before fsync()? Right, it's
rather small window for such scenario, but isn't better to have another
protection? Like WAL-logging of WAL segment removing...

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-03-21 16:10:06 Re: Patch: Write Amplification Reduction Method (WARM)
Previous Message David Steele 2017-03-21 15:45:54 Re: [PATCH] kNN for SP-GiST