feat(raft-log-replication): raft_on_append_entries_reply (tasks 7.1, 7.2)

HandleAppendEntriesResponse (raft.tla:393): stale-term drop first (applied only
when reply_term==s->term, raft.tla:415, Req 5.4 — both lower and higher dropped);
success -> next_index[peer]=match_index+1, match_index[peer]=match_index (Req
5.1-5.2); failure -> next_index[peer]=Max(next-1,1) floored, match_index unchanged
(Req 5.3); no commit advance. uint64 underflow blocked by the >1 floor guard.
3 tests incl. floor-at-1 and lower/higher stale. ASAN green.
This commit is contained in:
Rongsong Shen 2026-06-21 16:26:42 +00:00
parent 3c5185a5c3
commit eeb95591ae
3 changed files with 144 additions and 2 deletions

View file

@ -120,14 +120,14 @@
## 7. HandleAppendEntriesResponse — raft_on_append_entries_reply (raft.tla:393)
- [ ] 7.1 RED: reply advance/decrement/stale-drop tests
- [x] 7.1 RED: reply advance/decrement/stale-drop tests
- Test: success sets `next_index[peer]=matchIndex+1`, `match_index[peer]=reply.matchIndex`; failure sets `next_index[peer]=Max(next_index[peer]-1,1)` (floor at 1), `match_index` unchanged; a reply with `reply_term != currentTerm` is ignored
- Observable completion: tests compile and FAIL
- _Requirements: 5.1, 5.2, 5.3_
- _Boundary: test_raft.c_
- _Depends: 2.2_
- [ ] 7.2 GREEN: implement `raft_on_append_entries_reply`
- [x] 7.2 GREEN: implement `raft_on_append_entries_reply`
- Stale-term drop; success/failure branches; `next_index` floored at 1; do NOT recompute or advance any commit index from `match_index`
- Observable completion: 7.1 tests pass
- _Requirements: 5.1, 5.2, 5.3, 5.4_