Skip to content

[doc] Clarify meaning of "crash" in transaction consistency guarantee #281

Closed

Description

@drake2020li

Hi, thanks for your great work on libmdbx!

I have a question regarding the documentation, specifically this part:

"1,000,000 transactions in async-write mode. In case of a crash all data is consistent and conforms to the one of last successful transactions, but lost transaction count is much higher than in lazy-write mode. All DB engines in this mode do as little writes as possible on persistent storage. libmdbx uses msync(MS_ASYNC) in this mode."

Could you clarify what exactly is meant by "crash" in this context? Do you mean:

  1. A process crash (e.g., the database process is terminated unexpectedly)?
  2. A system crash (e.g., OS kernel panic or power loss)?

I ask because libmdbx in this mode uses msync(MS_ASYNC), which (as I understand it) ensures data is passed to the kernel page cache but does not guarantee it is flushed to persistent storage immediately. So in the case of a process crash, the data should still be safe, but in the case of a system crash or power failure, data loss could occur unless a stronger sync is used.

Could you confirm whether the "crash" here includes system-level crashes, or if it's limited to process-level failures?

Thanks a lot in advance!

Activity

  1. erthink commented on May 10, 2025

    @erthink
    Collaborator

    I agree, the paragraph should be rewritten (it looks like some kind of not-a-good machine translation option has been preserved).

    For now, please see the SYNC MODES and subordinary references, especially for MDBX_SAFE_NOSYNC and MDBX_UTTERLY_NOSYNC.

  2. self-assigned this
    on May 10, 2025
  3. erthink commented on May 12, 2025

    @erthink
    Collaborator

    After thinking about it, I decided to give an explanation, as apparently it's time to remove some information from the README due to obsolescence.

    Most (or all) of slides that now within REAME was created/prepared about of 10 year ago for Highload++ conference. At that time, libmdbx differed relatively little from LMDB. The current version of libmdbx offers/supports a different set of sync-to-disk modes, so the slide descriptions are somewhat outdated.

    Could you confirm whether the "crash" here includes system-level crashes, or if it's limited to process-level failures?

    The noted "crash" mean a system crash (e.g. OS kernel panic or power loss), and your understanding is correct.

  4. added a commit that references this issue on Aug 15, 2026
  5. erthink commented on Aug 15, 2026

    @erthink
    Collaborator

    This topic has been included in the FAQ, and AI has already collected all the facts and explanations related to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions