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:
Rongsong Shen 2026-06-26 04:58:07 +00:00
parent 295769d8ae
commit 729055a37f
8 changed files with 329 additions and 0 deletions

View file

@ -94,4 +94,25 @@ typedef uint64_t jobid_t;
#define DEFAULT_HB_INTERVAL_MS 3000
#define DEFAULT_MAX_WAL_RECORDS 10000
/* ======================================================
* raft-drive-async constants (task 1.1)
* Non-blocking Raft drive: bounded peer connect + slow-lane executor +
* pool-level liveness reservation. All overridable via myconf_t (0 = use
* the default below); see drive_async_liveness_reserved() in ha.h for the
* peer-scaled reservation derivation.
* ====================================================== */
/* R2.3: bound the peer connect attempt so an unreachable peer cannot stall
* the delaymgr heartbeat thread for the OS connect timeout. BoundedConnect
* polls up to this many ms after a non-blocking connect() before failing. */
#define DEFAULT_CONNECT_TIMEOUT_MS 1000
/* SlowLane executor sizing (task 1.2 consumes these). Dedicated worker
* threads isolated from the vtask request pool; sized to peer count so a
* snapshot transfer and a reconnect to distinct peers do not starve each
* other. MAX_HA_CANDIDATES (4) bounds a supported cluster, so a small
* constant covers reconnect + transfer per peer without over-allocating. */
#define DEFAULT_SLOWLANE_WORKERS 4
#define DEFAULT_SLOWLANE_MAX_INFLIGHT 8
#endif