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

@ -78,6 +78,12 @@ static void majority_setup(int n_peers, int n_standbys, uint64_t appended_lsn)
}
g_mp.current_lsn = appended_lsn + 1;
atomic_store(&g_mp.committed_lsn, 0);
/* ha-commit-durability 2.2: the commit majority now caps self at
* durable_lsn. This stub has no flusher, so mark every appended entry
* durable up front to preserve the pre-durability model ("self covers
* every appended entry"); the durability precondition is exercised
* separately in test_commit_durability.c / test_commit_engine.c. */
atomic_store(&g_mp.durable_lsn, appended_lsn);
TEST_ASSERT_EQUAL_INT(0, commit_engine_init(&g_meng, &g_mp, n_peers, 8));
repl_set_commit_engine(&g_mp.repl, &g_meng);