MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / applyConfChange

Method applyConfChange

worker/draft.go:291–308  ·  view source on GitHub ↗
(e raftpb.Entry)

Source from the content-addressed store, hash-verified

289}
290
291func (n *node) applyConfChange(e raftpb.Entry) {
292 var cc raftpb.ConfChange
293 if err := cc.Unmarshal(e.Data); err != nil {
294 glog.Errorf("While unmarshalling confchange: %+v", err)
295 }
296
297 if cc.Type == raftpb.ConfChangeRemoveNode {
298 n.DeletePeer(cc.NodeID)
299 } else if len(cc.Context) > 0 {
300 var rc pb.RaftContext
301 x.Check(proto.Unmarshal(cc.Context, &rc))
302 n.Connect(rc.Id, rc.Addr)
303 }
304
305 cs := n.Raft().ApplyConfChange(cc)
306 n.SetConfState(cs)
307 n.DoneConfChange(cc.ID, nil)
308}
309
310var errHasPendingTxns = errors.New("Pending transactions found. Please retry operation")
311

Callers 1

RunMethod · 0.95

Calls 7

CheckFunction · 0.92
DeletePeerMethod · 0.80
RaftMethod · 0.80
SetConfStateMethod · 0.80
DoneConfChangeMethod · 0.80
ConnectMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected