refactor(storage): db switch to readonly mode when save failed#13584
refactor(storage): db switch to readonly mode when save failed#13584jerrykingxyz merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c05771b1af
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Refactors the persistent storage transaction layer to improve crash recovery behavior and introduces a “readonly mode” that disables further cache writes after a save failure. It also extends the Node/Rust filesystem bridge to support cp so transactions can copy staged files into the committed store.
Changes:
- Add
cpsupport across the JS filesystem adapters, NAPI typings, and Rust NodeFileSystem binding. - Replace scoped “move” with “copy” for committing staged transaction files, and add
Transaction::ensure_committed()for recovery. - Update DB save flow to rollback on per-bucket save failures and switch DB into readonly mode on save failure.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/util/fs.ts | Extends intermediate FS extra typings with cp. |
| packages/rspack/src/FileSystem.ts | Wires fs.cp into ThreadsafeIntermediateNodeFS and NOOP FS. |
| crates/rspack_storage/src/filesystem/scope_fs.rs | Replaces move_to with copy_to and updates tests accordingly. |
| crates/rspack_storage/src/filesystem/db/transaction/mod.rs | Splits crash recovery into ensure_committed, changes commit to copy, adds rollback. |
| crates/rspack_storage/src/filesystem/db/mod.rs | Adds recovery call on load and readonly mode on save failures. |
| crates/rspack_storage/src/filesystem/db/bucket/pack/generator.rs | Generalizes extend to accept any iterator. |
| crates/rspack_storage/src/filesystem/db/bucket/mod.rs | Simplifies pack generation using iterator-based extend. |
| crates/rspack_fs/src/native_fs.rs | Updates IntermediateFileSystemExtras implementation from rename→copy. |
| crates/rspack_fs/src/memory_fs.rs | Implements copy semantics for the in-memory filesystem. |
| crates/rspack_fs/src/intermediate.rs | Changes IntermediateFileSystemExtras API from rename to copy. |
| crates/rspack_binding_api/src/fs_node/write.rs | Routes Rust-side copy to JS-side cp threadsafe function. |
| crates/rspack_binding_api/src/fs_node/node.rs | Adds cp to the ThreadsafeNodeFS napi object. |
| crates/node_binding/napi-binding.d.ts | Exposes cp in the generated TypeScript definitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merging this PR will not alter performance
Comparing Footnotes
|
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 1.84KB from 49.09MB to 49.09MB (⬇️0.00%) |
|
⏳ Triggered benchmark: Open |
1b06f90 to
58672d9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
58672d9 to
7c418d3
Compare
Summary
Related links
Checklist