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 experimental DirectPath support #396
Conversation
@@ -49,6 +51,7 @@ | |||
<id>default-test</id> | |||
<configuration> | |||
<excludedGroups>com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.IntegrationTest</excludedGroups> | |||
<skipTests>${skipUTs}</skipTests> |
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.
I only see this being set to false
. Do we need this configuration?
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.
Hi Jeff, I added this configuration just for our internal test to be able to use -DskipUTs=true
. Currently we are using mvn verify -am -pl google-cloud-spanner -B -Penable-integration-tests,spanner-directpath-it -DskipUTs=true -D... ...
for our internal E2E DP tests, and meanwhile I don't want to change the behavior for other tests. Do you think this is the right way for approaching this purpose?
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.
I might add a note somewhere so we don't inadvertently break this.
We might also want to add something like this to our shared setup.
google-cloud-spanner/src/test/java/com/google/cloud/spanner/GceTestEnvConfig.java
Show resolved
Hide resolved
google-cloud-spanner/src/test/java/com/google/cloud/spanner/GceTestEnvConfig.java
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #396 +/- ##
=========================================
Coverage ? 82.08%
Complexity ? 2451
=========================================
Files ? 136
Lines ? 13587
Branches ? 1306
=========================================
Hits ? 11153
Misses ? 1906
Partials ? 528
Continue to review full report at Codecov.
|
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 adding this change!
.setHeaderProvider(mergedHeaderProvider); | ||
|
||
// TODO(weiranf): Set to true by default once DirectPath goes to public beta. | ||
if (shouldAttemptDirectPath()) { |
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.
I think that currently we are mostly enabling features / configurations through environment variables (which should be standardised through all of our clients) or through the SpannerOptions
class.
I imagine we could add an option like useDirectPath()
in the SpannerOptions.Builder
class. I guess that even if we do not use an environment variable as well (and go with the property), it would be nice to concentrated the configuration directly in the SpannerOptions
class.
Wdyt?
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.
Hi Thiago, thanks for the comment! So our original idea is, the DirectPath is a network side feature, it should be agnostic to the end users. Currently we add this shouldAttemptDirectPath
temporarily so our test can start exercising DirectPath. Once DirectPath is going public, we will remove these temporary checker and set the client to use DirectPath by default. And correct me if I'm wrong, this SpannerOptions seems like a configurable option provided to end users, but in fact we don't actually want users to config DirectPath attempt, which should only be controlled by service owner/SREs via Access Control List. WDYT?
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.
That makes sense, thanks for the response.
A couple of questions on the approach:
- Aren't we enabling this to a few customers at first (before being the default)? If so, is the expectation that they would have to execute with the property set?
- Should we override the endpoint even when the user provides a custom channel provider? I don't know what is best here, but I imagine that it might be confusing if the user executes their program with the property set and a custom channel provider, but do not get the benefits of the direct path.
Thanks!
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.
Good questions! To answer them:
Actually we would need to remove these temporary checker and enable DirectPath with a client lib release before we engage real customers, because DirectPath should be fully controlled by the ACL config (i.e. initially only a few customers will get ALLOW from ACL check, all others will get DENY). So this property set should only be used by our tests.
This sandbox endpoint is only used for our testing purposes (as right now DirectPath-ipv4 is only available in certain cell in prod) Once we've done enough tests and DirectPath is fully ready, Spanner will make its default endpoint to be capable of handling DirectPath traffic. So by that time, we will use the same endpoint no matter the client is using DirectPath or Not.
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.
I'm good with these changes if the spanner team is
Hi @thiagotnunes and @chingor13, is there anything else need to be done before this can be merge? |
@WeiranFang nothing from side. Can you merge? |
Hi @thiagotnunes Actually I don't have access to merge this PR:
is it OK to add me write access to this repo? Thanks! |
@WeiranFang you are right, I will merge it for you and follow up if I can give you write access. |
We actually don't use static check in this repo so this is just safe to remove. Fixes: googleapis#354 Updates internal bug: b/155334826
* feat!: upgrade to Java 8 and JDBC 4.2 Upgrade to Java 8 and implement new methods added in Java 8 for JDBC. Drops support for Java 7. Closes googleapis#396 * fix: remove Java 7 from CI * test: add additional test cases * test: add tests for batches * build: remove java7 configs
Previously DirectPath was enabled by an environment variable. Now since gax-java v1.57.0 DirectPath can be enabled by using
InstantiatingGrpcChannelProvider.Builder.setAttemptDirectPath(true)
.Some changes are temporary and will be removed once DirectPath goes public using the default spanner endpoint. For now we want to be able to test the DirectPath-enabled endpoint with different client scenarios:
For the purpose of our internal E2E tests, I added a test profile called
spanner-directpath-it
which introduces two new sys props:spanner.attempt_directpath
: this defines whether the test client would callsetAttemptDirectPath(true)
and set the spanner endpoint to use the DirectPath-enabled targetaa423245250f2bbf.sandbox.googleapis.com:443
.spanner.directpath_test_scenario
: this defines which of the three scenarios mentioned above to test.And for different scenarios we would have different assertions for the test:
DP_IPV4_PREFIX
.DP_IPV4_PREFIX
orDP_IPV6_PREFIX
.+cc @chingor13 , @vnorigoog