Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix membership resolver used in integration tests #6210

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions host/membership_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ type simpleResolver struct {
}

// NewSimpleResolver returns a membership resolver interface
func NewSimpleResolver(serviceName string, hosts map[string][]membership.HostInfo) membership.Resolver {
func NewSimpleResolver(serviceName string, hosts map[string][]membership.HostInfo, currentHost membership.HostInfo) membership.Resolver {
resolvers := make(map[string]*simpleHashring, len(hosts))
for service, hostList := range hosts {
resolvers[service] = newSimpleHashring(hostList)
}
return &simpleResolver{
hostInfo: hosts[serviceName][0],
hostInfo: currentHost,
resolvers: resolvers,
}
}
Expand Down
12 changes: 6 additions & 6 deletions host/onebox.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func (c *cadenceImpl) startFrontend(hosts map[string][]membership.HostInfo, star
params.PProfInitializer = newPProfInitializerImpl(c.logger, c.FrontendPProfPort())
params.RPCFactory = c.newRPCFactory(service.Frontend, c.FrontendHost())
params.MetricScope = tally.NewTestScope(service.Frontend, make(map[string]string))
params.MembershipResolver = newMembershipResolver(params.Name, hosts)
params.MembershipResolver = newMembershipResolver(params.Name, hosts, c.FrontendHost())
params.ClusterMetadata = c.clusterMetadata
params.MessagingClient = c.messagingClient
params.MetricsClient = metrics.NewClient(params.MetricScope, service.GetMetricsServiceIdx(params.Name, c.logger))
Expand Down Expand Up @@ -609,7 +609,7 @@ func (c *cadenceImpl) startHistory(hosts map[string][]membership.HostInfo, start
params.PProfInitializer = newPProfInitializerImpl(c.logger, pprofPorts[i])
params.RPCFactory = c.newRPCFactory(service.History, hostport)
params.MetricScope = tally.NewTestScope(service.History, make(map[string]string))
params.MembershipResolver = newMembershipResolver(params.Name, hosts)
params.MembershipResolver = newMembershipResolver(params.Name, hosts, hostport)
params.ClusterMetadata = c.clusterMetadata
params.MessagingClient = c.messagingClient
params.MetricsClient = metrics.NewClient(params.MetricScope, service.GetMetricsServiceIdx(params.Name, c.logger))
Expand Down Expand Up @@ -688,7 +688,7 @@ func (c *cadenceImpl) startMatching(hosts map[string][]membership.HostInfo, star
params.PProfInitializer = newPProfInitializerImpl(c.logger, pprofPorts[i])
params.RPCFactory = c.newRPCFactory(service.Matching, hostport)
params.MetricScope = tally.NewTestScope(service.Matching, map[string]string{"matching-host": matchingHost})
params.MembershipResolver = newMembershipResolver(params.Name, hosts)
params.MembershipResolver = newMembershipResolver(params.Name, hosts, hostport)
params.ClusterMetadata = c.clusterMetadata
params.MetricsClient = metrics.NewClient(params.MetricScope, service.GetMetricsServiceIdx(params.Name, c.logger))
params.DynamicConfig = newIntegrationConfigClient(dynamicconfig.NewNopClient(), c.matchingDynCfgOverrides)
Expand Down Expand Up @@ -747,7 +747,7 @@ func (c *cadenceImpl) startWorker(hosts map[string][]membership.HostInfo, startW
params.PProfInitializer = newPProfInitializerImpl(c.logger, c.WorkerPProfPort())
params.RPCFactory = c.newRPCFactory(service.Worker, c.WorkerServiceHost())
params.MetricScope = tally.NewTestScope(service.Worker, make(map[string]string))
params.MembershipResolver = newMembershipResolver(params.Name, hosts)
params.MembershipResolver = newMembershipResolver(params.Name, hosts, c.WorkerServiceHost())
params.ClusterMetadata = c.clusterMetadata
params.MetricsClient = metrics.NewClient(params.MetricScope, service.GetMetricsServiceIdx(params.Name, c.logger))
params.DynamicConfig = newIntegrationConfigClient(dynamicconfig.NewNopClient(), c.workerDynCfgOverrides)
Expand Down Expand Up @@ -965,8 +965,8 @@ func copyPersistenceConfig(pConfig config.Persistence) (config.Persistence, erro
return pConfig, nil
}

func newMembershipResolver(serviceName string, hosts map[string][]membership.HostInfo) membership.Resolver {
return NewSimpleResolver(serviceName, hosts)
func newMembershipResolver(serviceName string, hosts map[string][]membership.HostInfo, currentHost membership.HostInfo) membership.Resolver {
return NewSimpleResolver(serviceName, hosts, currentHost)
}

func newPProfInitializerImpl(logger log.Logger, port int) common.PProfInitializer {
Expand Down
Loading