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

Merge membership Monitor and ServiceResolver to membership.Resolver #4646

Merged
merged 5 commits into from
Nov 19, 2021

Conversation

mantas-sidlauskas
Copy link
Contributor

@mantas-sidlauskas mantas-sidlauskas commented Nov 16, 2021

What changed?
Membership monitor and service resolver interfaces merged to a single membership.Resolver interface.

  • Resolver is using hashring to get ownership for a shard.
  • Hashring is using members provided by ringpop.

Why?
This is part of refactoring needed to introduce selectable membership providers.

How did you test it?
Unit test/local test

Potential risks

Release notes

Documentation Changes

@@ -597,24 +597,22 @@ func (adh *adminHandlerImpl) DescribeCluster(

var rings []*types.RingInfo
for _, role := range service.List {
resolver, err := monitor.GetResolver(role)
if err != nil {
return nil, adh.error(err, scope)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we no longer return this error. Is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, fixed

@coveralls
Copy link

coveralls commented Nov 16, 2021

Pull Request Test Coverage Report for Build 97fab839-4f56-48d2-9d16-8e02c83264ff

  • 245 of 372 (65.86%) changed or added relevant lines in 23 files are covered.
  • 104 unchanged lines in 15 files lost coverage.
  • Overall coverage increased (+0.009%) to 56.879%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/server/cadence/server.go 0 1 0.0%
service/matching/matchingEngine.go 1 2 50.0%
service/worker/replicator/replicator.go 1 2 50.0%
service/worker/service.go 0 1 0.0%
client/matching/peerResolver.go 4 6 66.67%
common/log/tag/tags.go 0 2 0.0%
host/service.go 6 8 75.0%
service/frontend/workflowHandler.go 2 4 50.0%
service/history/handler.go 0 2 0.0%
service/history/shard/controller.go 4 6 66.67%
Files with Coverage Reduction New Missed Lines %
common/log/tag/tags.go 1 52.23%
common/resource/resourceTest.go 1 0%
host/service.go 1 57.48%
service/frontend/workflowHandler.go 1 58.76%
service/history/shard/controller.go 1 73.49%
common/task/weightedRoundRobinTaskScheduler.go 2 89.64%
service/history/queue/timer_queue_processor.go 2 58.8%
service/worker/replicator/domain_replication_processor.go 2 72.58%
common/cache/lru.go 3 90.73%
common/persistence/nosql/nosqlplugin/cassandra/workflow.go 3 55.49%
Totals Coverage Status
Change from base Build e657527f-afc9-4274-8c24-a5c6f1aea52d: 0.009%
Covered Lines: 82304
Relevant Lines: 144700

💛 - Coveralls

@mantas-sidlauskas mantas-sidlauskas marked this pull request as ready for review November 16, 2021 14:30
@mantas-sidlauskas mantas-sidlauskas changed the title Merge service resolver to monitor Merge membership Monitor and ServiceResolver to membership.Resolver Nov 17, 2021

// PeerResolver is used to resolve matching peers.
// Those are deployed instances of Cadence matching services that participate in the cluster ring.
// The resulting peer is simply an address of form ip:port where RPC calls can be routed to.
type PeerResolver struct {
membership membership.ServiceResolver
membership membership.Resolver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this was renamed to resolver in client/history/peerResolver.go, maybe rename here as well for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, can do

@@ -163,7 +165,7 @@ func (c *controller) Start() {
c.shutdownWG.Add(1)
go c.shardManagementPump()

err := c.GetHistoryServiceResolver().AddListener(shardControllerMembershipUpdateListenerName, c.membershipUpdateCh)
err := c.GetMembershipResolver().Subscribe(service.History, shardControllerMembershipUpdateListenerName, c.membershipUpdateCh)
if err != nil {
c.logger.Error("Error adding listener", tag.Error(err))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this error message, as this is not listener anymore, but a subscriber.

@@ -178,7 +180,7 @@ func (c *controller) Stop() {

c.PrepareToStop()

if err := c.GetHistoryServiceResolver().RemoveListener(shardControllerMembershipUpdateListenerName); err != nil {
if err := c.GetMembershipResolver().Unsubscribe(service.History, shardControllerMembershipUpdateListenerName); err != nil {
c.logger.Error("Error removing membership update listener", tag.Error(err), tag.OperationFailed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this error as well, listener -> subscriber.

@@ -109,7 +111,7 @@ func NewEngine(taskManager persistence.TaskManager,
logger log.Logger,
metricsClient metrics.Client,
domainCache cache.DomainCache,
resolver membership.ServiceResolver,
monitor membership.Resolver,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This var should be resolver

@@ -55,7 +76,7 @@ func newDomainReplicationProcessor(
metricsClient metrics.Client,
taskExecutor domain.ReplicationTaskExecutor,
hostInfo *membership.HostInfo,
serviceResolver membership.ServiceResolver,
membership membership.Resolver,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to resolver for consistency with other places

event.HostsUpdated = append(event.HostsUpdated, NewHostInfo(addr, r.getLabelsMap()))
}

// Notify listeners
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listeners -> subscribers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants