Commit Graph

41 Commits

Author SHA1 Message Date
LZW a953dcb110
[Store] Propagate tenant identity through object RPCs (#2288) 2026-06-02 14:14:24 +08:00
Aoi 6cd60d6516
[TE][Store] Fix IPv6 address parsing in connection endpoints (#2184) 2026-06-01 15:27:08 +08:00
LZW daeef0053d
[Store] Implement tenant metadata map isolation (#2232) 2026-05-29 19:08:05 +08:00
CAICAII 06ae8dd018
[Store] Add opt-in grouped object routing semantics (#2180) 2026-05-27 13:15:57 +08:00
Aoi cb032b24d6
[Build] Fix compile warnings across multiple components (#2193)
- mooncake-transfer-engine: add parentheses around && within ||, add
  static_cast for narrowing, mark unused function [[maybe_unused]]
- mooncake-store: fix member reorder warnings, add std::ignore for
  unused results, fix missing field initializers, mark unused variables
- mooncake-integration: fix sign-compare comparison, mark unused
  functions [[maybe_unused]]
- All fixes are semantic-preserving (no behavior changes)
2026-05-26 12:28:53 +08:00
zhuwentao 076e3eaa5b
feat(store): add NoF segment metadata management (#2143)
Co-authored-by: Enigmo-x <guotaowei4@huawei.com>
2026-05-21 11:20:52 +08:00
LZW be93707047
[Store] feat: add graceful segment unmount APIs (#2065) 2026-05-16 18:21:22 +08:00
Xuchun Shang e8e8e05d55
feat(store): expose drain job control via master HTTP API (#1815)
* feat(store): expose drain job control via master HTTP API

 Add Phase 1 drain control-plane endpoints on Master HTTP server, keep
 client-side task fetch execution unchanged, and add C++/Python end-to-end
 verification for drain flow and segment state transitions.

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* update

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

---------

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>
2026-04-09 14:33:45 +08:00
fatSheep 7d0978b9ca
[Store] Add Upsert API for in-place object updates (#1662)
Co-authored-by: fatSheep <tzh2005t@gmail.com>
2026-04-03 10:24:37 +08:00
Yufeng He 4c19802458
[Store] Add hard pin mechanism for eviction-protected objects (#1728)
* [Store] Add hard pin mechanism for eviction-protected objects

Objects created with ReplicateConfig.with_hard_pin=true are never
evicted by the eviction policy, providing guaranteed persistence
for model weights in RL and model management workloads.

Changes:
- ReplicateConfig: add with_hard_pin field (default false)
- ObjectMetadata: add hard_pinned boolean, set at creation via PutStart
- BatchEvict: skip hard-pinned objects in all eviction passes
- Serialization: persist hard_pinned in snapshots (backward compatible
  with old format that lacks the field)
- Tests: verify hard-pinned objects survive eviction, coexist with
  soft pin, and can still be explicitly removed
2026-03-25 17:41:40 +08:00
Xuchun Shang 47633c4661
[Store] Add force remove option for remove api (#1425) 2026-01-29 10:31:35 +08:00
tang b6743066f6
[Store] fix issue that the preferred segments not working when put (#1360) 2026-01-13 17:10:43 +08:00
tang 086f1e6821
[Store][Feature]: add copy/move execution api support in master side (#1327)
* [Store]: Add AllocateFrom to allocate replica from specified segment

Signed-off-by: Chen Jinlong <chenjinlong.cjl@alibaba-inc.com>

* [Store]: Add Move/Copy interfaces

* [Store]: Refactored ObjectMetadata replica management

* [Store]: Rename Replica::get_segment_names to get_segment_name

* [Store]: Support Copy and Move in Master Service

* [Store]: Add metrics for copy/move start/end/revoke

Signed-off-by: Chen Jinlong <chenjinlong.cjl@alibaba-inc.com>

* [Store]: Add RPC interfaces for copy/move start/end/revoke

* [Store]: Improved ObjectMetadata replica management

Signed-off-by: Chen Jinlong <chenjinlong.cjl@alibaba-inc.com>

* [Store]: Also return source replica descriptor in Copy/MoveStart

* [Store]: Make sure to discard expired operations

* [Store]: fix format error

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* [Store]: Add const version of ObjectMetadata::VisitReplicas

Signed-off-by: Jinlong Chen <chenjinlong.cjl@alibaba-inc.com>

* [Store] fix the merge error

* Fix format problems

* Revert "[Store]: Rename Replica::get_segment_names to get_segment_name"

This reverts commit 672d751ea4.

* Make ObjectMetadata::replicas_ private

---------

Signed-off-by: Chen Jinlong <chenjinlong.cjl@alibaba-inc.com>
Signed-off-by: Jinlong Chen <chenjinlong.cjl@alibaba-inc.com>
Co-authored-by: Chen Jinlong <chenjinlong.cjl@alibaba-inc.com>
Co-authored-by: Jinlong Chen <chenjinlong2016@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-10 14:20:25 +08:00
tang c755916ebc
[Store][Feature]: add task manager component (#1326)
* [Store]: initialize the basic task data structure

* [Store]: implement the task manager

* [Store]: change the mutex to custom mutext

* [Store]: implement copy and move, query task api

* [Store]: change the task manager lock to be shared

* [Store]: change the task to struct when submit

* [Store]: add fetch tasks api

* [Store]: add metrics for query and fetch task api

* [Store]: add update task status api

* [Store]: rename the updateTask api and add pending and processing task limit

* [Store]: expose the task manager paramters to master config

* [Store]: remove client id from client service

* [Store]: change the copy and move api definition to createCopyTask and createMoveTask.

* [Store]: add pending and processing task timeout support

* [Store]: add exposure api to real_client_main and also rename method to snake_case style

* [Store]: directly cast to int64_t

* [Store]: remove unused code and fix the api description

* [Store]: fix metrics issue for mark_task_to_complete
2026-01-07 11:27:18 +08:00
Vincent-Bo-ali 024b695a8d
[Store] feat: Add BatchReplicaClear API for manual cache cleanup (#1191)
* [Store] feat: Add BatchReplicaClear API for manual cache cleanup

Implement the `BatchReplicaClear` API to allow clients to manually clear
cached object replicas. This feature enables explicit storage management
by deleting replicas for specified keys. The implementation is end-to-end,
from the client to the master service.

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>

* [Store] feat: Fix BatchReplicaClear monitor issues

Fixed issues with monitoring metrics not being updated and function naming.
Fix the issue of unclear descriptions in the file.

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>

---------

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>
2025-12-12 23:08:48 +08:00
zhuxinjie-nz 455e11a1dc
[Store] feat: Implement a FileStorage component to manage the lifecycle of key-value data (#1031) 2025-12-09 15:00:57 +08:00
Vincent-Bo-ali 72bfa28c04
[Store] feat: Add BatchQueryIp API for querying multiple client IPs (#1162)
* [Store] feat: Add BatchQueryIp API for querying multiple client IPs

Add BatchQueryIp API with client test and master server test

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>

* [Doc] Add API documents for BatchQueryIp

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>

---------

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>
2025-12-08 17:29:04 +08:00
ykwd d9fb46342f
[Store] One Replica Has One Slice (#1032) 2025-11-10 16:35:08 +08:00
Jinlong Chen 6d05c9344b
[Store] Add Timeout Mechanism for Put Operations (#993) 2025-11-06 10:37:13 +08:00
JinYan Su 4976c2be48
refactor(store): Remove BufStatus and segment_name for AllocatedBuffer (#883)
* Refactor(store): Remove BufStatus and segment_name for AllocatedBuffer

- Removed BufStatus enum and related functionality from AllocatedBuffer.
- Updated AllocatedBuffer constructor to eliminate segment_name parameter.
- Enhanced getSegmentName method to retrieve segment name from the allocator.
- Adjusted logging and tests to reflect changes in buffer status handling.

* fix fmt

* update comment
2025-09-25 10:33:31 +08:00
ykwd c5cce40ee7
[Store] Check If Get Operation Completed Within Lease (#778) 2025-09-24 11:43:23 +08:00
JinYan Su af4fb4d5d4
feat(store): support transfer engine p2phandshake (#852)
* feat(allocator): Add transport endpoint support for segment transfers

* refactor(Client): Replace segment_name with transport_endpoint in buffer descriptors and tests

* refactor(test): switch to in-proc master and remove external service management

* style: format code and adjust transfer task timeout

* feat(Client::MountSegment): set te_endpoint conditionally based on metadata_connstring for P2P mode

* Allow configuring default KV lease TTL via environment variable

Read DEFAULT_KV_LEASE_TTL environment variable at server startup and
parse as uint64_t value. This enables CI tests to override default
configuration without code changes.

Signed-off-by: xiaguan <751080330@qq.com>

* style: format CI config and add [[nodiscard]] to methods

Signed-off-by: xiaguan <751080330@qq.com>

* refactor(tests): remove local_hostname parameter and improve test helpers

The commit removes the unused local_hostname parameter from TransferSubmitter constructor, updates the associated initialization logic, and simplifies test code by introducing helper functions for segment creation. The changes improve code maintainability while preserving functionality.

* refactor(TransferSubmitter): Remove unused local_hostname_ member and validation check

* docs(store): update setup examples for p2p

---------

Signed-off-by: xiaguan <751080330@qq.com>
2025-09-22 16:30:15 +08:00
Vladislav Nosivskoy aa9d4471a1
[Store] Add replication guarantees (#744)
* add replication guarantees

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* refactor implementation

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* fix merge aftermath

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* less copies

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* try fix wheel tests

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* fix wheel tests

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* remove old comment

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* fix wheel tests and add replication fault tolerance wheel test

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* split wheel tests

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* simplify code

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* replica allocation is best effort operation

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* fix tests for new best-effort behaviour

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* fix

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* update docs

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

* update another docs

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>

---------

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>
2025-08-25 20:24:41 +08:00
JinYan Su fb26af7613
refactor(store): remove garbage collection implementation (#763)
* refactor(store): remove garbage collection implementation and related configurations

* fix(client-monitor): stop client monitor thread before joining in destructor

* feat(master-service): add eviction thread functionality

Signed-off-by: Jinyang Su <751080330@qq.com>

---------

Signed-off-by: Jinyang Su <751080330@qq.com>
2025-08-21 12:50:42 +08:00
ykwd ec87bbd58b
[Store] Refine Complicated Constructor Parameters (#748) 2025-08-18 19:31:45 +08:00
Xuchun Shang 70ac0b611f
Add interface for fuzz match (#734)
---------

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>
Co-authored-by: Teng Ma <805522925@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-14 17:09:06 +08:00
Sgt.Pepper 81f492c033
[Store]feat: Migrate Persistence Metadata from Client to Master Service (#690)
* initial commit

* fix client::query return fault

* fix isexist return fault

* fix test bug

* fix clearinvalidhandles problem

* add file description for 3fs

* change ssd function start from client to master

* fix naming error

* edit doc description

* edit doc

* clang format

* fix as the review comment

* fix formmat

* add master service test for ssd

* fix format

* add log and cli

* fix putend test
2025-08-14 14:34:51 +08:00
Vladislav Nosivskoy d2e1a6cc7d
[Bugfix] Remove an Object Only if No Replica Are Valid (#731) 2025-08-12 00:10:57 +08:00
JinYan Su a851640b2e
refactor(store): remove unused value_length from PutStart functions (#606)
* refactor(store): remove unused value_length from PutStart functions

* fix master test
2025-07-10 14:11:05 +08:00
ykwd 60ccc133a9
[Store] Soft Pin for Important Object (#587)
This PR adds a soft pin mechanism for important and frequently used objects, such as system prompts and hot objects.
2025-07-08 19:37:41 +08:00
JinYan Su bde2fcaa13
refactor: introduce expected pattern for error handling in master service (#562)
* refactor: introduce expected pattern for error handling in master service

- Replace ErrorCode return types with tl::expected<T, ErrorCode> pattern
- Improve error handling clarity by separating success values from error codes
- Update MasterService methods to return expected<void, ErrorCode> or expected<T, ErrorCode>
- Modify RPC service interfaces to support expected pattern
- Update all related tests to handle new expected return types
- Add necessary includes for ylt/util/expected.hpp

This change makes error handling more explicit and type-safe:
- Success cases can be accessed via .value()
- Error cases can be accessed via .error()
- Eliminates ambiguity between success and error states

Future work:
- Extend expected pattern to RPC response types
- Enhance error code system for more comprehensive error handling

* Refactor error handling to use expected<T,E> pattern instead of ErrorCode

- Updated MasterService methods to replace ylt::expected with tl::expected for better error handling.
- Modified BatchGetReplicaList, BatchPutStart, BatchPutEnd, and other methods to return tl::expected types.
- Enhanced ClientIntegrationTest to handle expected results from Put, Get, Remove, and other operations using tl::expected.
- Adjusted error handling in clientctl and master_metrics_test to utilize the new expected type.
- Improved overall error reporting in tests to provide clearer feedback on operation failures.

* fix test compile

* refactor: update client implementation and remove master.proto

- Enhanced client.h and client.cpp with new functionality
- Removed obsolete master.proto file
- Updated master_client.cpp and transfer_task.cpp
- Improved integration and stress tests

* fix: update Python integration to work with new batch API

- Replace BatchObjectInfo with vector<vector<Replica::Descriptor>>
- Update BatchPut to handle new return type vector<tl::expected<void, ErrorCode>>
- Fix BatchQuery API usage to work with new expected pattern
- Convert unordered_map to vector format for BatchPut parameter compatibility

* refine master log and metric

* fix(ci): should alloc first

* merge main

* fix tests
2025-07-03 14:54:06 +08:00
Sgt.Pepper 77f5a7b9a1
[Store] Enable Client SSD Offload And Storage Persistence (#437)
* enable client ssd offload and storage persistence

* add storage_root_path in all tests setup() initialization and add related description in doc

* clean up headers and improve code readability - Added consistent Doxygen-style comments to all header files - Removed redundant code and outdated comments - Optimized function execution logic in LocalFile

* Revert "add storage_root_path in all tests setup() initialization and add related description in doc"

This reverts commit 159442d44e.

revert old high-level api test and doc modification

* Restore the high-level API to its original state and modify it to introduce the storage path through environment variables.

* add local_file_test and thread_pool_test

* feat(client_ssd_offload): implement async writes and fix locking bugs

- Refactor write operations to use thread pool for async file I/O
- Fix potential double-unlock bug by adding atomic is_locked_ flag
- Add corrupted file cleanup on write failure:
  - Auto-delete files with failed writes in destructor
  - Prevent subsequent reads of corrupted data

* add support for remove , remove_all , isexist interface etc.

* feat(kvcache): implement cluster isolation with session IDs

    * Remove precompilation parameters to simplify build configuration
    * Add session ID mechanism for cluster isolation:
      - Master node now generates unique session IDs on initialization
      - All persistent operations are scoped under session-specific subdirectories

* edit two parameters client get, add persisitence path in client rather than store_py.cpp

* add support for batch api conflict , refactor replica.descriptor to support file and memory type

* add test branch

* add ci ssd

* change python test

* add log for fail

* change querykey return value type

* fix bug

* fix bug

* add sleep for removefile

* fix sleep

* edit ci.yml and fix delete before write problem

* add comment for storage_backend

* spell check

* fix name problem and decrease errorcode for file

* add pytest for ssd offload

* edit test

* edit test

* fix test

* fix bug

* fix test

* Modify the thread pool value capture to reference capture to fix the issue of significant performance degradation when writing files with put.

* add async getfrom file in batchget transfertask. delete file_storage_backend

* add support for HA in cluster_id subdirectory, change session_id to fsdir

* add persistence in batchput

* add disk allocate for get_into py interface

* fix bug

* temp

* fix bug in submit fileread task for std:move(slices)

* edit querykey to return optional<descriptor>, add interface batchquerykey for storagebackend

* fix confict in batchget, add batchget/batchput test

* fix bug

* fix bug

* comment batch test

* fix conflict and add batch_get_into file test

* fix test bug

* fix test bug

* fix conflict
2025-07-02 19:15:10 +08:00
JinYan Su b91c60c524
feat(store): add batch exist support for master (#542)
* feat(store): add batch exist support for master

Signed-off-by: Jinyang Su <751080330@qq.com>

* refactor(client): simplify BatchIsExist logic by removing duplicate checks

Co-authored-by: Xinran Wang <wangxinran.wxr@antgroup.com>
Co-authored-by: Yongke Zhang <yongke.zyk@antgroup.com>

---------

Signed-off-by: Jinyang Su <751080330@qq.com>
Co-authored-by: Xinran Wang <wangxinran.wxr@antgroup.com>
Co-authored-by: Yongke Zhang <yongke.zyk@antgroup.com>
2025-06-24 14:34:24 +08:00
ykwd 91c5778166
[Store] High Availability V2: Client Failover (#501)
Major changes include: Client failover. Refactor SegmentManager. On the client side, limit the segment name to be equal to the localhost name. Add clientctl for manual e2e tests.
2025-06-20 16:59:55 +08:00
ykwd 9f363ba781
[Store] Add features: lease and eviction (#374)
* [Store] New feature: lease and LRU eviction

* Slightly adjust the ordering of the unit test cases

* Fix failed client_integration_test due to new the lease feature

* Modify test_distributed_object_store.py: adjust unit test behaviour accordingly

* bugfix: don't evict objects whose put are still not complete

* Refactor the codes according to review comments

* Add eviction related metrics in master;
Improve a unit test case for eviction.

* Fix a typo

* Refactor some codes;
Fix a unit test;

* Update docs: add lease and eviction policy

* make eviction_ratio configurable;
improve eviction algorithm to better achieve evicted_count / object_count = eviction_ration, especially when there are not so many objects.

* Fix a typo
2025-05-21 16:18:31 +08:00
maobaolong 7784c6cfc4
[Store] fix(store): the metadata leak after umount segment (#337)
* fix the metadata leak after umount segment

* Add a performance test
2025-05-15 11:29:22 +08:00
maobaolong 48f7a214d7
[Store] Improve: Add RemoveAll rpc for remove all keys (#327)
* [Store] Improve: Add RemoveAll rpc for remove all keys

* Add UT for RemoveAll and refactor code

* Add 3 more UT to address suggestion.

* Change to return removed_count rather than ErrorCode
2025-05-09 00:47:01 +08:00
JinYan Su 6f30524263
[Refactor] [MooncakeStore] Migrate Master Service from gRPC to coro_rpc (#179)
* [Refactor] [MooncakeStore] Migrate Master Service from gRPC to coro_rpc

* fix typos and install yalantinglibs

* fix master service test

* [Refactor]  rename cache_allocator to mooncake_store;

* Update DistributedObjectStore

* Set minimum logging severity to WARN

* Refactor MasterClient to use send_request for thread safety

* seems a bug

* fix bug
2025-03-31 17:35:42 +08:00
JinYan Su 33ce0107a0
[FEATURE] Update MooncakeStroe CI workflow (#146) 2025-03-23 19:35:05 +08:00
JinYan Su f0a2299805
[FEATURE] catch exceptions during allocator creation (#157) 2025-03-23 16:54:33 +08:00
Feng Ren ac98ea9ffc
[MooncakeStore] Introduce MooncakeStore: A new Distributed Object Store for XpYd PD disaggregation (#126)
Mooncake Store is a high-performance **distributed key-value (KV) cache storage engine** designed specifically for LLM inference scenarios.

Unlike traditional caching systems such as Redis or Memcached, Mooncake Store is positioned as **a distributed KV cache rather than a generic caching system**. The key difference is that in the former, the key is derived from the value through hashing, so value is immutable after inserting (although the key/value pair may be garbage collected).

Mooncake Store provides low-level object storage and management capabilities, while specific caching strategies (e.g., eviction policies) are left to upper-layer frameworks (like vLLM) or users for implementation, offering higher flexibility and customizability.

Key features of Mooncake Store include:
- **Object-level storage operations**: Mooncake Store provides simple and easy-to-use object-level APIs, including `Put`, `Get`, and `Remove` operations.
- **Multi-replica support**: Mooncake Store supports storing multiple data replicas for the same object, effectively alleviating hotspots in access pressure.
- **Eventual consistency**: Mooncake Store ensures that `Get` operations read complete and correct data, but does not guarantee the latest written data. This eventual consistency model ensures high performance while simplifying system design.
- **High bandwidth utilization**: Mooncake Store supports striping and parallel I/O transfer of large objects, fully utilizing multi-NIC aggregated bandwidth for high-speed data reads and writes.
- **Dynamic resource scaling**: Mooncake Store supports dynamically adding and removing nodes to flexibly handle changes in system load, achieving elastic resource management (to be refined in future versions).

---------

Co-authored-by: Feng Ren <alogfans@gmail.com>
Co-authored-by: Teng Ma <teng-ma@linux.alibaba.com>
Co-authored-by: Shangming Cai <caishangming@linux.alibaba.com>
Co-authored-by: susun <751080330@qq.com>
Co-authored-by: liusy58 <liusy58@linux.alibaba.com>
2025-03-07 15:57:54 +08:00