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

service config: add default method config support #3684

Merged
merged 4 commits into from Jul 7, 2020

Conversation

amenzhinsky
Copy link
Contributor

Fixes #3473

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 12, 2020

CLA Check
The committers are authorized under a signed CLA.

  • ✅ Aliaksandr Mianzhynski (5c57934)

@amenzhinsky amenzhinsky marked this pull request as ready for review June 12, 2020 16:48
@menghanl menghanl self-assigned this Jun 18, 2020
@menghanl menghanl self-requested a review June 18, 2020 20:35
@menghanl menghanl added this to the 1.31 Release milestone Jun 29, 2020
Copy link
Contributor

@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 change! Overall looks pretty good! Some small comments.

clientconn.go Show resolved Hide resolved
service_config.go Outdated Show resolved Hide resolved
if j.Service == nil {
return "", false
return "", errIgnoreName
Copy link
Contributor

Choose a reason for hiding this comment

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

What if j.Service is nil, but j.Method is set to non-empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

errIgnoreName will make it simply ignore the name just like the current implementation does.

https://github.com/grpc/grpc-proto/blob/dd2dca318eb197b96b60f22297871fb1ed862800/grpc/service_config/service_config.proto#L67 states service is required, so probably we should return the corresponding error instead of skipping malformed names, but I didn't want to introduce breaking changes (if it's a breaking change).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ef23d5c#diff-bd49846390d90e2bd0f528a7a4c1e533R339-R341

I removed this block in the latest patch, let me know if it's not something you wanted me to do.

service_config.go Outdated Show resolved Hide resolved
service_config.go Outdated Show resolved Hide resolved
if j.Service == nil {
return "", false
return "", errMissingService
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there's some inconsistency in service_config.proto.
service shouldn't be marked as required, and this line says not present is considered the same as "".

(Does the json library handle null correctly? Can you add a test? Thanks!)

j.Service == nil should be considered the same as *j.Service == "", and we check if method is set, as in the following if.


On whether this is a breaking change, this only affect configs where service is not set, and method is set to non-empty string. This is not an valid config anyway, I think failing those would be OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right, that's great!

Did you fix this

j.Service == nil should be considered the same as *j.Service == "", and we check if method is set, as in the following if.

I saw you force pushed, but I can't find the fix for it.

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 think I finally got it, was a bit confused. Please check out the latest commit

Copy link
Contributor

@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 changes! LGTM!

@menghanl menghanl changed the title Add default method config support service config: add default method config support Jul 7, 2020
@menghanl menghanl merged commit 4258d12 into grpc:master Jul 7, 2020
@amenzhinsky amenzhinsky deleted the default-method-config branch July 31, 2020 05:45
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

service config: allow default method config
2 participants