Commit Graph

140 Commits

Author SHA1 Message Date
lujh 0f22234d0b
[Store] unify file storage backend env vars under MOONCAKE_OFFLOAD_ p… (#1929) 2026-04-21 11:36:54 +08:00
Teng Ma ac53c874ba
[Store] Add client bandwidth metrics for real and dummy clients (#1874)
* [Store] Add client bandwidth metrics for real and dummy clients

* format

* resolve conflicts

* fix comments

* fix comments
2026-04-21 11:06:52 +08:00
Skyper 4a8684bc3e
[CI] fix: health_check_test flaky due to fixed sleep, use polling for master down detection (#1868) 2026-04-16 14:36:32 +08:00
lujh c2573405bb
[Store] Support SSD Metrics (#1879) 2026-04-15 12:01:18 +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
Haode Du 83ac8fc620
[Store] Introduce HA OpLog abstraction and LocalFS oplog store (#1804)
* [Store] Add OpLog abstraction layer with multi-backend support for HA

Introduce a complete OpLog infrastructure for hot-standby replication,
extracted as a standalone layer with no changes to master_service.

New components:
- OpLogStore interface + EtcdOpLogStore / LocalfsOpLogStore backends
- OpLogChangeNotifier interface + Etcd watch / Polling implementations
- OpLogStoreFactory for backend selection at runtime
- OpLogSerializer for binary serialization/deserialization of entries
- OpLogManager: in-memory buffer with global sequence-id allocation
- OpLogApplier: ordered application with gap handling
- OpLogReplicator: orchestrates notifier + applier on standby side
- HaMetricManager: HA observability metrics

Supporting additions:
- ErrorCode::OPLOG_ENTRY_NOT_FOUND
- Unit tests for all new components
- Integration tests: localfs_hot_standby_integration_test

* style(store): run code format after rebase

* fix(store): repair etcd oplog batch flush after rebase

* fix by comments

* Restore fencing test to match batch write behavior

The batching write path falls back to per-key Put on BatchCreate
transaction failure, which does not detect same-seq-different-content
conflicts. Restore the original comment from main instead of asserting
ETCD_OPERATION_ERROR.

* Move oplog files under ha/oplog/ subtree

Oplog is part of the HA runtime. Move all oplog-related headers and
sources from the top-level include/ and src/ into ha/oplog/ to align
with the existing ha/ directory structure (leadership/, snapshot/).

Also remove the unused include/ha/oplog_store.h interface that has no
references anywhere in the codebase.

* Fix oplog include paths for files added on main after rebase

master_service.cpp and snapshot_child_process_test.cpp gained
etcd_oplog_store.h includes on main while this branch was in flight.
Update them to the new ha/oplog/ path.

---------

Co-authored-by: haodedu <haodedu@tencent.com>
2026-04-09 11:14:23 +08:00
zhangzuo21 9933470d39
[Bug fix] Fix get tcp port collision (#1816) 2026-04-08 23:20:09 +08:00
fatSheep f6f7e51398
fix: increase ParallelAllocation test pool to 32MB to avoid CacheLib slab race (#1841)
With a 16MB pool (= 1 slab, since Slab::kSize = 16MB), a startup race
in MemoryPool::allocate() can cause spurious nullptr returns: the thread
assigning the slab increments currSlabAllocSize_ before calling
addSlabAndAllocate(), causing other threads to see
allSlabsAllocated()=true and bail out immediately. Using 32MB (2 slabs)
ensures allSlabsAllocated() remains false during the first slab
assignment, allowing other threads to enter the slow path and wait.
2026-04-08 23:16:14 +08:00
Copilot 30da37a554
[Store] Add native Rust bindings for Mooncake Store with usage example and CI integration (#1810)
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>
Co-authored-by: XucSh <107600043+XucSh@users.noreply.github.com>
Co-authored-by: Teng Ma <teng-ma@linux.alibaba.com>
2026-04-07 19:53:03 +08:00
EkiRui 875b6c652e
[STORE] tighten snapshot correctness and reload snapshot-only standby from catalog (#1801)
---------

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
2026-04-07 15:35:38 +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
fatSheep 2e3b3c5769
fix: serialize eviction test Puts to ensure deterministic FIFO order (#1800)
The write_thread_pool_ has 2 threads, so concurrent PutToLocalFile calls
can complete in arbitrary order, causing the FIFO eviction queue to not
match the logical Put order. Wait for each key's DISK replica before
putting the next to guarantee key_0 is always the oldest entry.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 18:09:08 +08:00
EkiRui f6a7c6b798
[STORE] split HA runtime and unify standby lifecycle (#1777)
* [STORE] split master admin and service runtime

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] wire standby replication into runtime states

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] drive standby runtime with replication callbacks

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] compose standby replication from snapshot and oplog capabilities

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] unify standby lifecycle entry points

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] add snapshot provider backend integration tests

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] reorganize HA tests and add bootstrap coverage

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] tighten serve lifecycle transitions

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] persist snapshot watermark and gate standby promotion

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] rename standby controller and extract supervisor loop

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* rename standby_controller.cpp file

* Replace replication_controller with standby_controller

* Add standby_controller.h header file

* Update include directive for standby_controller

* Replace replication_controller with standby_controller include

* Replace replication_controller with standby_controller

---------

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Co-authored-by: Xuchun Shang <xuchun.shang@gmail.com>
2026-04-02 13:28:23 +08:00
EkiRui 830d84127a
[Store] support resolving master RPC address from interface (#1784)
* [Store] support resolving master RPC address from interface

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
2026-04-01 12:39:05 +08:00
lujh 6105f9cda8
[Store] fix gmock bug and add batch remove API (#1756) 2026-03-31 16:55:41 +08:00
EkiRui e1220bb309
[STORE] support Redis ACL username authentication and reorganize HA (#1757) 2026-03-27 15:22:09 +08:00
EkiRui 50bc7cf976
[STORE] abstract snapshot catalog and add Redis snapshot backend (#1739)
* [STORE] abstract snapshot catalog in master service

Introduce SerializerSnapshotStore as the snapshot catalog adapter for the existing serializer backend and route MasterService persist, restore, and cleanup flows through it instead of open-coding latest marker updates and snapshot directory scans.

Also add focused unit coverage for publish/get/list/delete behavior so the snapshot catalog path can evolve independently from the payload storage path.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] distinguish missing snapshots from backend read errors

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] add Redis snapshot catalog backend

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] share Redis connection helpers across HA backends

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Co-authored-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>

* [STORE] unify Redis test helpers

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] tighten snapshot catalog state handling

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

---------

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
2026-03-27 09:52:55 +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 ef34131c7d
store: split client HA/control-plane threads and suppress zero-seg he… (#1736)
* store: split client HA/control-plane threads and suppress zero-seg heartbeats

Refactor the store client control plane so leader monitoring, storage
heartbeat, and task polling are managed separately, and route leader
switching through a single serialized SwitchLeader() path.

This changes zero-global-segment behavior so setup no longer starts the
storage heartbeat/task polling control plane when no segment is mounted,
which avoids flooding master with useless ping traffic from zero-seg
clients. The storage control plane now starts lazily from actual mount
paths.

Also add regression and smoke coverage for:
- zero-seg clients not pinging before mount
- heartbeat starting after mount
- non-HA reconnect/remount behavior
- zero-seg HA smoke and non-zero ping/fetch-task smoke

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

* format

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

* fix

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

---------

Signed-off-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>
2026-03-25 10:09:12 +08:00
EkiRui 11fd29abd2
[STORE] add Redis leadership backend and HA regression coverage (#1722)
Add the Redis leader coordinator behind the HA backend abstraction and wire it into the store and test builds so Redis can participate as a first-class leadership backend alongside etcd.

Also make the HA/e2e test harness backend-agnostic, add Redis leadership regression tests, and fix the client test wrapper to pass HA master entries correctly so the chaos suite exercises the real HA path.

---------

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
2026-03-25 01:03:56 +08:00
EkiRui c0f190d6f2
[STORE] introduce HA backend abstraction (#1678)
* [STORE] introduce HA backend abstraction

- add HA backend types, coordinator/oplog/snapshot interfaces and etcd baseline
- migrate master supervisor and client HA path to the new coordinator layer
- remove legacy ha_helper and migrate HA tests to LeaderCoordinator

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] optimize address HA backend

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] split supervisor warmup and serve phases

Split leadership startup into an explicit warmup phase and a serve phase so the supervisor no longer stops the RPC server before async_start() is entered.

Also factor the repeated release/retry paths into small helpers to keep the leadership lifecycle readable while preserving the existing HA semantics.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] add leadership loss reason to serve monitor

Switch the serve-phase monitor to a callback so leadership observation stays separate from the concrete shutdown action.

Thread explicit leadership loss reasons through the callback so the supervisor can distinguish renewal errors from normal leadership loss in logging and follow-up policy.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [STORE] move leadership monitoring into HA backend

Introduce leadership monitor callback/handle in the HA abstraction, let the etcd backend own serve-phase liveness monitoring, and add etcd regression coverage.

Also add a keepalive-ready handshake in the etcd wrapper to close the startup race between keepalive registration and cancellation.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

---------

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
Co-authored-by: Xuchun Shang <xuchun.shang@linux.alibaba.com>
2026-03-23 11:11:20 +08:00
Mahesh Bapatu d2bff9b9a8
[Store] e2e storage backend test (#1660) 2026-03-20 15:49:46 +08:00
Bo Lee a811c288ea
[Store] Hot Standby and Oplog interface for master service HA (#1515) 2026-03-17 11:26:17 +08:00
Wenxiao Chen 3f249c5a72
[STORE] feat: Frequency admission + LRU lock optimization for local hot cache (#1596)
---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 13:50:56 +08:00
Haode Du 82d21747f6
[Store] Add /metrics and /metrics/summary HTTP endpoints to RealClient (#1634)
* add /metrics and /metrics/summary HTTP endpoints to RealClient

* add integration tests for /metrics and /metrics/summary endpoints

* apply clang-format to metrics endpoint handlers

* add metrics data correctness test with put/get verification

Merge the metrics endpoint test and a new transfer stats verification
test into a single test case to avoid RealClient setup/teardown
resource contention that caused segfaults with 8 sequential tests.

The combined test verifies:
- /metrics and /metrics/summary return 200 before any transfers
- After put/get, Prometheus output contains write_bytes, read_bytes,
  put_latency_count, and get_latency_count
- Summary output shows Put and Get sections

---------

Co-authored-by: haodedu <haodedu@tencent.com>
2026-03-10 10:41:10 +08:00
Haode Du ea8f1b902b [Store] Add health check API for Client with HTTP /health endpoint (#1606) 2026-03-07 00:05:53 +08:00
Haode Du a402dc715f
[Store] Notify master on disk eviction to fix stale metadata (#1549) 2026-03-04 16:48:05 +08:00
yizheng 5fe8e21e7c
[Store] Implement Metadata Persistence and Recovery for Master Service (#1431) 2026-03-02 11:20:33 +08:00
EkiRui 8ed67617e8
[Store] Enable dummy client zero-copy get_buffer via shared hot cache (#1535)
* [Store] enable dummy client zero-copy get_buffer via shared hot cache

- Extract ShmHelper into standalone shm_helper.h/cpp for reuse
- Convert LocalHotCache allocation from malloc to memfd (use_shm mode)
- Add IPC protocol for dummy clients to request hot cache fd from real client
- Add acquire/release RPC for hot cache (ref_count based lifecycle)
- Add acquire/release RPC for allocator-backed buffers (dummy path)
- Add batch variants for hot cache and allocator acquire RPCs
- Extend BufferHandle with view mode (non-owning, custom release callback)
- Implement DummyClient::get_buffer with hot cache fast path + allocator fallback
- Unify store_py.cpp get() to use get_buffer for both real and dummy clients
- Remove obsolete get_buffer_info virtual interface

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] enable dummy client get_buffer/batch_get_buffer in Python bindings

Remove use_dummy_client_ guards that blocked get_tensor, batch_get_tensor,
and batch_get_buffer for dummy clients, now that dummy supports these APIs
via shared hot cache + allocator fallback.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] fix batch_get_buffer_internal to use dummy's allocator

batch_acquire_buffer_dummy was calling batch_get_buffer_internal without
passing the dummy's allocator, causing buffers to be allocated in the
real client's memory instead of the dummy's shm region. Add optional
client_buffer_allocator parameter to batch_get_buffer_internal and pass
it from batch_acquire_buffer_dummy.

Also add is_hot_cache_ptr() to DummyClient for verifying whether a
pointer falls within the hot cache shm region.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] add dummy client get_buffer/batch_get_buffer unit tests

Test correctness, hot cache shm path, allocator fallback, and
performance with 500 MB per key, 7 GB batch.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] allow local data into hot cache when shm mode is active

In shm mode the hot cache is shared with dummy clients via IPC, so
local data must also be cached for zero-copy access. Add IsShm()
accessor to LocalHotCache and gate the local-skip filter in
ProcessSlicesAsync on non-shm mode only.

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] rename hot cache env vars to MC_STORE_ prefix

Align LOCAL_HOT_CACHE_SIZE, LOCAL_HOT_BLOCK_SIZE, and
LOCAL_HOT_CACHE_USE_SHM with the project-wide MC_STORE_ naming
convention. Also use IsReplicaOnLocalMemory() for correct local
detection under P2PHANDSHAKE mode, and gate hot cache shm mode
behind MC_STORE_LOCAL_HOT_CACHE_USE_SHM=1 (default off).

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] real client: add  bounds check, IPC auth, recv timeout, lambda fix

- Validate offset + size <= hot_cache_size_ in get_buffer/batch_get_buffer
- Authenticate client_id in handle_ipc_shm_fd_request against registered dummies
- Add SO_RCVTIMEO (5s) on IPC server client sockets to prevent blocking
- Fix lambda in batch_get_buffer to capture key directly instead of growing vector

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

* [Store] reduce test payload sizes for CI memory constraints

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>

---------

Signed-off-by: Xingrui Yi <yixingrui@linux.alibaba.com>
2026-02-25 14:34:37 +08:00
zhangzuo21 4ff4dc1e27
[Store] Implement a file interface based on io uring to optimize storage backend. (#1500)
Co-authored-by: zhuxinjie-nz <240190801+zhuxinjie-nz@users.noreply.github.com>
2026-02-25 14:18:22 +08:00
qiuweit7 30e48cfd93
[Store] feat: CXL storage full features. (#1531)
* [Store] feat: CXL storage full features.

* fix(ci): resolve cxl test failure and code format

* fix(ci): add CXL protocol support and fix code format issues

* [Store] feat: CXL storage full features, reset and rm extern/pybind

* [TE] Support TCP fallback in EFA build and improve EFA documentation (#1523)

When building with USE_EFA=ON, auto_discover is disabled to prevent
RDMA transport installation (QP creation fails on EFA devices). This
means TCP transport is also not installed automatically. Add explicit
TCP transport installation for non-EFA protocols in the EFA build path.

Documentation changes:
- build.md: Add USE_EFA option and clarify USE_CUDA default/purpose
- supported-protocols.md: Add EFA as a supported protocol
- efa_transport.md: Add USE_CUDA=ON to build command, document GPU
  memory requirement

Co-authored-by: whn09 <whn09@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Teng Ma <teng-ma@linux.alibaba.com>

* [Store] Optimize BucketStorageBackend for reduced lock contention and add delete safety (#1456)

* fix(ci): resolve cxl test failure and code format

* [Store] Add Local Cache Mechanism for Mooncake Store Client (#1226)

* feat(Store): add local hot cache for client

* feat(Store): add client local hot cache log to show performance

* fix: local hot cache initialize bug

* fix(Store): Mooncake put slice is max 16MB, so make local hot cache block 16MB

* feat(Store): move local hot cache initialization to Client::Create

* feat(Store):  local hot cache remove unused small block implementation

* feat(Store): add client local hot cache unit test

* fix(Store): modify client local hot cache suit with v0.3.7

* feat(Store): change local hot cache unit tes

* fix: initialize local hot cache with negative value

* feat: use in process master and metadata fro local hot cache unit test.

* feat: update local hot cache to one replica one slice version

* fix: local hot cache unit test use in process master service

* fix: code style fix

* fix: fix dirty read when client wants to read a previously hitted hot block but the hot block is modified by incoming put actions

* fix: local hot cache unit test use in process master service

* fix: code format fix

* fix: fix comment problems for

* feat: add local hot asynchronous queue size limit

* fix: local hot cache task involves the block so that there is no memcpy operation when inserting local hot cache

* fix: code check fix

* fix: update block in_use prop to reference count

---------

Co-authored-by: shichangzhang064 <zhangshichang@h-partners.com>

* fix(ci): add CXL protocol support and fix code format issues

* fix: address comments from code review

* fix(ci): resolve cxl test failure

* fix(ci): resolve ci error

---------

Co-authored-by: 王鹤男 <wanghenan09@gmail.com>
Co-authored-by: whn09 <whn09@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Teng Ma <teng-ma@linux.alibaba.com>
Co-authored-by: Mahesh Bapatu <153306023+maheshrbapatu@users.noreply.github.com>
Co-authored-by: Shichang Zhang <77728761+Shichang-Zhang@users.noreply.github.com>
Co-authored-by: shichangzhang064 <zhangshichang@h-partners.com>
2026-02-24 19:59:45 +08:00
dongb0 3897e1b53e
[Store]add unit test for exception handling of RealClient (#1546) 2026-02-22 16:02:01 +07:00
fatSheep 330863e389
[Store] Introduce Free-Ratio-First Allocation Strategy to Improve Convergence (#1511)
Co-authored-by: fatSheep <tzh2005t@gmail.com>
Co-authored-by: sinpo828 <sinpo828@outlook.com>
2026-02-13 11:48:09 +08:00
Shichang Zhang f21b3791ac
[Store] Add Local Cache Mechanism for Mooncake Store Client (#1226)
* feat(Store): add local hot cache for client

* feat(Store): add client local hot cache log to show performance

* fix: local hot cache initialize bug

* fix(Store): Mooncake put slice is max 16MB, so make local hot cache block 16MB

* feat(Store): move local hot cache initialization to Client::Create

* feat(Store):  local hot cache remove unused small block implementation

* feat(Store): add client local hot cache unit test

* fix(Store): modify client local hot cache suit with v0.3.7

* feat(Store): change local hot cache unit tes

* fix: initialize local hot cache with negative value

* feat: use in process master and metadata fro local hot cache unit test.

* feat: update local hot cache to one replica one slice version

* fix: local hot cache unit test use in process master service

* fix: code style fix

* fix: fix dirty read when client wants to read a previously hitted hot block but the hot block is modified by incoming put actions

* fix: local hot cache unit test use in process master service

* fix: code format fix

* fix: fix comment problems for

* feat: add local hot asynchronous queue size limit

* fix: local hot cache task involves the block so that there is no memcpy operation when inserting local hot cache

* fix: code check fix

* fix: update block in_use prop to reference count

---------

Co-authored-by: shichangzhang064 <zhangshichang@h-partners.com>
2026-02-11 15:34:52 +08:00
Mahesh Bapatu b84aca829a
[Store] Optimize BucketStorageBackend for reduced lock contention and add delete safety (#1456) 2026-02-11 11:15:51 +08:00
tang c724318217
[Store][Feature] copy and move client support (#1364)
* [Store]: add task executor feature with unit and executor test

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

* [Store]: add some optimizations to task executor

Refactor the task_executor into the client_service and add a
task structure on the client side. Additionally, remove the
existence check in the execute function;
only retrying should be performed if replica allocation fails.

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

* [Store]: get source replica from copyStart or moveStart api

* [Store]: call move or copy end if the target replica already exist to complete the replication task

* [Store]: use the max_retry_attempts in master side

* [Store]: add client integration test and set default max_retry_attempts to 10

* [Doc] update task api introduction

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

* [Store] Set copy and move as private methods

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

* [Doc]: change the default task max_retry_attempts to 10

* [Doc]: fix some description error

* [Store]: allocate the buffer size to be a multiple of 16MB

* [Store]: validate the replica is in local and directly construct slices from replica buffer address instead of copy the data to local buffer

* [Store]: change the validate logic to directly use transfer engine endpoint or local_hostname_.

* [Store] add e2e ci test for copy and move api

* [Store] refactor the client move and copy function

* [Store] fix the e2e test

* [Store] remove unused code

* [Store] add source field when build replica copy payload in the task_manager_test

* [Store] rename back to snake case for split_into_slices function and also remove hard code for client poll count

* [Store] revert mis deleted field when resolve conflicts

* [Store] change test to validate the real behaviour

* [Store] change the default task fetch size to 16

* [Doc]: change the replica copy/move sequence diagram

* [Store] add new split_into_slice method

* [Store] change the real client to use split_to_slice with buffer handle parameters

---------

Signed-off-by: Vincent Gao <vincentbo@linux.alibaba.com>
Co-authored-by: Vincent Gao <vincentbo@linux.alibaba.com>
2026-02-06 19:02:02 +08:00
Bo Lee 4779cb0e7d
[Store] Wrap etcd basic interface for master service HA (#1451) 2026-02-05 20:29:18 +08:00
zhangzuo21 680ae5c8df
[Bug Fix]Fix segmentation fault when using python wrapped transfer engine and store in the same process. (#1471)
* fixed odr

* fixed cmakelist format

* fixed cmakelist format

* formatted

* fix for ci

* fix for ci

* fix for ci

* fix for ci

* commit for ci

* fix for ci

* fix for ci

* fix for ci
2026-02-04 20:13:29 +08:00
Xuchun Shang 47633c4661
[Store] Add force remove option for remove api (#1425) 2026-01-29 10:31:35 +08:00
qiuweit7 67d0afc4a9
[Store][Feature] Add CXL storage for mooncake_store (#1365)
* [Store] feat: add cxl storage for mooncake store

* Update extern/pybind11 to match main

* fix: use fake cxl device to bypass ci-test error

* Fix code formatting in segment.cpp

---------

Co-authored-by: Teng Ma <sima.mt@alibaba-inc.com>
2026-01-28 19:51:20 +08:00
zhuxinjie-nz 24c632f84a
feat(Store): Support get local ssd object (#1203)
Co-authored-by: zhang zuoyuan <zhangzuo21@mails.tsinghua.edu.cn>
2026-01-22 21:15:50 +08:00
tang b6743066f6
[Store] fix issue that the preferred segments not working when put (#1360) 2026-01-13 17:10:43 +08:00
Jinlong Chen 4e3c1555d3
[Store]: Use SharedMutex in MetadataShard for better performance (#1343)
* [Store]: Use 'const std::string&' as param for MasterService::GetReplicaList

* [Store]: Use SharedMutex in MetadataShard for better performance

* [Store]: Address code review problems

* [Store]: Address code review problems

* Fix typo

* Simplify ObjectMetadata::IsValid
2026-01-12 13:52:18 +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
Mahesh Bapatu 4591728264
[Store] - Implement partial success handling in BatchOffload (#1319)
* feat: Add deterministic test failure injection for partial success testing

- Add SetTestFailurePredicate() virtual method to StorageBackendInterface
- Implement test failure injection in StorageBackendAdaptor and OffsetAllocatorStorageBackend
- Refactor TestPartialSuccessBehavior helper to use predicate-based injection
- Remove repetitive key creation code (use loops)
- Add PartialSuccess tests for both Adaptor and OffsetAllocator backends
- Update OutOfSpace test to handle partial success semantics (value==0)

This enables deterministic testing of partial success behavior without
relying on approximate space exhaustion, making tests more reliable.

* Addressed review comments
2026-01-07 13:22:23 +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
Mahesh Bapatu 1719043de4
[Store]: Add OffsetAllocator disk backend with lock-striped metadata + refcounted extents. (#1284) 2025-12-31 00:28:55 +08:00
Yue Chen 9f15ba4c58
[Store] Improve the memory efficiency for offset allocator (#1286) 2025-12-27 09:30:19 +08:00
fatSheep a6f446ca17
[Store] Decouple master from transfer_engine dependencies (#1233)
* [Store] Decouple master from transfer_engine dependencies

Fixes #992

Change transfer_engine linkage from PUBLIC to PRIVATE in mooncake_store library to prevent propagating its dependencies (e.g., Ascend, CUDA) to targets that don't need it. The master service only handles metadata management and doesn't perform data transfers, so it shouldn't require transfer engine dependencies.

Changes:

- Set transfer_engine as PRIVATE dependency in mooncake_store
- Explicitly link transfer_engine for mooncake_client binary
- Add transfer_engine to all test targets that use client functionality
- Add transfer_engine to e2e test targets
- corrected target_compile_options from mooncake_master to mooncake_client

Benefits:

- Reduces master binary size
- Eliminates unnecessary Ascend/CUDA dependencies for master

* Update mooncake-store/src/CMakeLists.txt

---------

Co-authored-by: Teng Ma <teng-ma@linux.alibaba.com>
2025-12-22 18:39:00 +08:00
Copilot e59749a156
[Store] Fix compilation warnings for missing field initializers (#1232)
* Initial plan

* Fix compilation warnings for visibility and missing initializers

Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>

* Complete fix for compilation warnings

Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>

* Remove build artifacts and update .gitignore

Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>

* Use pragma GCC diagnostic to suppress visibility warnings instead of attributes

Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>

* Narrow scope of pragma diagnostic directives for lambda

Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>

* fix

* Revert all changes in mooncake-transfer-engine directory

Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stmatengss <11641725+stmatengss@users.noreply.github.com>
Co-authored-by: Teng Ma <sima.mt@alibaba-inc.com>
2025-12-18 16:27:40 +08:00