Restart support for craft client tests - #2
Conversation
…s can be used during restart
f8c9179 to
073deec
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Restart recovery currently retains stale Raft objects, loses essential state across lifecycles, and can incorrectly advance the commit frontier.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds an in-memory registry intended to preserve replica and Raft state across restarts.
Changes:
- Replaces the singleton replica manager with a type-erased registry.
- Preserves journals, indexes, Raft logs, configuration, and membership.
- Refactors Raft/server lifecycle APIs and updates build metadata.
File summaries
| File | Description |
|---|---|
tools/craft_test_driver/cluster.py |
Adjusts logging configuration. |
tools/craft_reference_tcp_srv.cpp |
Creates and passes the registry. |
src/replica_mgr.hpp |
Removes the former replica manager. |
src/replica_mgr.cpp |
Removes its implementation. |
src/registry_mgr.hpp |
Adds the generic registry. |
src/raft/raft_state_manager.hpp |
Injects registry access. |
src/raft/raft_state_manager.cpp |
Stores Raft state in the registry. |
src/raft/raft_state_machine.hpp |
Adds registry ownership plumbing. |
src/raft/raft_service.hpp |
Refactors Raft service lifecycle. |
src/raft/raft_service.cpp |
Uses registry-backed peers and managers. |
src/raft/raft_replica.hpp |
Adds restart-oriented construction parameters. |
src/raft/raft_replica.cpp |
Restores replica data and membership. |
src/net/tcp_server.hpp |
Exposes registry and Raft options. |
src/net/tcp_server.cpp |
Constructs registry-aware replicas. |
src/mem/replica.hpp |
Makes journal and index shareable. |
src/mem/replica.cpp |
Migrates map access to shared storage. |
src/helper.hpp |
Adds registry-key generation. |
conanfile.py |
Bumps the package version. |
CMakeLists.txt |
Updates targets and source ownership. |
Review details
- Files reviewed: 19/19 changed files
- Comments generated: 5
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
f729bb2 to
ece6698
Compare
…y- the log store and state machine persistence is enough
sbinmalek
left a comment
There was a problem hiding this comment.
LGTM!
Added some nit comments. Feel free to merge ahead if you want
| if (auto peers_ptr = | ||
| registry_mgr->get< partition_peers_list_t >(registry_key(partition_info_key_prefix, partition_id)); | ||
| peers_ptr) { | ||
| peers = *peers_ptr; | ||
| } |
There was a problem hiding this comment.
Can we do direct assignment to peers?
| } | ||
|
|
||
| private: | ||
| mutable std::mutex component_mutex_; |
There was a problem hiding this comment.
can we change this to shared mutex? then we can leverage shared lock instead of always taking exclusive locks
There was a problem hiding this comment.
shared_mutex has more overhead and might be an overkill for hashmap lookups.
To support test cases where the replicas need to be restarted, add a registry class which stores type erased key value pairs. Any component can store the values in the registry and recover from it in the constructor.