Skip to content

Add VersionedAVLStorage::flush() for durable commits on demand#11

Open
mwaddip wants to merge 1 commit into
ergoplatform:mainfrom
mwaddip:feat/versioned-storage-flush
Open

Add VersionedAVLStorage::flush() for durable commits on demand#11
mwaddip wants to merge 1 commit into
ergoplatform:mainfrom
mwaddip:feat/versioned-storage-flush

Conversation

@mwaddip

@mwaddip mwaddip commented Apr 14, 2026

Copy link
Copy Markdown

Adds a default-no-op flush() method to VersionedAVLStorage so callers can force a durable commit. Storages with deferred writes (e.g. redb Durability::None) lose state on graceful shutdown without an explicit fsync — reopen sees no valid commit.

Default no-op keeps existing impls unaffected; deferred-write impls override.

Adds a default-no-op method on the storage trait so callers can force a
durable commit (fsync) of outstanding writes. Implementations using
deferred writes (e.g. redb Durability::None) should override this to
fsync the backing store. In-memory or always-durable storages can keep
the default no-op.

Motivation: PersistentBatchAVLProver::generate_proof_and_update_storage
uses non-durable writes for throughput. Without a caller-triggered flush,
graceful SIGTERM leaves uncommitted state pending; on reopen, redb sees
no valid commit and treats the storage as empty. Periodic flush calls
bound crash data loss.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant