Merge pull request #1179 from travisturner/remove-default-gossip-seed

Default gossip seed should be empty instead of local bind address
This commit is contained in:
Travis Turner 2018-03-26 10:21:02 -05:00 • committed by GitHub
commit 5a95a49c83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View file

@ -61,9 +61,11 @@ func (g *GossipMemberSet) Start(h pilosa.BroadcastHandler) error {
return nil
}
// Seeds returns the gossipSeeds determined by the config.
func (g *GossipMemberSet) Seeds() []string {
return g.config.gossipSeeds
// GetBindAddr returns the gossip bind address based on config and auto bind port.
// This method is currently only used in a test scenario where a second node needs
// the auto-bind address of the first node to use as its gossip seed.
func (g *GossipMemberSet) GetBindAddr() string {
return fmt.Sprintf("%s:%d", g.config.memberlistConfig.BindAddr, g.config.memberlistConfig.BindPort)
}
// Open implements the MemberSet interface to start network activity.
@ -202,11 +204,6 @@ func NewGossipMemberSetWithTransport(name string, cfg *pilosa.Config, transport
g.statusHandler = server
// If no gossipSeeds is provided, use local host:port.
if len(cfg.Gossip.Seeds) == 0 {
g.config.gossipSeeds = []string{fmt.Sprintf("%s:%d", host, port)}
}
return g, nil
}

View file

@ -78,7 +78,7 @@ func TestMain_SendReceiveMessage(t *testing.T) {
// get the host portion of addr to use for binding
m1.Config.Gossip.Port = "0"
m1.Config.Gossip.Seeds = gossipMemberSet0.Seeds()
m1.Config.Gossip.Seeds = []string{gossipMemberSet0.GetBindAddr()}
m1.Server.Cluster.Coordinator = m0.Server.NodeID
m1.Server.Cluster.EventReceiver = gossip.NewGossipEventReceiver(m1.Server.LogOutput)