From 87242aa8e90075f62b9a5a0b2571bb70a414c324 Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Mon, 22 Jun 2026 15:02:21 +0000 Subject: [PATCH] =?UTF-8?q?spec(ha-term-safety):=20add=20task=203.4=20?= =?UTF-8?q?=E2=80=94=20retire=20term-0=20repl=5Fbroadcast,=20drive=20live?= =?UTF-8?q?=20library=20send=20(closes=20bug-990)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .kiro/specs/ha-term-safety/tasks.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.kiro/specs/ha-term-safety/tasks.md b/.kiro/specs/ha-term-safety/tasks.md index 2330efbd..4e285fba 100644 --- a/.kiro/specs/ha-term-safety/tasks.md +++ b/.kiro/specs/ha-term-safety/tasks.md @@ -84,6 +84,13 @@ - _Requirements: 4.1, 4.5_ - _Depends: 2.5, 3.2_ +- [ ] 3.4 Retire the term-0 `repl_broadcast` live send and drive the library send loop on the live primary (the deferred live-send cutover) + - Make the LIVE primary replicate via the library send (`raft_send_append_entries`/the library's per-peer send) so `on_send_append_entries` (task 2.3) fires on the real replication path, carrying the leader's term; retire/replace the term-0 `repl_broadcast` (`persist.c:747`) as the live replicator so standbys no longer receive term-0 entries. Standbys must intake every replicated entry through `raft_on_append_entries_request` (task 3.2 route) and persist `hdr.term = leader_term` (not 0); retire the legacy direct-apply branch (`ha_apply_wal_catchup_entry` gated `entry->term != 0`) as the live intake. Preserve persist-before-ACK + the commit barrier + 848/849/850 + the bug-850 contiguity guard; keep `next_index[]`/`match_index[]` driven by the ACK path (3.3) so commit advances live. + - Observable completion: on a live cluster a primary `jobsub`-driven append replicates a term-CARRYING AppendEntries; standbys persist the leader's real term (recovered `hdr.term == leader_term`, not 0); a clean failover converges to byte-identical `(term,lsn)` WALs (closes the bug-990 / R5.1 term-identity gap); the library `commit_index` advances from live quorum ACKs. + - _Requirements: 1.1, 1.2, 1.3, 1.4, 2.5, 4.1_ + - _Boundary: repl.c / persist.c / ha.c live replication path (send + intake cutover)_ + - _Depends: 3.1, 3.2, 3.3_ + ## 4. Configuration ordering as a unified `(term,lsn)` marker (R7) - [x] 4.1 Add the `WAL_CONFIG_MARKER` entry type and reference payload