MCPcopy
hub / github.com/dgraph-io/dgraph / addToCluster

Method addToCluster

conn/node.go:589–611  ·  view source on GitHub ↗
(ctx context.Context, rc *pb.RaftContext)

Source from the content-addressed store, hash-verified

587}
588
589func (n *Node) addToCluster(ctx context.Context, rc *pb.RaftContext) error {
590 pid := rc.Id
591 rc.SnapshotTs = 0
592 rcBytes, err := proto.Marshal(rc)
593 x.Check(err)
594
595 cc := raftpb.ConfChange{
596 Type: raftpb.ConfChangeAddNode,
597 NodeID: pid,
598 Context: rcBytes,
599 }
600 if rc.IsLearner {
601 cc.Type = raftpb.ConfChangeAddLearnerNode
602 }
603
604 err = errInternalRetry
605 for err == errInternalRetry {
606 glog.Infof("Trying to add %#x to cluster. Addr: %v\n", pid, rc.Addr)
607 glog.Infof("Current confstate at %#x: %+v\n", n.Id, n.ConfState())
608 err = n.ProposeConfChange(ctx, cc)
609 }
610 return err
611}
612
613// ProposePeerRemoval proposes a new configuration with the peer with the given id removed.
614func (n *Node) ProposePeerRemoval(ctx context.Context, id uint64) error {

Callers 1

joinClusterMethod · 0.95

Calls 4

ConfStateMethod · 0.95
ProposeConfChangeMethod · 0.95
CheckFunction · 0.92
InfofMethod · 0.80

Tested by

no test coverage detected