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

xdsrouting: resolver to generate service config with routes, and pick routing balancer #3751

Merged
merged 4 commits into from
Jul 22, 2020

Conversation

menghanl
Copy link
Contributor

@menghanl menghanl commented Jul 20, 2020

$xds-milestone-2$

@menghanl
Copy link
Contributor Author

The service config tests in this PR rely on the balancer #3746. The config selects xds-routing as top level balaner, which doesn't exist until #3746 is merged.

@menghanl menghanl requested a review from easwars July 20, 2020 21:28
@menghanl menghanl added the Type: Feature New features or improvements in behavior label Jul 20, 2020
@menghanl menghanl added this to the 1.31 Release milestone Jul 20, 2020
@menghanl menghanl changed the title xdsrouting: generate service config with routes, and pick routing as the top level balancer xdsrouting: resolver to generate service config with routes, and pick routing balancer Jul 20, 2020
…s, and pick routing as the top level balancer
@menghanl
Copy link
Contributor Author

This PR is rebased on top of the balancer, and tests are passing. Should be ready for review. Thanks!

Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

Need to make another pass through the tests.

xds/internal/resolver/serviceconfig.go Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig.go Show resolved Hide resolved
xds/internal/resolver/serviceconfig.go Outdated Show resolved Hide resolved
oldNextIndex map[string]int
newActions map[string]action
wantActions map[string]action
wantNextIndex map[string]int
Copy link
Contributor

Choose a reason for hiding this comment

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

Testing the value of wantNextIndex seems to be testing implementation rather than behavior. And if we go with my other suggestion of using random numbers for the next index, we wouldn't have to test that at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It to make sure that the indices are incrementing, so it won't generate the same assigned names.

Random number would make this, and the expected assigned names hard to test.

xds/internal/resolver/serviceconfig_action_test.go Outdated Show resolved Hide resolved
@easwars easwars assigned menghanl and unassigned easwars Jul 22, 2020
Copy link
Contributor Author

@menghanl menghanl left a comment

Choose a reason for hiding this comment

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

Thanks for the review!

xds/internal/resolver/serviceconfig.go Show resolved Hide resolved
xds/internal/resolver/serviceconfig.go Show resolved Hide resolved
xds/internal/resolver/serviceconfig.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved
xds/internal/resolver/serviceconfig_action.go Outdated Show resolved Hide resolved

// Find actions in newActions but not in oldActions. Add them, and try to
// reuse assigned names from actionsRemoved.
if r.nextIndex == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not too worried about overflow, and I made it a uint64 now.

Random number would work, but it makes the tests harder.

xds/internal/resolver/serviceconfig_action_test.go Outdated Show resolved Hide resolved
oldNextIndex map[string]int
newActions map[string]action
wantActions map[string]action
wantNextIndex map[string]int
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It to make sure that the indices are incrementing, so it won't generate the same assigned names.

Random number would make this, and the expected assigned names hard to test.

@easwars
Copy link
Contributor

easwars commented Jul 22, 2020

I sent a comment about trying to override the random generator with a monotonic generator in tests. But not sure why it doesn't show up here. :(

@menghanl menghanl merged commit a1ace91 into grpc:master Jul 22, 2020
@menghanl menghanl deleted the xds_routing_resolver branch July 22, 2020 21:36
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants