Skip to content

Commit

Permalink
update calculation, remove relation to bootstrap, update test
Browse files Browse the repository at this point in the history
  • Loading branch information
schristoff committed Oct 24, 2019
1 parent 4df9a3d commit e653583
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions agent/config/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,10 +1090,6 @@ func (b *Builder) Validate(rt RuntimeConfig) error {
}
}

//MinQuorum is set to BootstrarpExpect if available
if rt.BootstrapExpect != 0 {
rt.AutopilotMinQuorum = uint(rt.BootstrapExpect)
}
// Validate the given Connect CA provider config
validCAProviders := map[string]bool{
"": true,
Expand Down
2 changes: 1 addition & 1 deletion agent/consul/autopilot/autopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (a *Autopilot) pruneDeadServers() error {

// Only do removals if a minority of servers will be affected.
peers := NumPeers(raftConfig)
if peers-removalCount > int(conf.MinQuorum) && removalCount < peers/2 {
if peers-removalCount >= int(conf.MinQuorum) && removalCount < peers/2 {
for _, node := range failed {
a.logger.Printf("[INFO] autopilot: Attempting removal of failed server node %q", node.Name)
go serfLAN.RemoveFailedNode(node.Name)
Expand Down
1 change: 1 addition & 0 deletions agent/consul/autopilot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ func TestAutopilot_BootstrapExpect(t *testing.T) {
c.Datacenter = dc
c.Bootstrap = false
c.BootstrapExpect = 3
c.AutopilotConfig.MinQuorum = 3
c.RaftConfig.ProtocolVersion = raft.ProtocolVersion(2)
c.AutopilotInterval = 100 * time.Millisecond
//Let us know when a server is actually gone
Expand Down

0 comments on commit e653583

Please sign in to comment.