returnfalse,fmt.Sprintf("denied, because removing %d/%d servers would leave less then minimal allowed quorum of %d servers",deadServers,peers,minQuorum)
}
// Only do removals if a minority of servers will be affected.
// For failure tolerance of F we need n = 2F+1 servers.
// This means we can safely remove up to (n-1)/2 servers.
ifdeadServers>(peers-1)/2{
returnfalse,fmt.Sprintf("denied, because removing the majority of servers %d/%d is not safe",deadServers,peers)
}
returntrue,fmt.Sprintf("allowed, because removing %d/%d servers leaves a majority of servers above the minimal allowed quorum %d",deadServers,peers,minQuorum)
}
// pruneDeadServers removes up to numPeers/2 failed servers
func(a*Autopilot)pruneDeadServers()error{
conf:=a.delegate.AutopilotConfig()
@ -226,42 +240,42 @@ func (a *Autopilot) pruneDeadServers() error {
}
}
// We can bail early if there's nothing to do.
removalCount:=len(failed)+len(staleRaftServers)
ifremovalCount==0{
deadServers:=len(failed)+len(staleRaftServers)
// nothing to do
ifdeadServers==0{
returnnil
}
// Only do removals if a minority of servers will be affected.