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

feat: add support for spanner client resource base routing #780

Closed

Conversation

laljikanjareeya
Copy link
Contributor

@laljikanjareeya laljikanjareeya commented Dec 31, 2019

Implement resource based routing.

When preparing Gapic Request for a SpannerClient, If Client code does not specify the apiEndpoint than check for suggested endpointUris.

If endpointUris are returned, use the first one as apiEndpoint.
In case of no endpointUris are returned, use default apiEndpoint.

Gapic Clients are cached per instance on the SpannerClient.

This feature is disabled by default and is enabled by setting the environment variable to true.

Environment variable to enable this feature:
GOOGLE_CLOUD_SPANNER_ENABLE_RESOURCE_BASED_ROUTING

Closes : #779

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 31, 2019
@laljikanjareeya laljikanjareeya changed the title feat : add support for spanner client resource base routing feat: add support for spanner client resource base routing Dec 31, 2019
src/index.ts Outdated Show resolved Hide resolved
src/instance.ts Outdated Show resolved Hide resolved
src/instance.ts Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 31, 2019

Codecov Report

Merging #780 into master will not change coverage.
The diff coverage is 92.59%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #780   +/-   ##
=======================================
  Coverage   76.74%   76.74%           
=======================================
  Files          43       43           
  Lines       20467    20467           
  Branches      597      597           
=======================================
  Hits        15707    15707           
  Misses       4753     4753           
  Partials        7        7
Impacted Files Coverage Δ
src/session-pool.ts 99.26% <100%> (ø) ⬆️
src/transaction-runner.ts 98% <87.5%> (ø) ⬆️
src/database.ts 99.77% <93.75%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a464043...f3b976c. Read the comment docs.

src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
test/index.ts Outdated Show resolved Hide resolved
test/index.ts Outdated Show resolved Hide resolved
test/index.ts Outdated Show resolved Hide resolved
system-test/spanner.ts Outdated Show resolved Hide resolved
system-test/spanner.ts Outdated Show resolved Hide resolved
src/session.ts Show resolved Hide resolved
system-test/spanner.ts Show resolved Hide resolved
Copy link
Contributor

@skuruppu skuruppu left a comment

Choose a reason for hiding this comment

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

There are still some unresolved comments so I will wait for you to resolve them before approving.

test/index.ts Outdated Show resolved Hide resolved
system-test/spanner.ts Outdated Show resolved Hide resolved
@skuruppu
Copy link
Contributor

One more request @laljikanjareeya. Please be more descriptive in the PR description. Follow googleapis/google-cloud-python#10183 as an example.

@olavloite
Copy link
Contributor

@skuruppu Regarding #780 (comment) on the minimum number of sessions in the pool: The Nodejs client currently still uses MinSessions=0 as the default value for the session pool.

See

* @property {number} [min=0] Minimum number of resources to keep in the pool at

@skuruppu
Copy link
Contributor

@skuruppu Regarding #780 (comment) on the minimum number of sessions in the pool: The Nodejs client currently still uses MinSessions=0 as the default value for the session pool.

See

* @property {number} [min=0] Minimum number of resources to keep in the pool at

Oh got it. Thanks for pointing this out @olavloite.

@rhiro rhiro removed the request for review from mbril February 4, 2020 23:25
@laljikanjareeya laljikanjareeya added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 6, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 6, 2020
@laljikanjareeya laljikanjareeya added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 12, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 12, 2020
done(); //no resolved endpoint.
}
//user specific apiEndpoint
spanner.options.apiEndpoint = resolvedEndpoint[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this using the resolved endpoint instead of a user-specified endpoint?

}
//user specific apiEndpoint
spanner.options.apiEndpoint = resolvedEndpoint[0];
spanner.options.enableResourceBasedRouting = true;
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 at line 4417, resource routing is already enabled so don't think you need this.

@skuruppu skuruppu added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Feb 13, 2020
@skuruppu
Copy link
Contributor

We have decided to implement this functionality on the server side so we no longer need to add this support on the client side.

@skuruppu skuruppu closed this Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for spanner client resource base routing
7 participants