Remove stale raft servers differently depending on minRaftVersion

pull/2845/head
Kyle Havlovitz 8 years ago
parent 0cc024399d
commit e74e83fc6c
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C

@ -123,9 +123,23 @@ func (s *Server) pruneDeadServers() error {
s.logger.Printf("[INFO] consul: Attempting removal of failed server: %v", server)
go s.serfLAN.RemoveFailedNode(server)
}
minRaftProtocol, err := ServerMinRaftProtocol(s.serfLAN.Members())
if err != nil {
return err
}
for _, raftServer := range staleRaftServers {
s.logger.Printf("[INFO] consul: Attempting removal of stale raft server : %v", raftServer.ID)
s.raft.RemoveServer(raftServer.ID, 0, 0)
var future raft.Future
if minRaftProtocol >= 2 {
s.logger.Printf("[INFO] consul: Attempting removal of stale raft server : %v", raftServer.ID)
future = s.raft.RemoveServer(raftServer.ID, 0, 0)
} else {
s.logger.Printf("[INFO] consul: Attempting removal of stale raft server : %v", raftServer.ID)
future = s.raft.RemovePeer(raftServer.Address)
}
if err := future.Error(); err != nil {
return err
}
}
} else {
s.logger.Printf("[DEBUG] consul: Failed to remove dead servers: too many dead servers: %d/%d", removalCount, peers)

Loading…
Cancel
Save