Raft Group in DGraph


(Near) #1

Hi all,

I’m reading DGraph documents and source code recently. The document mentions that there is one raft group for each data group (the group for several tablets). I think, just like CockroachDB, the reason of having multiple raft groups is that we want to restrict the number of members in one group. However, I can’t find how DGraph does this in the source code. Could you give me some guidance?

Thanks!


(Michel Conrado) #2

You can find about Raft here https://docs.dgraph.io/design-concepts/#raft

There’s a interactive visualization.

In the source code, only using Github search. https://github.com/dgraph-io/dgraph/search?q=raft&unscoped_q=raft


(Near) #3

Sorry, let me clarify a little bit.

In https://docs.dgraph.io/design-concepts/#consistency-models, it says each group is a raft group. My understanding is only the alpha server which serves that group is a member of the corresponding raft group. However, in the source code, when starting raft, it seems all alpha servers join the same raft cluster.


(Near) #4

I checked the source code again and realized that I misunderstood the etcd raft API. The code works as I expected. When the zero server responds to alpha nodes, the response includes the peers of the raft group. And it is empty when the alpha node joins a new group.