EARS requirements for a controller status query (XCE lsid analog): primary identity (unknown when unelected), answered-by node+role (distinct from cluster view), configured peers+count, committed config version + content checksum (catch same-version divergence), term/commit-apply/fenced/cluster-name, failover-aware delivery, test-client command, and wait-primary switching its probe to it. C tier only.
2.8 KiB
Requirements Document
Project Description (Input)
Add an LSF-lsid-style controller status opcode (C tier only) so a client can query basic cluster/controller identity and health in one cheap call.
Returns:
- Which node is the current PRIMARY (name; empty/none if mid-election)
- The responding node's role (PRIMARY/STANDBY/ELECTING/INIT)
- The configured controllers/peers (name + host:port list and count)
- The configuration version (the HA committed
config_tag) - Additional status: current term (election epoch),
committed_lsn/applied_lsn(catch-up/health), cluster name, serving/fenced state
Answerable by ANY node (a standby reports who the primary is from its ctrlhello/heartbeat state), so lsid works even when the query doesn't land on the primary; it is a failover-aware READ like the existing clusterconf op. All the underlying data already exists in src/controller/ha.h (ha->role, ha->term, committed_config_tag, committed_lsn, peer/candidate list).
Components (C tier):
src/schema/controller.capnp— newCtrlInfo/CtrlStatusstruct + request opcode + reply-union member, modeled on the existingclusterconfopcode (controller.capnp:489).- Controller
handle_ctrlinfohandler mirroringhandle_clusterconf. - libxce
xce_ctrlinfo_req/xce_ctrlinfo/xcecli_ctrlinfo(+ free helper) as a failover-aware read. src/controller/testsuite/test.c— actrlinfo/lsidclient command that prints the status, AND switchcmd_wait_primary's probe fromjoblist_queryto this lighter, more-direct status op. (wait-primarycurrently piggybacks onjoblistpurely to avoid a new opcode; with this op it becomes a cheap "is a serving primary present + who" probe that can also report the elected primary and term — better diagnostics, directly useful for theha-commit-durabilityPhase 6 liveness / >60s-election investigation.)
KEY DESIGN DECISION the spec must resolve: whether to EXTEND the existing clusterconf opcode (which already returns much richer cluster detail — name/resources/queues/workers) with these HA-status fields, OR add a separate lean status op. lsid wants a fast focused identity/health view, not the full resource/queue/worker dump, so the leaning is a dedicated lean op, but the spec should weigh reuse vs separation explicitly.
IN SCOPE: C tier only (controller opcode + libxce + xce_test command + wait-primary integration).
OUT OF SCOPE: the Go CLI/REST xce lsid surface (a later pass); changing HA/election/replication behavior (this only READS existing HA state); structured/JSON output beyond the capnp reply.
This is the "controller status/probe opcode" that the xce-test-e2e-primitives spec explicitly deferred as out-of-scope.