Skip to content

[db] Add fsync support #1915 - #1916

Merged
michaelvlach merged 4 commits into
mainfrom
1915-db-add-fsync-support
Aug 18, 2026
Merged

[db] Add fsync support #1915#1916
michaelvlach merged 4 commits into
mainfrom
1915-db-add-fsync-support

Conversation

@michaelvlach

Copy link
Copy Markdown
Collaborator

No description provided.

@michaelvlach
michaelvlach requested review from agnesoft and a lite review from Copilot August 18, 2026 09:43
@michaelvlach michaelvlach linked an issue Aug 18, 2026 that may be closed by this pull request
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agdb Ready Ready Preview Aug 18, 2026 10:08am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces explicit durability controls for the agdb storage layer by adding a SyncMode API and exposing synchronization controls on Db, enabling safer operation on filesystems where write ordering/flush behavior can break WAL expectations (e.g., some network filesystems).

Changes:

  • Add SyncMode (default None, optional Commit) and plumb it through StorageData, Storage, and Db (set_sync_mode, sync_mode, sync).
  • Implement commit-time syncing behavior for file-backed storage and add WAL sync support.
  • Add documentation and a regression test covering the new DbFile sync API surface.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
agdb/tests/db_test.rs Adds a test exercising DbFile::{sync,set_sync_mode,sync_mode}.
agdb/src/storage/write_ahead_log.rs Adds WriteAheadLog::sync() to fdatasync the WAL file.
agdb/src/storage/file_storage.rs Introduces sync_mode handling in flush(), adds sync(), and updates WAL-apply behavior.
agdb/src/storage/file_storage_memory_mapped.rs Delegates new sync-related StorageData methods to the underlying FileStorage.
agdb/src/storage/any_storage.rs Plumbs new sync-related StorageData methods through the AnyStorage enum.
agdb/src/storage.rs Defines SyncMode and extends StorageData/Storage with sync-related APIs.
agdb/src/lib.rs Re-exports SyncMode from the crate root.
agdb/src/db.rs Exposes DbImpl::{sync,set_sync_mode,sync_mode} public API.
agdb_web/content/docs/01.guides/01.concepts.md Documents SyncMode and when to enable commit syncing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread agdb/src/storage.rs Outdated
Comment thread agdb/src/storage/file_storage.rs Outdated
Comment thread agdb/src/storage/file_storage.rs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@michaelvlach
michaelvlach merged commit ff8d4cb into main Aug 18, 2026
12 checks passed
@michaelvlach
michaelvlach deleted the 1915-db-add-fsync-support branch August 18, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[db] Add fsync support

3 participants