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

Integrate shard distributor client in matching client #6622

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jakobht
Copy link
Member

@jakobht jakobht commented Jan 15, 2025

What changed?
Matching client can now request the current owner of a tasklist from the shard distributor. This is guarded by a feature flag that defaults to the current sharding lookup.

Why?
We can now let clients lookup who the owner of a matching shard is in shard distributor. This is the first use of the spectator API in shard distributor

How did you test it?
Unit tests, and local runs

Potential risks
The new behavior is hidden behind the feature flag, so the risk is small.

Another risk is that this causes e.g. the matching client not to intitialize correctly, potentially causing crash loops. I have tested this locally to make sure it does not happen.

Release notes

Documentation Changes

We now pass the shard distributor client from the resource where it's fully initialized instead of from the bean where the retry handler is still lacking.
client/clientfactory.go Outdated Show resolved Hide resolved
client/matching/client.go Show resolved Hide resolved
@jakobht jakobht force-pushed the integrate-shard-distributor-client-in-mathcing-client branch from 1188e18 to 0c055e0 Compare January 15, 2025 16:03
if err != nil {
return nil, err
}
return c.client.RefreshTaskListPartitionConfig(ctx, request, append(opts, yarpc.WithShardKey(peer))...)
}

func (c *clientImpl) getShardOwner(ctx context.Context, taskListName string) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

We have the peer resolver interface.
Could you consider implementing a new type of peer resolver and put the logic in the new implementation?

Copy link
Member

Choose a reason for hiding this comment

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

+1. Maybe introduce a MultiPeerResolver object which satisfies PeerResolver interface. It can do take this responsibility (either calls legacy peerResolver or shardDistributor)

Copy link
Member Author

Choose a reason for hiding this comment

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

Good points, will work on making this. Thanks!

@taylanisikdemir taylanisikdemir changed the title Integrate shard distributor client in mathcing client Integrate shard distributor client in matching client Jan 15, 2025
@@ -43,7 +43,7 @@ type (
Bean interface {
GetHistoryClient() history.Client
GetHistoryPeers() history.PeerResolver
GetMatchingClient(domainIDToName DomainIDToNameFunc) (matching.Client, error)
GetMatchingClient(domainIDToName DomainIDToNameFunc, shardDistributorClient sharddistributor.Client) (matching.Client, error)
Copy link
Member

Choose a reason for hiding this comment

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

see the other comment. this interface change shouldn't be needed when sharddistributor.Client is an implementation detail of existing peer resolver.

@@ -836,7 +836,7 @@ func (c *cadenceImpl) startMatching(hosts map[string][]membership.HostInfo, star

// When there are multiple matching hosts the last client will overwrite previous ones.
// It should be fine because the underlying client bean logic should still pick the right destination.
matchingClient, err := clientBean.GetMatchingClient(matchingService.GetDomainCache().GetDomainName)
matchingClient, err := clientBean.GetMatchingClient(matchingService.GetDomainCache().GetDomainName, nil)
Copy link
Member

@taylanisikdemir taylanisikdemir Jan 15, 2025

Choose a reason for hiding this comment

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

do we have any integration test which uses shard distributor? we should consider running existing set of integration tests with shard manager by making this configurable

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.

4 participants