[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LMDB crash after power failure
- To: Abilio Marques <abiliojr@gmail.com>, openldap-technical@openldap.org
- Subject: Re: LMDB crash after power failure
- From: Howard Chu <hyc@symas.com>
- Date: Sun, 24 Mar 2019 04:46:53 +0000
- In-reply-to: <CAEWqYrXD6UZddge7g7b=A=m34DiQ0HD0a4RG7XoyCP-fhK-DAg@mail.gmail.com>
- References: <CAEWqYrXD6UZddge7g7b=A=m34DiQ0HD0a4RG7XoyCP-fhK-DAg@mail.gmail.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 SeaMonkey/2.53
Abilio Marques wrote:
> Hello,
>
> I've successfully ported a particular piece of software from multiple plain files in disk to LMDB. There were multiple reasons to do so (i.e., performance and
> maintenance).
>
> The program is making individual calls to a storage API, that in turn creates files or reads them (through a cache). There is no concept of transaction. For
> performance and lifetime reasons, the original code avoids to perform a fsync every time it writes to a file by queuing renames (for atomic writes) and deletes,
> which in turn are executed by a background thread after 2 seconds idling (or a max of 15 sec after first write/delete).
>
> Replacing such a monster "files + cache" with LMDB was a breeze. I kept the API intact, and to deal with the price of fsyncs, I thought of opening with
> MDB_NOSYNC, and sync after 2 seconds of inactivity.
As documented, MDB_NOSYNC is only safe for power failure if the filesystem guarantees that it preserves the order of writes.
Otherwise all bets are off.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/