myxce/.kiro/specs/raft-apply-decoupling
Rongsong Shen 9b4b805a27 feat(raft-apply-decoupling): resolve pending continuations on demotion/truncation (task 1.4)
commit_resolve_pending_above(ce, lsn_floor, rc) fails every registered
continuation for lsn > lsn_floor, reusing commit_resolve()'s existing
exactly-once/idempotent guarantee (no parallel bookkeeping path).

Truncation: a new on_truncate/truncate_cb_ctx callback on persist_t
(same inversion-of-control shape as the existing on_durable_advance
hook) fires from persist_truncate_wal_above after releasing p->lock,
only when entries were actually removed. This one wrapper covers all
three real truncation call sites: raft_cb_become_leader's
post-election truncate, the library's on_truncate_from
conflict-reconcile, and ha_demotion_convergence_fn's post-demotion
truncate.

Demotion: raft_cb_become_follower calls
commit_resolve_pending_above(&c->commit, 0, -XCE_ERR_STANDBY) --
lsn_floor=0 fails everything, since a demoted node can never
authoritatively confirm anything still pending (CP posture).

Without this, a demoted or truncated node would leave any pending
async command permanently unresolved -- the requester would simply
never get a reply, worse than today's bounded-timeout behavior.

Also closes bug-1407 (pre-existing test_config_repl flake, unrelated
to this feature) -- confirmed fixed as a side effect of prior tasks
in this series, 70/70 passing across 3 independent runs.
2026-07-03 11:58:10 +00:00
..
brief.md docs: promote raft-apply-decoupling spec family from /kiro-discovery 2026-07-03 02:41:11 +00:00
design.md feat(raft-apply-decoupling): commit engine resolve primitive + majority-ack wiring (task 1.2) 2026-07-03 09:03:50 +00:00
facts-in-raft.md docs: promote raft-apply-decoupling spec family from /kiro-discovery 2026-07-03 02:41:11 +00:00
requirements.md docs(raft-apply-decoupling): add requirements, design, and task plan 2026-07-03 07:05:28 +00:00
research.md docs(raft-apply-decoupling): add requirements, design, and task plan 2026-07-03 07:05:28 +00:00
spec.json docs(raft-apply-decoupling): add requirements, design, and task plan 2026-07-03 07:05:28 +00:00
tasks.md feat(raft-apply-decoupling): resolve pending continuations on demotion/truncation (task 1.4) 2026-07-03 11:58:10 +00:00