feat(raft-drive-async): add drive-async config constants + liveness-reservation helper (task 1.1)
drive_async_liveness_reserved = max(1, min(n_peers-1, n_vcpus-1)) — single source of truth for VTASK_LIVENESS_RESERVED (deadlock-freedom floor applied last). New DEFAULT_CONNECT_TIMEOUT_MS / DEFAULT_SLOWLANE_* constants. Resolved reservation logged at init; under-provisioned (n_vcpus<n_peers) clamp WARNs loudly, never self-terminates. 8 unit cases, mutation-verified.
This commit is contained in:
parent
295769d8ae
commit
729055a37f
8 changed files with 329 additions and 0 deletions
|
|
@ -618,6 +618,34 @@ void ha_compute_safe_committed_lsn(ha_elect_ctx_t *ctx,
|
|||
* producing divergent WALs and a permanent prevote deadlock. */
|
||||
uint64_t ha_promotion_truncate_floor(uint64_t safe_lsn, uint64_t durable_tip);
|
||||
|
||||
/* ── raft-drive-async task 1.1: peer-scaled liveness reservation ─────────────
|
||||
*
|
||||
* drive_async_liveness_reserved: PURE derivation of VTASK_LIVENESS_RESERVED —
|
||||
* the number of vtask-pool workers kept free for liveness-critical handling
|
||||
* (heartbeat/vote/ack) so they are never starved by blocking offloaded tasks.
|
||||
*
|
||||
* reserved = clamp(n_peers - 1, 1, n_vcpus - 1)
|
||||
* = max(1, min(n_peers - 1, n_vcpus - 1))
|
||||
*
|
||||
* - n_peers is the TOTAL cluster size including self (matches ha->n_peers).
|
||||
* Per-endpoint serialization (endpoint_block_tasks) caps in-flight work at
|
||||
* one per peer connection, so worst-case concurrent liveness work is the
|
||||
* n_peers-1 OTHER peers (one ack/vote each) — reserving n_peers-1 means no
|
||||
* peer's liveness message queues behind a busy reserved worker (a LATENCY
|
||||
* optimization).
|
||||
* - Floor 1 is the hard CORRECTNESS invariant (deadlock-freedom): one
|
||||
* guaranteed-free worker + liveness-never-gated + sub-ms cycling is
|
||||
* deadlock-free regardless of peer count. Applied LAST so it always wins.
|
||||
* - Ceiling n_vcpus-1 keeps >=1 REQ_BLOCK (commit) slot, so the commit cap
|
||||
* (n_vcpus - reserved) is never 0.
|
||||
*
|
||||
* On an under-provisioned box (n_vcpus < n_peers) the ceiling clamps the
|
||||
* result below n_peers-1; the result is still correct via fast cycling.
|
||||
* The CALLER (controller init) is responsible for emitting a loud WARN in
|
||||
* that case so the under-provisioning is operator-visible — this helper is
|
||||
* pure and never logs. Controllers NEVER self-terminate on this condition. */
|
||||
int drive_async_liveness_reserved(int n_peers, int n_vcpus);
|
||||
|
||||
/* ── ha-commit-durability task 4.3: pre-promotion eligibility gate ──────────
|
||||
*
|
||||
* ha_promotion_gate_decision: PURE pre-promotion eligibility decision (Req 2.2,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue