Skip to content

fix(client): remove cache metadata on free#1003

Merged
szbr9486 merged 2 commits into
mainfrom
curvine-libsdk
Jul 14, 2026
Merged

fix(client): remove cache metadata on free#1003
szbr9486 merged 2 commits into
mainfrom
curvine-libsdk

Conversation

@lzjqsdd

@lzjqsdd lzjqsdd commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Fix cache mode free so 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

  • Root cause: UnifiedFileSystem::free routed both cache mode and fs mode to self.cv.free(...), and master free only clears blocks while preserving inode metadata.
  • Reproduction steps: create/cache a file under cache mode, run free, then check fs.cv().exists(path).
  • Fix approach: in cache mode, call cv.delete to drop Curvine metadata (and release worker blocks). Master delete already notifies workers via DeleteResult; a prior cv.free would only clear locs then delete the inode — redundant. Use cv.delete (not UnifiedFileSystem::delete) so UFS is untouched. Fs mode still uses cv.free.

Changes

Module / File Change Impact on existing behavior
curvine-client/src/unified/unified_filesystem.rs Cache mode free uses cv.delete only (mount root: recursive delete children). Behavior change only for cache mode free; fs mode unchanged. CLI free stats (inodes/space) report 0 in cache mode because delete RPC does not return FreeResult.
curvine-tests/tests/write_cache_test.rs Update cache mode regression test to assert Curvine metadata is gone, UFS data remains readable. Test coverage only.

Test verified

Test case Result Notes
make format PASS Previous run on this branch.
cargo test -p curvine-tests --test write_cache_test test_cache_mode_free PASS Previous run on this branch; local re-run not required for this simplification.
cargo test -p curvine-tests --test write_cache_test test_fs_mode_free PASS Fs mode path unchanged.

Dependencies

  • Related PRs: None
  • Related issues: None
  • Blocks / blocked by: None

lzjqsdd and others added 2 commits July 7, 2026 11:19
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>
@lzjqsdd
lzjqsdd marked this pull request as ready for review July 14, 2026 14:26
Copilot AI review requested due to automatic review settings July 14, 2026 14:26
@szbr9486
szbr9486 merged commit 01ea2ce into main Jul 14, 2026
13 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::free to call cv.delete(...) in cache mode (with special handling for the mount root when recursive=true), rather than routing to cv.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 to ReadOnly, 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.

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.

3 participants