test(raft-log-replication): close Req 8.3 node-restart with sim restart primitive
raft_sim_restart_node models a process restart: the durable in-memory log[] (WAL) and persisted (term, voted_for) survive, while volatile consensus state is cleared by re-running raft_init (returns the node to FOLLOWER). Callbacks, ctx, idx, and partition flag are preserved. test_sim_9_5_node_restart_resumes_replication restarts a follower mid-replication (partial 2-of-3 log), asserts the log survived (load-bearing: log_count==2 would fail if wiped), role/term restored, then replication resumes and converges with Log Matching. Closes the 8.3 'node restart while replication proceeds' sub-clause (8/8 requirement sections now fully covered). ASAN green (220 tests).
This commit is contained in:
parent
0dbccf4b0a
commit
3d6dc9cc56
4 changed files with 116 additions and 1 deletions
|
|
@ -513,6 +513,18 @@ void raft_sim_partition(raft_sim_cluster_t *c, int node_idx, int isolated);
|
|||
*/
|
||||
int raft_sim_check_log_matching(const raft_sim_cluster_t *c);
|
||||
|
||||
/*
|
||||
* raft_sim_restart_node: model a process restart of node_idx (Req 8.3).
|
||||
*
|
||||
* Durable state survives a restart: the in-memory log[] (which models the WAL on
|
||||
* disk) and the persisted (term, voted_for) are retained. Volatile consensus
|
||||
* state (role, votes, election bookkeeping, leader progress) is cleared by
|
||||
* re-running raft_init with the restored (term, voted_for, log_count), returning
|
||||
* the node to FOLLOWER. The four callbacks, ctx, idx, and partition flag are
|
||||
* preserved. Returns raft_init's status (0 on success).
|
||||
*/
|
||||
int raft_sim_restart_node(raft_sim_cluster_t *c, int node_idx);
|
||||
|
||||
#endif /* XCE_TESTING */
|
||||
|
||||
#endif /* RAFT_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue