mirror of
https://github.com/status-im/consul.git
synced 2025-01-12 06:44:41 +00:00
Remove stale raft servers differently depending on minRaftVersion
This commit is contained in:
parent
0cc024399d
commit
e74e83fc6c
@ -123,9 +123,23 @@ func (s *Server) pruneDeadServers() error {
|
|||||||
s.logger.Printf("[INFO] consul: Attempting removal of failed server: %v", server)
|
s.logger.Printf("[INFO] consul: Attempting removal of failed server: %v", server)
|
||||||
go s.serfLAN.RemoveFailedNode(server)
|
go s.serfLAN.RemoveFailedNode(server)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minRaftProtocol, err := ServerMinRaftProtocol(s.serfLAN.Members())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
for _, raftServer := range staleRaftServers {
|
for _, raftServer := range staleRaftServers {
|
||||||
|
var future raft.Future
|
||||||
|
if minRaftProtocol >= 2 {
|
||||||
s.logger.Printf("[INFO] consul: Attempting removal of stale raft server : %v", raftServer.ID)
|
s.logger.Printf("[INFO] consul: Attempting removal of stale raft server : %v", raftServer.ID)
|
||||||
s.raft.RemoveServer(raftServer.ID, 0, 0)
|
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 {
|
} else {
|
||||||
s.logger.Printf("[DEBUG] consul: Failed to remove dead servers: too many dead servers: %d/%d", removalCount, peers)
|
s.logger.Printf("[DEBUG] consul: Failed to remove dead servers: too many dead servers: %d/%d", removalCount, peers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user