Skip to content

feat(sqlite): add deferred commit mode with flush sequencing - #5676

Draft
NathanFlurry wants to merge 1 commit into
sync-sqlitefrom
sqlite-deferred-commits
Draft

feat(sqlite): add deferred commit mode with flush sequencing#5676
NathanFlurry wants to merge 1 commit into
sync-sqlitefrom
sqlite-deferred-commits

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member

Stacked on #5659 (sync-sqlite). Opt-in deferred SQLite commit mode: a commit returns after updating actor-local page state, a background flusher ships pages to the engine in order, and callers wait on a monotonic flush sequence. This is the storage-layer primitive for Durable Object style output gates. Design: docs-internal/engine/sqlite/deferred-commits/SPEC.md.

  • Add CommitMode::Deferred to the native SQLite VFS: committed pages land in a pinned overlay, a single flusher batches and ships them in order with the existing head fence, and commitSeq/flushedSeq/waitForFlush expose durability with snapshot semantics.
  • Keep read-your-own-writes across the overlay, in-flight batch, caches, prefetch, and engine reads.
  • Retry indeterminate commits with a byte-identical resend; a fence mismatch, wrong head, retry deadline, worker-close timeout, or flusher failure breaks the database and stops the actor generation so no waiter can observe a lost write as durable.
  • Bound the overlay with byte backpressure and a hard page cap that drains before merging, stage size-only truncates, and drain the flusher on close.
  • Add sqliteCommitMode actor config, SqliteDb sequence accessors, a database failure channel, sync-call fail-fast on JavaScript-owned transaction leases, and SQLite auto-rollback detection in the transaction coordinator.
  • Expose db({ commitMode }), commitSeq(), flushedSeq(), waitForFlush(), flushError(), executeSyncRaw() with readonly, and a handle-form beginTransactionSync() in the TypeScript client, Drizzle wrapper, NAPI bindings, and runtime interfaces; WebAssembly and remote SQLite reject the mode at actor start.
  • Fix the client action proxy so action.bind(...) is not dispatched as a nested remote action, and unlink the Actor Runtime Socket before joining its listener so a destroyed generation cannot expose its socket path.
  • Add VFS, randomized, coordinator, client unit, and driver tests plus public docs.

Awaited mode is unchanged. The five fault::* compaction tests in rivet-depot-client fail identically on the base branch (in-process engine pubsub "invalid version: 0") and are unrelated.

@railway-app

railway-app Bot commented Sep 6, 2026

Copy link
Copy Markdown

🚅 Deployed to the actors-pr-5676 environment in rivet-frontend

Service Status Web Updated
frontend-cloud 😴 Sleeping (View Logs) Web Sep 8, 2026 at 9:42 am UTC
kitchen-sink 😴 Sleeping (View Logs) Web Sep 8, 2026 at 3:22 am UTC
frontend-inspector 😴 Sleeping (View Logs) Web Sep 8, 2026 at 3:19 am UTC
ladle ✅ Success (View Logs) Web Sep 6, 2026 at 9:08 pm UTC
mcp-hub ✅ Success (View Logs) Web Sep 6, 2026 at 9:07 pm UTC
website ❌ Build Failed (View Logs) Web Sep 6, 2026 at 9:06 pm UTC

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