feat(ha-commit-durability): cap commit self-contribution at durable_lsn + durable-advance commit wake (task 2.2)

This commit is contained in:
Rongsong Shen 2026-06-18 06:29:47 +00:00
parent cc83caf5a0
commit c41edc515e
10 changed files with 395 additions and 13 deletions

View file

@ -496,6 +496,11 @@ static void barrier_setup_vcpus(int n_peers, int n_standbys,
g_bp.current_lsn = current_lsn;
atomic_store(&g_bp.committed_lsn, 0);
/* ha-commit-durability 2.2: self caps at durable_lsn. This stub has no
* flusher, so treat the whole appended log (current_lsn - 1) as durable
* up front, preserving the pre-durability "self covers every appended
* entry" model. (current_lsn == 0 → nothing appended → durable 0.) */
atomic_store(&g_bp.durable_lsn, current_lsn > 0 ? current_lsn - 1 : 0);
TEST_ASSERT_EQUAL_INT(0,
commit_engine_init(&g_bce, &g_bp, n_peers, n_vcpus));