feat(ha-commit-durability): gate legacy sync-append commit store on durable_lsn + commit<=durable invariant (task 2.4)

This commit is contained in:
Rongsong Shen 2026-06-18 07:09:47 +00:00
parent e4c4968331
commit 526bca9679
5 changed files with 250 additions and 4 deletions

View file

@ -154,6 +154,12 @@ static void commit_advance_locked(commit_engine_t* ce)
#ifdef XCE_TESTING
assert(cand > cur); /* monotonic advance only */
assert(cand <= highest_appended_lsn(ce->p)); /* never beyond the log */
/* DURABLE-COMMIT INVARIANT (ha-commit-durability task 2.4, Req 1.1/1.2):
* committed_lsn must never advance past what is durable locally. The
* candidate is already durable-capped by majority_candidate_locked (self
* caps at persist_durable_lsn), so this must hold — it guards against a
* future change that reintroduces an ACK-without-durability advance. */
assert(cand <= persist_durable_lsn(ce->p));
#endif
atomic_store(&ce->p->committed_lsn, cand);