mirror of https://github.com/status-im/consul.git
consul: Do not remove ourself as raft peer in Serf event handler
This commit is contained in:
parent
4c27d125ac
commit
6446df65bf
|
@ -469,9 +469,11 @@ func (s *Server) handleReapMember(member serf.Member) error {
|
||||||
// handleDeregisterMember is used to deregister a member of a given reason
|
// handleDeregisterMember is used to deregister a member of a given reason
|
||||||
func (s *Server) handleDeregisterMember(reason string, member serf.Member) error {
|
func (s *Server) handleDeregisterMember(reason string, member serf.Member) error {
|
||||||
state := s.fsm.State()
|
state := s.fsm.State()
|
||||||
// Check if the node does not exists
|
// Do not deregister ourself. This can only happen if the current leader
|
||||||
_, found, _ := state.GetNode(member.Name)
|
// is leaving. Instead, we should allow a follower to take-over and
|
||||||
if !found {
|
// deregister us later.
|
||||||
|
if member.Name == s.config.NodeName {
|
||||||
|
s.logger.Printf("[WARN] consul: deregistering self (%s) should be done by follower", s.config.NodeName)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,11 +485,9 @@ func (s *Server) handleDeregisterMember(reason string, member serf.Member) error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not deregister ourself. This can only happen if the current leader
|
// Check if the node does not exists
|
||||||
// is leaving. Instead, we should allow a follower to take-over and
|
_, found, _ := state.GetNode(member.Name)
|
||||||
// deregister us later.
|
if !found {
|
||||||
if member.Name == s.config.NodeName {
|
|
||||||
s.logger.Printf("[WARN] consul: deregistering self (%s) should be done by follower", s.config.NodeName)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue