-
Notifications
You must be signed in to change notification settings - Fork 553
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
feat(spanner) : add support for client resource base routing #4548
feat(spanner) : add support for client resource base routing #4548
Conversation
@jiren Could you please fix the CI check error? After that, we can review this PR. Thanks. |
@hengfengli CI error fixed for OS X. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My major concern is whether we need to add ClientServiceProxy
and update service.rb
.
I think in client.rb::initialize
, we can have the following logic:
- if resource-based routing is enabled,
- the returned endpoint is empty: use the
project.service
. - the returned endpoint is same as the given one in the
project.service
: use theproject.service
. - the returned endpoint is different: we can create a service with the instance-specific endpoint and store it in the client instance.
- the returned endpoint is empty: use the
- If resource-based routing is not enabled, then we just use the
project.service
.
In this case, we don't need to update service.rb
.
google-cloud-spanner/test/google/cloud/spanner/client_service_proxy/endpont_uri_test.rb
Outdated
Show resolved
Hide resolved
@hengfengli I will fix the conflict once we finalize service object creation in the client, due to channel-related changes in service.rb, current resource-based routing code will not work |
5c42c3f
to
521ec84
Compare
google-cloud-spanner/lib/google/cloud/spanner/resource_based_routing.rb
Outdated
Show resolved
Hide resolved
@jiren Why does the CI check not run for this PR again? Maybe because of the force-push. Can you try to re-trigger it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just want all the comments to be addressed before I approve.
google-cloud-spanner/test/google/cloud/spanner/client/resource_based_routing_test.rb
Outdated
Show resolved
Hide resolved
google-cloud-spanner/test/google/cloud/spanner/client/resource_based_routing_test.rb
Outdated
Show resolved
Hide resolved
google-cloud-spanner/test/google/cloud/spanner/client/resource_based_routing_test.rb
Outdated
Show resolved
Hide resolved
- add/updates docs and test
- instance get method with fields mask
- add unit test for client service proxy
521ec84
to
13eb5cd
Compare
google-cloud-spanner/lib/google/cloud/spanner/resource_based_routing.rb
Outdated
Show resolved
Hide resolved
google-cloud-spanner/test/google/cloud/spanner/client/resource_based_routing_test.rb
Outdated
Show resolved
Hide resolved
google-cloud-spanner/lib/google/cloud/spanner/resource_based_routing.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @jiren. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
One more request @jiren. Please be more descriptive in the PR description. Follow googleapis/google-cloud-python#10183 as an example. |
Got it |
google-cloud-spanner/lib/google/cloud/spanner/resource_based_routing.rb
Outdated
Show resolved
Hide resolved
We have decided to implement this functionality on the server side so we no longer need to add this support on the client side. |
Towards #4547 issue
Implementation of Client resource based routing.
enable_resource_based_routing
while creating a database client instance . Default client resource based routing is disabled.Implementation overview