8000 Close-time save ignores wal_checkpoint_threshold(usize::MAX) · Issue #476 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

Close-time save ignores wal_checkpoint_threshold(usize::MAX) #476

Closed

Description

@adityamukho

Problem

The SyncMode::Normal docs (src/db.rs) say that wal_checkpoint_threshold(usize::MAX) means "no per-write flush, no auto-checkpoint, and no close-time checkpoint (the same sentinel also suppresses that)".

Inner::drop does skip its checkpoint for that sentinel. But PersistentFactStorage::drop (src/storage/persistent_facts.rs) calls save() whenever the storage is dirty, so closing the handle still writes every pending fact to the .graph file. The WAL is left next to it, and all of its entries are already checkpointed.

Reproduce

let o = || OpenOptions::new()
    .synchronous(SyncMode::Normal)
    .wal_checkpoint_threshold(usize::MAX);
{
    let db = Minigraf::open_with_options(&p, o()).unwrap();
    db.execute("(transact [[:e0 :a0 1]])").unwrap();
    db.execute("(transact [[:e0 :a0 2]])").unwrap();
} // drop
// On reopen, replay_wal sees last_checkpointed_tx_count = 2, so the drop saved.

Decide

Either:

Found while writing the #385 model-based test. Its Crash step copies the files while the handle is open, because a drop cannot leave a WAL to replay.

Activity

  1. added this to the v3.0.0 milestone on Oct 7, 2026
  2. added
    bugSomething isn't working
    documentationImprovements or additions to documentation
    rustPull requests that update rust code
    on Oct 7, 2026
  3. added 2 commits that reference this issue on Oct 10, 2026
  4. adityamukho commented on Oct 10, 2026

    @adityamukho
    CollaboratorAuthor

    Fixed on v3 by #526 (bc7a6b6).

  5. added 2 commits that reference this issue on Oct 11, 2026
  6. adityamukho commented on Oct 11, 2026

    @adityamukho
    CollaboratorAuthor

    Backported to v2.x in #540 (merged to main, 99410b1); ships in the next v2.x patch release.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0