From 744abc2690a551f1e76e4e12690754b322f383de Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 9 Feb 2019 12:51:14 -0800 Subject: [PATCH] log raft state changes --- weed/server/master_server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/weed/server/master_server.go b/weed/server/master_server.go index f22925e56..492bb76e9 100644 --- a/weed/server/master_server.go +++ b/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.") } }) + ms.Topo.RaftServer.AddEventListener(raft.StateChangeEventType, func(e raft.Event) { + glog.V(0).Infof("state change: %+v", e) + }) if ms.Topo.IsLeader() { glog.V(0).Infoln("[", ms.Topo.RaftServer.Name(), "]", "I am the leader!") } else {