Browse Source

log raft state changes

pull/855/head
Chris Lu 6 years ago
parent
commit
744abc2690
  1. 3
      weed/server/master_server.go

3
weed/server/master_server.go

@ -98,6 +98,9 @@ func (ms *MasterServer) SetRaftServer(raftServer *RaftServer) {
glog.V(0).Infoln("[", ms.Topo.RaftServer.Name(), "]", ms.Topo.RaftServer.Leader(), "becomes leader.") glog.V(0).Infoln("[", ms.Topo.RaftServer.Name(), "]", ms.Topo.RaftServer.Leader(), "becomes leader.")
} }
}) })
ms.Topo.RaftServer.AddEventListener(raft.StateChangeEventType, func(e raft.Event) {
glog.V(0).Infof("state change: %+v", e)
})
if ms.Topo.IsLeader() { if ms.Topo.IsLeader() {
glog.V(0).Infoln("[", ms.Topo.RaftServer.Name(), "]", "I am the leader!") glog.V(0).Infoln("[", ms.Topo.RaftServer.Name(), "]", "I am the leader!")
} else { } else {

Loading…
Cancel
Save