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
|
|
@ -1342,6 +1342,29 @@ int cluster_init_phase2(cluster_t* c)
|
|||
c->ha.repl = &c->persist.repl;
|
||||
INFO("commit engine wired (n_peers=%d, n_vcpus=%d)",
|
||||
c->ha.n_peers, c->vtaskmgr.n_vcpus);
|
||||
|
||||
/* raft-drive-async task 1.1: resolve and log the peer-scaled liveness
|
||||
* reservation at init — both inputs (n_peers, n_vcpus) are final here.
|
||||
* Single source of truth: task 1.6 (LivenessAdmission) consumes this
|
||||
* value, it does NOT recompute the clamp/WARN. */
|
||||
int liveness_reserved =
|
||||
drive_async_liveness_reserved(c->ha.n_peers, c->vtaskmgr.n_vcpus);
|
||||
INFO("drive-async: VTASK_LIVENESS_RESERVED=%d (n_peers=%d, n_vcpus=%d; "
|
||||
"commit/REQ_BLOCK cap=%d)",
|
||||
liveness_reserved, c->ha.n_peers, c->vtaskmgr.n_vcpus,
|
||||
c->vtaskmgr.n_vcpus - liveness_reserved);
|
||||
if (c->vtaskmgr.n_vcpus < c->ha.n_peers) {
|
||||
/* Under-provisioned: the n_vcpus ceiling clamped the reservation
|
||||
* below the ideal n_peers-1. Still correct (deadlock-free via fast
|
||||
* worker cycling), but operator-visible per CLAUDE.md fail-loud.
|
||||
* A controller NEVER self-terminates on this condition. */
|
||||
WARN("drive-async: under-provisioned controller — n_vcpus=%d < "
|
||||
"n_peers=%d; liveness reservation clamped to %d (ideal %d). "
|
||||
"Per-peer liveness latency may rise under load; consider "
|
||||
"raising --vcpus. Cluster remains correct and stays up.",
|
||||
c->vtaskmgr.n_vcpus, c->ha.n_peers, liveness_reserved,
|
||||
c->ha.n_peers - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Role set by ha_elect_evaluate_and_signal() inside cluster_run() */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue