feat(raft-sim-conformance): drop/duplicate/reorder adversarial scenario (task 5.3)
This commit is contained in:
parent
6976392d77
commit
e445404439
3 changed files with 186 additions and 1 deletions
|
|
@ -1013,6 +1013,30 @@ int raft_sim_scenario_partition_heal(raft_sim_cluster_t *c, int n, uint64_t seed
|
|||
*/
|
||||
int raft_sim_scenario_restart_churn(raft_sim_cluster_t *c, int n, uint64_t seed);
|
||||
|
||||
/*
|
||||
* raft_sim_scenario_drop_dup_reorder: drop/duplicate/reorder scenario (raft-sim-
|
||||
* conformance task 5.3; Req 4.3). Initializes the caller's cluster from (n,
|
||||
* election_timeout=2000, seed), then:
|
||||
* 1. drives it to a single leader + replicated entries,
|
||||
* 2. PERTURBS the unified message bag — DROPs some in-flight messages
|
||||
* (raft_sim_bag_drop), DUPLICATEs some (raft_sim_bag_duplicate, so an
|
||||
* AppendEntries / vote response is delivered MORE THAN ONCE), and REORDERs
|
||||
* delivery (raft_sim_bag_pick PRNG order, not FIFO) through the real handlers
|
||||
* (raft_sim_bag_deliver),
|
||||
* 3. because dropped messages leave followers behind, the leader RETRANSMITs over
|
||||
* additional replicate rounds until the logs converge (bounded).
|
||||
* raft_sim_check_all is run after EVERY action it applies — DURING perturbation and
|
||||
* after each retransmit — so a violation is caught the moment it appears (Req 4.1). A
|
||||
* duplicated AppendEntries is a no-op (the library's already-have branch): delivering
|
||||
* the same AE twice never grows or corrupts the follower's log. Returns 0 if the
|
||||
* scenario completes with ZERO invariant violations AND every node's log converged to
|
||||
* the leader's tip (idempotent convergence); < 0 (the negated first failing invariant,
|
||||
* matching raft_sim_step) on any violation, after dumping the replayable trace to
|
||||
* stderr. Returns -1 on an invalid node count (n < 3). Drives only via published
|
||||
* library entry points + harness bag primitives — no protocol re-implementation.
|
||||
*/
|
||||
int raft_sim_scenario_drop_dup_reorder(raft_sim_cluster_t *c, int n, uint64_t seed);
|
||||
|
||||
#endif /* XCE_TESTING */
|
||||
|
||||
#endif /* RAFT_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue