Mooncake/mooncake-store/tests
skygragon aad5111781
[Store] Support degraded startup when master is unavailable (#1930)
* [Store] Support degraded startup when master is unavailable

Problem:
P2P client startup fails when master is unavailable, blocking the
entire application. This is problematic for scenarios where the
client should be able to start independently and wait for master
to become available.

Solution:
1. Refactor P2PClientService::Init to support degraded startup:
   - Try ConnectToMaster/RegisterClient, allow failure
   - Set HA state to FULL or DEGRADED based on connection result
   - Skip MountSegment in degraded mode
   - Heartbeat thread will recover when master becomes available

2. Optimize initialization order:
   - ConnectToMaster/RegisterClient first
   - StartHeartbeat before InitTransferEngine (faster heartbeat)
   - InitTransferEngine and InitStorage after heartbeat starts

3. Add HARecoveryManager::SetState() for setting initial state

4. Make connection_interrupted_ atomic for thread-safe access

Changes:
- ha_recovery_manager.h: Add SetState() method
- client_service.h/cpp: Support degraded startup in heartbeat logic
- p2p_client_service.cpp: Refactor Init flow with degraded support

Co-Authored-By: Claude (antchat/GLM-5) <noreply@anthropic.com>

* [Store] Refactor HA recovery manager and client service

1. Remove unused master_server_entry parameter from ReconnectToMaster.
   In non-HA mode, current_master_address is already initialized to
   master_server_entry, making the parameter redundant.

2. Replace SetState() with constructor initial_state parameter.
   SetState() bypasses the state machine transition logic, which breaks
   encapsulation. Initial state should only be set during construction.

3. Add WaitForReady() to encapsulate initialization wait logic.
   Extracts the ready_for_recovery_ and data_manager_ check into a
   separate method for better readability in RecoveryPipelineMain.

Co-Authored-By: Claude (antchat/GLM-5) <noreply@anthropic.com>

* [Store] Add TODO comment for race window in segment mount logic

Add documentation explaining the race condition between IsDegraded()
check and MountSegment() call, and outline future improvement plan
to decouple storage layer initialization from master interaction.

Co-Authored-By: Claude (antchat/GLM-5) <noreply@anthropic.com>

---------

Co-authored-by: wl177541 <wl177541@antgroup.com>
Co-authored-by: Claude (antchat/GLM-5) <noreply@anthropic.com>
2026-04-22 20:56:56 +08:00
..
conf [MooncakeStore] Introduce MooncakeStore: A new Distributed Object Store for XpYd PD disaggregation (#126) 2025-03-07 15:57:54 +08:00
e2e [Store] Add orchestration script for matrix sweeps of stress_workload_test and Optimize client read path of P2P Structure (#1779) 2026-04-01 17:13:26 +08:00
scripts [MooncakeStore] Introduce MooncakeStore: A new Distributed Object Store for XpYd PD disaggregation (#126) 2025-03-07 15:57:54 +08:00
utils [Store] Make tiered scheduler incremental and harden SSD tier space management (#1675) 2026-03-23 14:01:24 +08:00
CMakeLists.txt [Store] Add HTTP metrics endpoint for Client (#1934) 2026-04-21 17:35:20 +08:00
allocation_strategy_test.cpp [Store]Refactor hierarchy MasterService and heartbeat mechanism 2026-03-04 14:42:59 +08:00
ascend_tier_test.cpp [Store] Make tiered scheduler incremental and harden SSD tier space management (#1675) 2026-03-23 14:01:24 +08:00
async_metadata_notifier_test.cpp [Store ]Implement Master HA recovery based on client (#1876) 2026-04-13 19:33:23 +08:00
buffer_allocator_test.cpp [Store]Refactor hierarchy MasterService and heartbeat mechanism 2026-03-04 14:42:59 +08:00
centralized_client_manager_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
centralized_client_meta_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
centralized_segment_manager_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
client_buffer_test.cpp [Store] One Replica Has One Slice (#1032) 2025-11-10 16:35:08 +08:00
client_config_builder_test.cpp [Store] Parallelize Local and Remote Read/Write in Batch Scenarios (#1921) 2026-04-20 11:47:43 +08:00
client_http_metrics_test.cpp [Store] Add HTTP metrics endpoint for Client (#1934) 2026-04-21 17:35:20 +08:00
client_integration_test.cpp [Store] Add orchestration script for matrix sweeps of stress_workload_test and Optimize client read path of P2P Structure (#1779) 2026-04-01 17:13:26 +08:00
client_metrics_test.cpp [Store] Add support for static labels (host IP/cluster name) in client metrics (#1081) 2025-11-29 14:09:35 +08:00
client_rpc_service_test.cpp [Store] Parallelize Local and Remote Read/Write in Batch Scenarios (#1921) 2026-04-20 11:47:43 +08:00
data_manager_test.cpp [Store] Parallelize Local and Remote Read/Write in Batch Scenarios (#1921) 2026-04-20 11:47:43 +08:00
distributed_object_store_provider.py [MooncakeStore] Introduce MooncakeStore: A new Distributed Object Store for XpYd PD disaggregation (#126) 2025-03-07 15:57:54 +08:00
eviction_strategy_test.cpp code format & enable code format checking in ci (#677) 2025-08-02 15:50:25 +08:00
file_storage_test.cpp [Store] feat: Implement a unified storage interface to simplify integration and extension (#1185) 2025-12-17 22:33:05 +08:00
ha_integration_test.cpp [Store] Add HTTP metrics endpoint for Client (#1934) 2026-04-21 17:35:20 +08:00
ha_recovery_manager_test.cpp [Store] Support degraded startup when master is unavailable (#1930) 2026-04-22 20:56:56 +08:00
high_availability_test.cpp [Store] Add initial support for master high availability failover (#451) 2025-06-11 16:37:05 +08:00
ipv6_client_test.cpp [Store] Implement the client service and add adaptation to the P2P architecture for the interface on the client side (#1631) 2026-03-17 16:17:35 +08:00
master_metrics_test.cpp [Store]Refactor hierarchy MasterService and heartbeat mechanism 2026-03-04 14:42:59 +08:00
master_service_ssd_test.cpp [Store]Refactor hierarchy MasterService and heartbeat mechanism 2026-03-04 14:42:59 +08:00
master_service_test.cpp [Store]Refactor hierarchy MasterService and heartbeat mechanism 2026-03-04 14:42:59 +08:00
mutex_test.cpp [Store] Add BucketStorageBackend (#968) 2025-10-31 10:19:05 +08:00
non_ha_reconnect_test.cpp [Store] Implement Lock-Free P2P Route Cache (#1793) 2026-04-02 14:46:37 +08:00
offset_allocator_test.cpp [Chores] Offset Allocator Test Fix & Docs Fix (#806) 2025-09-05 10:38:19 +08:00
p2p_client_integration_test.cpp [Store] Add HTTP metrics endpoint for Client (#1934) 2026-04-21 17:35:20 +08:00
p2p_client_manager_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
p2p_client_meta_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
p2p_master_service_test.cpp [Store ]Implement Master HA recovery based on client (#1876) 2026-04-13 19:33:23 +08:00
p2p_segment_manager_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
peer_client_perf_test.cpp [Store] Parallelize Local and Remote Read/Write in Batch Scenarios (#1921) 2026-04-20 11:47:43 +08:00
peer_client_test.cpp [Store] Parallelize Local and Remote Read/Write in Batch Scenarios (#1921) 2026-04-20 11:47:43 +08:00
posix_file_test.cpp code format & enable code format checking in ci (#677) 2025-08-02 15:50:25 +08:00
pybind_client_test.cpp [Store] Implement the client service and add adaptation to the P2P architecture for the interface on the client side (#1631) 2026-03-17 16:17:35 +08:00
route_cache_test.cpp [Store] Implement Lock-Free P2P Route Cache (#1793) 2026-04-02 14:46:37 +08:00
scheduler_integration_test.cpp [Store] Make tiered scheduler incremental and harden SSD tier space management (#1675) 2026-03-23 14:01:24 +08:00
serializer_test.cpp [Store] Serialize/Deserialize Offset Allocator (#760) 2025-08-21 11:35:54 +08:00
storage_backend_test.cpp [Store] Make tiered scheduler incremental and harden SSD tier space management (#1675) 2026-03-23 14:01:24 +08:00
storage_tier_test.cpp [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
stress_cluster_benchmark.py [Bench] fix: Update stress_cluster_benchmark (#791) 2025-08-29 14:46:42 +08:00
stress_single_workload_runner.py [Store] optimize stress test (#1953) 2026-04-22 16:32:01 +08:00
stress_workload_test.cpp [Store] Remove read pool and slot of stress test (#1955) 2026-04-22 19:09:51 +08:00
test_p2p_server_helpers.h [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
test_server_helpers.h [Store] Add ut for P2P-Mooncake-Store (#1715) 2026-03-23 15:08:13 +08:00
thread_pool_test.cpp code format & enable code format checking in ci (#677) 2025-08-02 15:50:25 +08:00
tiered_backend_test.cpp [Store] Make tiered scheduler incremental and harden SSD tier space management (#1675) 2026-03-23 14:01:24 +08:00
transfer_task_test.cpp feat(client): Abstract client-side data transmission for async and batch optimization (#455) 2025-06-12 16:02:48 +08:00
utils_test.cpp Refactor(store): Enable the transfer engine to autonomously detect (#817) 2025-09-10 10:05:06 +08:00