Repository navigation
Promote cluster.peers learners as they catch up; no 503 after /health is 200 - #126
Conversation
… is 200 A cluster formed through the deprecated `cluster.peers` left every node but the first a Raft learner, Syncing, its /health on 503 for good: - The bootstrap node promoted learners only once every configured peer was reachable and caught up. With ordered startup (a StatefulSet's OrderedReady, or a script) the next node starts only when this one is Ready, and a learner never is. Each learner is now promoted as soon as it has caught up, up to five voters. - Every pass re-proposed each known peer as a learner, appending a membership entry just before checking that learners had matched the log tail, so none ever had. A peer is now proposed once. A node's first writes after its /health turned 200 could get an empty 503: - /health reports a node Raft serves as a voter as Active while its own record still says Syncing; /write refused on the record. It now follows /health. - A node that had synced but holds no data (a new, empty cluster) was treated as new by the leader's sync trigger and re-joined, which flipped it to Syncing. It now reconnects, which stays Active for a small gap. 3-node ordered start: node 2 healthy after 7 s, node 3 after 11 s, all voters (before: learners, 503, indefinitely). Write straight after /health 200 on every node: 0 503s in 9 of 10 fresh clusters (before: 4 of 6 had one). The remaining case is a node writing in the second or two before the leader adds it as a learner.
PR SummaryMedium Risk Overview Aligns the data plane with that readiness model: Adds unit tests for Reviewed by Cursor Bugbot for commit 853e6ee. Configure here. |


A cluster formed through the deprecated
cluster.peersleft every node but the first as a Raft learner, stuck in Syncing, with/healthreturning 503 indefinitely. There were two causes inraft_formation.rs:A node's first writes after its
/healthturned 200 could get an empty 503. Two causes:/healthreports a node that Raft serves as a voter as Active, even while its own record still says Syncing./writerefused based on the record; it now follows/health.Results, 3 nodes, ordered start:
/healthreturns 200, on every node: fresh clusters with a 503 went from 4 of 6 to 1 of 12. The remaining case is a write to a node in the second or two before the leader adds it as a learner; that 503 is retryable, and the proxy retries it.Unit tests cover the formation planning: a caught-up learner is promoted without waiting for every peer, a lagging one waits, a known learner isn't re-added, and voters stop at five. The CI-equivalent run (libchdb 26.9.0,
-D warnings) passes.