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

rls: overhaul RouteLookupConfig validation #8645

Merged
merged 17 commits into from Nov 30, 2021

Conversation

dapengzhang0
Copy link
Member

@dapengzhang0 dapengzhang0 commented Nov 2, 2021

The RlsProtoData.RouteLookupConfig class is out-of-date.

  • Some of the fields were long, but now are of Duration type.
  • Some of the fields are deleted.
  • The validation of some of the fields either have been changed or were wrong since beginning.

Now overhaul all the fields in RlsProtoData.RouteLookupConfig class based on the spec http://go/grpc-rls-lb-policy-design#heading=h.y3h669gfpown.

Also move the validation logic in json parsing rather than in the constructor of RouteLookupConfig.

@dapengzhang0 dapengzhang0 marked this pull request as draft November 2, 2021 16:24
@dapengzhang0 dapengzhang0 changed the title rls: overhall RouteLookupConfig validation rls: overhaul RouteLookupConfig validation Nov 18, 2021
Copy link
Member

@sergiitk sergiitk left a comment

Choose a reason for hiding this comment

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

I think I caught some potential NullPointerExceptions.

Comment on lines +167 to +168
this.maxAgeInNanos = maxAgeInNanos;
this.staleAgeInNanos = staleAgeInNanos;
Copy link
Member

Choose a reason for hiding this comment

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

Potential error: Unboxing LongmaxAgeInNanos and staleAgeInNanos into long this.maxAgeInNanos and this.staleAgeInNanos may produce 'NullPointerException'.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an oversight. Fixed to use primitive long type.

rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
Copy link
Member Author

@dapengzhang0 dapengzhang0 left a comment

Choose a reason for hiding this comment

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

Good catches! Thanks for meticulously reviewing the PR.

rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
Comment on lines +167 to +168
this.maxAgeInNanos = maxAgeInNanos;
this.staleAgeInNanos = staleAgeInNanos;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an oversight. Fixed to use primitive long type.

Copy link
Member

@sergiitk sergiitk left a comment

Choose a reason for hiding this comment

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

Looks good. Minor comments + you missed one on the deleted code: #8645 (comment)

rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
rls/src/main/java/io/grpc/rls/RlsProtoConverters.java Outdated Show resolved Hide resolved
@dapengzhang0 dapengzhang0 merged commit 2330922 into grpc:master Nov 30, 2021
@dapengzhang0 dapengzhang0 deleted the fix-rls-data branch November 30, 2021 16:36
sergiitk added a commit to sergiitk/grpc-java that referenced this pull request Dec 1, 2021
This PR fixes a few cosmetic violations of the ErrorProne patterns
introduced in PR grpc#8645: ParameterName, and TimeUnitMismatch.
sergiitk added a commit that referenced this pull request Dec 1, 2021
This PR fixes a few cosmetic violations of the ErrorProne patterns
introduced in PR #8645: ParameterName, and TimeUnitMismatch.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2022
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.

None yet

2 participants