Skip to content

[raft] Implement the membership of Raft groups in the Raft stores - #1902

Merged
MariemBaccari merged 1 commit into
interuss:masterfrom
Orbitalize:implement_admin_interface
Nov 9, 2026
Merged

MariemBaccari merged 1 commit into
interuss:masterfrom
Orbitalize:implement_admin_interface

Conversation

@MariemBaccari

@MariemBaccari MariemBaccari commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

This PR partially addresses #1719. It makes the raftstore implement the membership management. To achieve that, the store now embeds the consensus instance to avoid having redundant wrappers.
Adding a node only takes its URL, so the ID generated by the node has to be read from the node itself using GET /raft/node which is served on the Raft listener.

@MariemBaccari
MariemBaccari marked this pull request as draft November 4, 2026 08:44
@MariemBaccari
MariemBaccari force-pushed the implement_admin_interface branch from 46a600f to e021ddf Compare November 4, 2026 09:34
@MariemBaccari
MariemBaccari marked this pull request as ready for review November 4, 2026 09:41
@MariemBaccari
MariemBaccari force-pushed the implement_admin_interface branch 4 times, most recently from e13c87f to 719b757 Compare November 5, 2026 13:11
@MariemBaccari MariemBaccari changed the title [raft] Implement admin.RaftGroup in the Raft stores [raft] Implement the membership of Raft groups in the Raft stores Nov 5, 2026

@mickmis mickmis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not excited about introducing yet another interface but I've tried thinking about an alternative but could not come with something better.
FWIW it looks like (if Gemini did not hallucinate) etcd does deterministically generate the ID out of the peer URL and the current timestamp. But then the waiting node still has to fetch from a /members endpoint its own ID, because it does not know the timestamp. So even though they do it in reverse, they still have to expose some additional interface.

Otherwise LGTM modulo comments.

Comment thread pkg/raftstore/params/params.go Outdated
defaultMaxSizePerMsg = 1024 * 1024
defaultMaxInflightMsgs = 4096 / 8

defaultPeerRequestTimeout = 5 * time.Second

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this chosen?
And do we really want to implement this specific timeout? From a user POV this will always be embedded into another operation. I'd expect having control over the timeout of e.g. the whole 'add a node' rather than the specific request to the peer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I removed the parameter.

Comment thread pkg/raftstore/consensus/consensus.go Outdated
logger *zap.Logger

nodeID uint64
url string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO clearer:

Suggested change
url string
publicURL string

@@ -0,0 +1,30 @@
package consensus

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated with #1896?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I wanted to keep the PRs separate. It will be deduplicated during merging / fixing conflicts.

Comment thread pkg/raftstore/consensus/peernode.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider putting into their own struct (with peerClient + creation of handler). That would help clarify in terms of abstractions that is responsible of this additional HTTP interface.

Comment thread pkg/raftstore/consensus/peernode.go Outdated
return Node{}, stacktrace.NewErrorWithCode(dsserr.BadRequest, "invalid URL %q: %v", peerURL, err)
}

req, err := http.NewRequestWithContext(ctx, http.MethodGet, peerURL+nodePath, nil)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may cause issues with extra or missing /: check url.JoinPath.

Comment thread pkg/raftstore/consensus/node.go Outdated
type NodeState string

const (
NodeWaiting NodeState = "waiting"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please be more specific on what the node is waiting for.

}

// state returns the state of this node, which is a member of its group from its first start or was removed from it.
func (c *Consensus) state() NodeState {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the 'waiting' state? If not in implementation I'd expect a comment mentioning why it cannot be in waiting here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The node can't be waiting at this point since we still form the groups with --raft_peers. The waiting state comes with #1908.

@MariemBaccari
MariemBaccari force-pushed the implement_admin_interface branch 2 times, most recently from 1a7acf9 to db5f7c8 Compare November 9, 2026 13:58
@MariemBaccari
MariemBaccari force-pushed the implement_admin_interface branch from db5f7c8 to 0ef8942 Compare November 9, 2026 14:01
@MariemBaccari
MariemBaccari merged commit d4a6633 into interuss:master Nov 9, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants