[Store] Initialize file-per-key storage with eviction disabled#2986
[Store] Initialize file-per-key storage with eviction disabled#2986feichai0017 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the offloading initialization and state handling in the storage backend. Specifically, it refreshes the local offloading state in FileStorage::Init() after the metadata scan, returns false instead of an internal error in IsEnableOffloading() when metadata has not yet been scanned, and adds a check in BatchOffload to reject offloading if it is disabled. Additionally, corresponding unit tests have been updated and added to verify initialization behavior when eviction is disabled. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
he-yufeng
left a comment
There was a problem hiding this comment.
The direction is right: treating "metadata not scanned yet" as a hard INTERNAL_ERROR was too aggressive for a backend that only knows its quota after the initial scan, so mounting conservatively-disabled and refreshing after the scan in Init() is a cleaner startup contract. Two things worth a look before merge.
1. IsEnableOffloading() now collapses two distinct states into false. Before, "not scanned yet" surfaced as an error, distinct from a genuine "offloading is disabled". After this change both return false, so a caller can no longer tell "not ready yet, retry later" from "the operator turned offloading off". For the two callers here that's fine — BatchOffload rejects either way, and Init() calls it only after ScanMeta has set meta_scanned_ — but the method is virtual with several overrides and is also read on the heartbeat path (file_storage.cpp:326, which still logs an error branch). Worth confirming no consumer relied on the error to mean "startup incomplete" rather than "disabled by config", since that signal is now gone.
2. KEYS_ULTRA_LIMIT is a confusing code for "disabled". When offloading is off, BatchOffload returns ErrorCode::KEYS_ULTRA_LIMIT, which reads as "the key/size cap was hit" — a capacity condition — rather than "offloading isn't enabled". A caller (or someone reading logs) could easily misdiagnose a disabled backend as a full one. If there's an OFFLOAD_DISABLED-style code (or room to add one) it would make the rejection self-explanatory; at minimum a one-line comment at the return site would help.
Neither blocks the fix. #1 is the one I'd most like confirmed, since the lost distinction is easy to depend on implicitly on the heartbeat/startup path.
|
@he-yufeng Thanks for flagging both points. 7b3f646 now reports the pre-scan state as |
Description
Fixes #2981.
BatchOffload().Module
mooncake-store)Type of Change
How Has This Been Tested?
Test commands:
Test results (Ubuntu):
storage_backend_test: 72/72;file_storage_test: 24/24)Checklist
./scripts/code_format.shpre-commit run --all-filesand all hooks pass (touched-file hooks pass)AI Assistance Disclosure