From 0728a04dbb80e2110c6f5c2f3eaec55fc0653e8a Mon Sep 17 00:00:00 2001 From: Preetha Appan Date: Wed, 30 Aug 2017 14:36:47 -0500 Subject: [PATCH] Wire server provider for raft layer only on protocol version 3 and above, and update changelog --- CHANGELOG.md | 1 + agent/consul/server.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 373bc75be..80da3b664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ IMPROVEMENTS: * agent: Switched to using a read lock for the agent's RPC dispatcher, which prevents RPC calls from getting serialized. [GH-3376] * build: Upgraded Go version to 1.9. [GH-3428] +* server: Consul servers can re-establish quorum after all of them change their IP addresses upon a restart. [GH-1580] BUG FIXES: diff --git a/agent/consul/server.go b/agent/consul/server.go index e0015bb9f..cca4ed359 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -492,12 +492,17 @@ func (s *Server) setupRaft() error { return err } + var serverAddressProvider raft.ServerAddressProvider = nil + if s.config.RaftConfig.ProtocolVersion >= 3 { //ServerAddressProvider needs server ids to work correctly, which is only supported in protocol version 3 or higher + serverAddressProvider = s.serverLookup + } + // Create a transport layer. transConfig := &raft.NetworkTransportConfig{ Stream: s.raftLayer, MaxPool: 3, Timeout: 10 * time.Second, - ServerAddressProvider: s.serverLookup, + ServerAddressProvider: serverAddressProvider, } trans := raft.NewNetworkTransportWithConfig(transConfig)