fix(client): remove cache metadata on free#1003
Merged
Merged
Conversation
Free in cache mode should remove Curvine-side metadata while preserving UFS data. Keep fs mode behavior unchanged.
Master delete already releases worker blocks when removing the inode, so free-then-delete was redundant. Keep UFS untouched by calling cv.delete. Co-authored-by: Cursor <cursoragent@cursor.com>
szbr9486
approved these changes
Jul 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes UnifiedFileSystem::free behavior in cache mode so it removes Curvine-side file metadata (and releases Curvine blocks) while preserving the underlying UFS file. Fs mode behavior remains unchanged (releases Curvine blocks but keeps Curvine metadata).
Changes:
- Update
UnifiedFileSystem::freeto callcv.delete(...)in cache mode (with special handling for the mount root whenrecursive=true), rather than routing tocv.free(...). - Adjust cache-mode regression test to assert Curvine metadata is removed, UFS data remains, and reads still come from UFS after
free. - Ensure cache-mode test mount uses
AccessMode::ReadWrite(the builder defaults toReadOnly, which would block cache-mode write RPCs like create).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| curvine-client/src/unified/unified_filesystem.rs | Implements cache-mode free as Curvine-metadata deletion (without touching UFS) while keeping fs-mode free unchanged. |
| curvine-tests/tests/write_cache_test.rs | Updates/strengthens cache-mode free regression assertions (CV metadata removed, UFS preserved, content still readable). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix cache mode
freeso it removes Curvine-side file metadata while preserving the UFS file. Fs mode behavior remains unchanged: it releases Curvine blocks but keeps metadata.Issue Describe / Design
Related to: None
UnifiedFileSystem::freerouted both cache mode and fs mode toself.cv.free(...), and masterfreeonly clears blocks while preserving inode metadata.free, then checkfs.cv().exists(path).cv.deleteto drop Curvine metadata (and release worker blocks). Masterdeletealready notifies workers viaDeleteResult; a priorcv.freewould only clear locs then delete the inode — redundant. Usecv.delete(notUnifiedFileSystem::delete) so UFS is untouched. Fs mode still usescv.free.Changes
curvine-client/src/unified/unified_filesystem.rsfreeusescv.deleteonly (mount root: recursive delete children).free; fs mode unchanged. CLIfreestats (inodes/space) report 0 in cache mode because delete RPC does not returnFreeResult.curvine-tests/tests/write_cache_test.rsTest verified
make formatcargo test -p curvine-tests --test write_cache_test test_cache_mode_freecargo test -p curvine-tests --test write_cache_test test_fs_mode_freeDependencies