Add durable echo-cas disk tier#619
Conversation
|
Warning Review limit reached
More reviews will be available in 41 minutes and 56 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Lawyer update
Validation highlights:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 787dd8eee3
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fs::rename(&temp_path, &path).map_err(|source| { | ||
| let _ = fs::remove_file(&temp_path); | ||
| DiskTierError::io("rename", &path, source) | ||
| })?; |
There was a problem hiding this comment.
Preserve idempotent puts when the blob file exists
On Windows, std::fs::rename fails if the destination file already exists, so a second put/put_verified for bytes that are already retained returns DiskTierError::Io instead of remaining CAS-idempotent. This affects retry/reopen paths and concurrent same-blob writes; short-circuit an existing verified blob or use platform-safe replacement handling before renaming.
Useful? React with 👍 / 👎.
| fs::write(&temp_path, bytes) | ||
| .map_err(|source| DiskTierError::io("write", &temp_path, source))?; | ||
| fs::rename(&temp_path, &path).map_err(|source| { |
There was a problem hiding this comment.
Sync writes before acknowledging durability
When callers rely on DiskTier as a durable retained-blob tier, returning Ok after fs::write and rename without syncing means a power loss or OS crash can lose the blob or leave an incomplete file even though the write was acknowledged. The write path should sync the temp file before the rename and sync the containing directory after it so crash recovery matches the successful return.
Useful? React with 👍 / 👎.
| let root = root.as_ref().to_path_buf(); | ||
| let blobs_dir = root.join("blobs"); | ||
| fs::create_dir_all(&blobs_dir) |
There was a problem hiding this comment.
Anchor relative roots when opening the tier
When callers open a relative root such as DiskTier::open("cas") and a CLI/test later changes the process current directory, the stored root/blobs_dir paths start resolving against the new cwd, so get/list can report retained blobs as missing or put can create a second store elsewhere. Since open already creates the directory, canonicalize the root at open time so the handle stays bound to the directory it opened.
Useful? React with 👍 / 👎.
Summary
DiskTierfor durable retained blobs inecho-cas.DiskTierErrorinstead of forcing the current infallibleBlobStoretrait.disk_tiertests for process reconstruction, verified-write mismatch non-mutation, missing-as-absence, sorted listing, and stale temp-file tolerance.echo-casdocs and changelog signposts for the new durable tier.Closes #570.
Validation
cargo test -p echo-cas disk_tiercargo clippy -p echo-cas --all-targets -- -D warningscargo test -p echo-casRUSTDOCFLAGS='-D warnings' cargo doc -p echo-cas --no-depsnpx markdownlint-cli2 CHANGELOG.md crates/echo-cas/README.mdgit diff --checkcargo clippy -p echo-cas --lib --testscargo check -p echo-cascargo test -p echo-cas --test disk_tierAPI note
DiskTierintentionally exposes fallible methods directly instead of implementingBlobStore: the current trait cannot return filesystem errors fromputorget, and this tier should not hide I/O failures behind content-addressed absence.