Browse Source

Pulls down some code for the check loop.

pull/3450/head
James Phillips 7 years ago
parent
commit
084679ab65
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
  1. 12
      agent/consul/leader.go

12
agent/consul/leader.go

@ -638,13 +638,6 @@ func (s *Server) joinConsulServer(m serf.Member, parts *metadata.Server) error {
} }
} }
addr := (&net.TCPAddr{IP: m.Addr, Port: parts.Port}).String()
minRaftProtocol, err := ServerMinRaftProtocol(s.serfLAN.Members())
if err != nil {
return err
}
// Processing ourselves could result in trying to remove ourselves to // Processing ourselves could result in trying to remove ourselves to
// fix up our address, which would make us step down. This is only // fix up our address, which would make us step down. This is only
// safe to attempt if there are multiple servers available. // safe to attempt if there are multiple servers available.
@ -664,6 +657,11 @@ func (s *Server) joinConsulServer(m serf.Member, parts *metadata.Server) error {
// but we want to avoid doing that if possible to prevent useless Raft // but we want to avoid doing that if possible to prevent useless Raft
// log entries. If the address is the same but the ID changed, remove the // log entries. If the address is the same but the ID changed, remove the
// old server before adding the new one. // old server before adding the new one.
addr := (&net.TCPAddr{IP: m.Addr, Port: parts.Port}).String()
minRaftProtocol, err := ServerMinRaftProtocol(s.serfLAN.Members())
if err != nil {
return err
}
for _, server := range configFuture.Configuration().Servers { for _, server := range configFuture.Configuration().Servers {
// No-op if the raft version is too low // No-op if the raft version is too low
if server.Address == raft.ServerAddress(addr) && (minRaftProtocol < 2 || parts.RaftVersion < 3) { if server.Address == raft.ServerAddress(addr) && (minRaftProtocol < 2 || parts.RaftVersion < 3) {

Loading…
Cancel
Save