Skip to content

feat(cli,quorum): kates raft ps shows every quorum member's Raft state - #700

Merged
bmscomp merged 3 commits into
mainfrom
feat/raft-ps
Nov 18, 2026
Merged

bmscomp merged 3 commits into
mainfrom
feat/raft-ps

Conversation

@bmscomp

@bmscomp bmscomp commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

kates raft ps prints the Raft state of every Kates quorum member (Apache Ratis, operator mode):

MEMBER   ROLE      TERM  COMMIT  APPLIED  LAG  LAST CONTACT
kates-0  LEADER    7     1042    1042     0    -
kates-1  FOLLOWER  7     1039    1039     3    40ms
kates-2  UNREACHABLE  -  -       -        -    -
  TimeoutIOException: no reply

  leader kates-0 for 3h12m0s · quorum OK (2/3) · answered by kates-1

How

  • GET /api/quorum (read scope, new QuorumResource): the answering member asks each member, itself included, for its Ratis group info (GroupManagementApi.info) over the client it already holds on the members' mutual-TLS port. Each row has role, term, time in role, commit/applied/last/snapshot index and storage health; the leader's reply adds the last contact with each follower. A member that does not answer within 800 ms carries only error. A Kates running alone returns enabled: false.
  • CLI: kates raft ps (and -o json) computes the lag behind the leader's commit index and a majority check. Always enabled, like health.
  • Documented in docs/book/11-api-reference.md.

Limits

  • Ratis does not expose election counts or follower match indexes over RPC; the term and the commit-index lag stand in.
  • On followers, term is the term of the last entry: the current term once the leader has committed its first entry.

Tests

  • QuorumMemberTest.anyMemberReportsEveryMemberAndOneThatDoesNotAnswer: three real members over mTLS; a follower sees all three with the right leader, term and last contact, and a stopped member as an error row. All 11 QuorumMemberTest pass, plus EndpointScopesTest and QuorumGateTest.
  • cli/cmd/raft_test.go: healthy, no-quorum and alone cases; full CLI suite passes.

Not run on a live operator-mode cluster or in the native image yet: the native build may need reflection config for the Ratis group-info protos.

GET /api/quorum asks each member, itself included, for its Ratis group
info over the members' mutual-TLS client: role, term, time in role,
commit/applied/last/snapshot index, storage health, and from the leader
how long ago it last heard from each follower. Any member answers with
the whole quorum; a member that does not answer within 800 ms carries
only its error.

kates raft ps prints one row per member with its lag behind the leader's
commit index, and a summary line naming the leader, how long it has led,
and whether a majority answered. It needs no command profile.
@bmscomp
bmscomp merged commit 553b851 into main Nov 18, 2026
69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant