Repository navigation
[Store] Remove redundant per-file deletion delay - #3758
Conversation
There was a problem hiding this comment.
Pull request overview
Removes a fixed delay in StorageBackend::RemoveFile() that previously added latency without providing stronger ordering guarantees, relying instead on the existing striped per-path mutex for serialization with StoreObject(). Adds a regression test to validate concurrent store/remove behavior on the same path.
Changes:
- Removed the 50µs sleep in
StorageBackend::RemoveFile()and documented the intended serialization behavior via the striped path lock. - Added a concurrent store/remove regression test that races both operations repeatedly and asserts outcomes are either a fully-written file or no file.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mooncake-store/src/storage_backend.cpp | Removes the timing-based deletion delay and documents lock-based serialization in RemoveFile(). |
| mooncake-store/tests/storage_backend_test.cpp | Adds a regression test that races StoreObject() and RemoveFile() on the same path to prevent partial-file outcomes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| StorageBackend backend(data_path, "unused", false); | ||
| const std::string value(256 * 1024, 'x'); |
There was a problem hiding this comment.
Addressed in c6f30d80bd4f8e9615e5789b7e8eedcec72b5a58: the test now calls ASSERT_TRUE(backend.Init(0)) before using the backend. I also replaced the probabilistic post-join assertion with a deterministic FIFO barrier inside the store write critical section. The test verifies that RemoveFile remains blocked until the writer is released.
|
The change looks correct: the 50 µs sleep predates the striped path lock and provides no ordering guarantee, while Two non-blocking test suggestions:
|
|
@fcczzz Thanks for the review. I addressed both suggestions in
Validation:
|
Description
StorageBackend::RemoveFile()currently sleeps for 50 microseconds before acquiring its striped path mutex.StoreObject()already holds that same mutex across file creation, the complete write, and eviction-queue insertion, so acquiring the mutex serializes deletion with those operations. The fixed sleep adds latency without providing an additional ordering guarantee.This change removes the delay and adds a concurrent store/remove regression test. The test races both operations on the same path 100 times and verifies that the final state is either a complete file or no file, never a partial file.
On a local ext4 Samsung SSD 870, deleting 10,000 one-byte file-per-key objects sequentially improved as follows over seven fresh-file runs (file creation excluded from timing):
main(a11f54e5)The median bulk-removal time decreased by 91.33% (11.53x). This benchmark covers the single-threaded local POSIX file-per-key path; it does not measure network or GPU transfer performance.
Module
mooncake-transfer-engine)mooncake-store)mooncake-reshard)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Test commands:
Test results:
The focused test passed 10/10 runs (1,000 total writer/remover races). The full binaries passed all three repetitions: 101/101
storage_backend_test, 18/18file_storage_test, and 15/15offload_on_evict_testper repetition.Checklist
./scripts/code_format.shThe changed-line formatting script (LLVM 20), direct codespell,
git diff --check, and EOF checks pass. The complete pre-commit wrapper did not finish because its Python 3.14 first-run hook environment setup stalled locally; this box remains intentionally unchecked until it is rerun successfully in a compatible environment.AI Assistance Disclosure
OpenAI Codex was used to inspect the synchronization path, screen open issues and PRs for semantic overlap, prepare the focused test and benchmark, and draft this description. The human submitter reviewed every changed line and is responsible for the change.