Skip to content

Add an ordered IndexedDB commit barrier - #182

Closed
jlucaso1 wants to merge 7 commits into
Spxg:masterfrom
jlucaso1:architecture-web-durability
Closed

jlucaso1 wants to merge 7 commits into
Spxg:masterfrom
jlucaso1:architecture-web-durability

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Sep 6, 2026

Copy link
Copy Markdown

Relaxed IndexedDB currently queues SQLite sync notifications without an observable completion. This patch adds an ordered barrier for callers that must confirm backing IndexedDB durability before publishing state.

The implementation retains dirty blocks across failed transactions, snapshots bytes with file and block generations, bounds failure tracking, retries only safe sync failures, and permanently poisons the barrier after destructive delete/clear failures. The browser test utility injects deterministic failures to cover error propagation and recovery ordering.

Validation:

  • cargo fmt --all -- --check
  • cargo check -p sqlite-wasm-vfs --target wasm32-unknown-unknown
  • cargo check --manifest-path tests/Cargo.toml --target wasm32-unknown-unknown --tests
  • Headless Chrome browser suite: 15/15 passed with wasm-bindgen 0.2.128 and ChromeDriver 152

@Spxg

Spxg commented Sep 15, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR, I think I need to spend some time looking into this.

@jlucaso1

Copy link
Copy Markdown
Author

Thanks, take your time

@Spxg

Spxg commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Thanks for working on this! I’ve decided to remove relaxed_idb in the next major release because I’m not comfortable with its durability guarantees for database storage. I appreciate the time and effort you put into it.

You can still implement your own VFS using the traits provided by rsqlite-vfs; it should be fairly straightforward to maintain this implementation separately.

JSPI may also be a better direction: it could let SQLite’s synchronous VFS calls wait for asynchronous storage operations to complete. wasm-bindgen now has experimental JSPI support (https://wasm-bindgen.github.io/wasm-bindgen/reference/jspi.html), so that seems worth exploring.

@jlucaso1

Copy link
Copy Markdown
Author

Wow great. I'll take a look, thank you

@Spxg Spxg closed this Sep 18, 2026
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.

2 participants