* [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>