feat(ha-commit-engine): WAIT mode, admission cap, writable_lsn gate (task 2.2)

commit_submit(WAIT): n_vcpus-relative admission cap with fast retriable
NOT_READY (admission-cap-only per corrected contract), CLOCK_REALTIME
timedwait loop on the per-LSN + gate predicate, post-timeout predicate
re-check, n_peers<=1 self-quorum through the single advancement site.
Inflight counter accurate under engine lock for the full blocking
interval with XCE_TESTING asserts. 16/16 group tests green unmodified;
full suite at the 3-failure baseline.
This commit is contained in:
Rongsong Shen 2026-06-11 15:24:30 +00:00
parent d91f446e9e
commit 3bc6fd14de
3 changed files with 113 additions and 7 deletions

View file

@ -23,7 +23,7 @@
- Observable completion: new cases FAIL (red) against the task-1 engine
- _Requirements: 1.1, 4.3, 4.4, 6.3, 7.1, 7.2, 7.3_
- [ ] 2.2 Implement WAIT mode, admission counter, and writable_lsn gate to green
- [x] 2.2 Implement WAIT mode, admission counter, and writable_lsn gate to green
- `commit_submit(WAIT)`: admission check (`inflight_waits >= max(1, n_vcpus - COMMIT_WAIT_RESERVED)` → `-XCE_ERR_NOT_READY`, distinct log message), `pthread_cond_timedwait` loop with per-LSN predicate (`committed_lsn >= lsn && (writable_lsn == 0 || committed_lsn >= writable_lsn)`), `-ETIMEDOUT` on deadline; `n_peers <= 1` immediate self-quorum success advancing `committed_lsn`; `commit_set_writable_lsn` stores the gate (no caller in this spec)
- XCE_TESTING assert: inflight counter within cap and never negative
- Observable completion: all task 2.1 tests PASS; cap is expressed only relative to the `n_vcpus` init argument (no absolute constant other than the reserved headroom)