Skip to content

Conversation

@mohanli-ml
Copy link
Contributor

Add a DirectPath fallback test for spanner. The test is basically the same as what we have for bigtable (https://github.com/googleapis/java-bigtable/blob/master/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/DirectPathFallbackIT.java). The logic of the test is:

  1. First wait until DirectPath traffic is observed;
  2. Blackhole DirectPath ipv4 and ipv6 IP, and wait until the client fallback to use CFE;
  3. Unblackhole DirectPath ipv4 and ipv6 traffic, and the client should upgrade back to use DirectPath again.

The DirectPath and CFE traffic are distinguished by peer IP.

@mohanli-ml mohanli-ml requested a review from a team as a code owner November 30, 2020 22:28
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Nov 30, 2020
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label Nov 30, 2020
@mohanli-ml mohanli-ml force-pushed the dp-branch branch 2 times, most recently from 9c44cfc to e04a5a5 Compare December 1, 2020 03:19
@mohanli-ml mohanli-ml requested a review from a team as a code owner December 1, 2020 03:19
// Create a new testHelper with the instrumented transport provider
try {
testHelper = RemoteSpannerHelper.create(builder.build(), env.getTestHelper().getInstanceId());
} catch (Throwable t) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we print a message / exit the test if something goes wrong here? Also, could we catch only Exception instead of Throwable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The original function https://github.com/googleapis/java-spanner/blob/master/google-cloud-spanner/src/main/java/com/google/cloud/spanner/testing/RemoteSpannerHelper.java#L158 throws a Throwable. Since we do not want to catch a Throwable, I directly throw it.


boolean seenEnough = false;

while (!seenEnough && stopwatch.elapsed(TimeUnit.MINUTES) < 2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have to wait for 2 minutes for this test? This slows down the whole integration suite when running locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The while loop will wait at most 2 minutes to get directpath traffic. In my manual test, the client should be able to get directpath traffic within a few seconds, then seenEnough becomes true, and the while loop will stop.

* Test DirectPath fallback behavior by injecting a ChannelHandler into the netty stack that will
* disrupt IPv6 communications.
*
* <p>WARNING: this test can only be run on a GCE VM and will explicitly ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this test pass locally? Will be users be able to run these (if not, maybe we should put them under the direct path profile, which is not enabled by default)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, my local test command mvn -Penable-integration-tests,spanner-directpath-it -DskipUTs=true -DtrimStackTrace=false -Dclirr.skip=true -Denforcer.skip=true -Dit.test=ITDirectPathFallback -DfailIfNoTests=false -Dspanner.directpath_test_scenario=ipv6 -fae verify can pass. I think users should not run this test since users are not supposed to know if the traffic is CFE or DirectPath. And to make sure the test is being running under direct path profile, I added a check at the beginning of the setup() function.

@codecov
Copy link

codecov bot commented Dec 1, 2020

Codecov Report

Merging #675 (3d549ed) into master (0c30632) will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #675      +/-   ##
============================================
+ Coverage     84.07%   84.12%   +0.04%     
- Complexity     2496     2510      +14     
============================================
  Files           141      142       +1     
  Lines         13812    13911      +99     
  Branches       1317     1323       +6     
============================================
+ Hits          11613    11703      +90     
- Misses         1654     1662       +8     
- Partials        545      546       +1     
Impacted Files Coverage Δ Complexity Δ
...anner/AdminRequestsPerMinuteExceededException.java 100.00% <0.00%> (ø) 1.00% <0.00%> (?%)
...le/cloud/spanner/connection/ConnectionOptions.java 87.25% <0.00%> (+0.58%) 65.00% <0.00%> (+4.00%)
...m/google/cloud/spanner/spi/v1/GapicSpannerRpc.java 83.22% <0.00%> (+0.59%) 81.00% <0.00%> (+1.00%)
.../google/cloud/spanner/SpannerExceptionFactory.java 82.47% <0.00%> (+1.98%) 46.00% <0.00%> (+7.00%)

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 0c30632...3d549ed. Read the comment docs.

@@ -0,0 +1,305 @@
/*
* Copyright 2017 Google LLC
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: 2020

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

private static Database db;
private static DatabaseClient client;

private static final String DIRECT_PATH_ENDPOINT = "aa423245250f2bbf.sandbox.googleapis.com:443";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume that this is temporary and will be replaced by a environment variable or similar at a later moment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is temporary. It will be removed once DirectPath goes to public beta, and this test will use the default Spanner endpoint. I added a TODO here.

+ " Key STRING(MAX) NOT NULL,"
+ " StringValue STRING(MAX),"
+ ") PRIMARY KEY (Key)",
"CREATE INDEX TestTableByValue ON TestTable(StringValue)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Could we remove these indexes? I don't think they are relevant for this test, and creating and maintaining secondary indexes are expensive operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

Copy link
Contributor

@thiagotnunes thiagotnunes left a comment

Choose a reason for hiding this comment

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

LGTM

@thiagotnunes thiagotnunes merged commit 789dcde into googleapis:master Dec 2, 2020
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
</dependency>
<dependency>
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that this change is now causing this problem further down the line with the flatten-maven-plugin: googleapis/java-spanner-jdbc#293 (comment)

ansh0l pushed a commit to ansh0l/java-spanner that referenced this pull request Nov 10, 2022
This is an auto-generated regeneration of the .pb.go files by
cloud.google.com/go/internal/gapicgen. Once this PR is submitted, genbot will
update the corresponding PR to depend on the newer version of go-genproto, and
assign reviewers. Whilst this or any regen PR is open in go-genproto, genbot
will not create any more regeneration PRs. If all regen PRs are closed,
gapicgen will create a new set of regeneration PRs once per night.

If you have been assigned to review this PR, please:

- Ensure that CI is passing. If it's failing, it requires your manual attention.
- Approve and submit this PR if you believe it's ready to ship. That will prompt
genbot to assign reviewers to the google-cloud-go PR.

Corresponding google-cloud-go PR: googleapis/google-cloud-go#4757

Changes:

feat(functions): add SecurityLevel option on HttpsTrigger
  PiperOrigin-RevId: 396889803
  Source-Link: googleapis/googleapis@44c497f

chore: regenerate API index

  Source-Link: googleapis/googleapis@231af01

feat: IdentityToolkit v2 public protos
  Committer: @alexander-fenster
  PiperOrigin-RevId: 396886667
  Source-Link: googleapis/googleapis@a9aafd5

docs(bigquery/storage): Align session length with public documentation feat: Expose estimated bytes that a session will scan.
  Committer: @emkornfield
  PiperOrigin-RevId: 396849937
  Source-Link: googleapis/googleapis@5661452

chore: regenerate API index

  Source-Link: googleapis/googleapis@a27fb7a

feat: added a flag to enable/disable gvnic on a node pool feat: added node pool level network config feat: added update support for node pool labels, taints and network tags feat: added configuration for workload certificates and identity service component feat: added configuration for node pool defaults, autopilot, logging and monitoring feat: added the option to specify L4 load balancer configuration and IP v6 configuration feat: added the option to list supported windows versions fix: deprecated KALM addon config option fix: deprecated cluster status condition code docs: clarified SetNodePoolSize API behavior
  PiperOrigin-RevId: 396762326
  Source-Link: googleapis/googleapis@1f1d09d

feat(talent): Added a new `KeywordMatchMode` field to support more keyword matching options feat: Added more `DiversificationLevel` configuration options
  PiperOrigin-RevId: 396667150
  Source-Link: googleapis/googleapis@caad48d

build(nodejs): correct artifact name for npm
  PiperOrigin-RevId: 396640130
  Source-Link: googleapis/googleapis@c53262d

chore(accessapproval): remove nonexistent method from config
  PiperOrigin-RevId: 396610698
  Source-Link: googleapis/googleapis@bdde047

chore: Kokoro CI configuration
  PiperOrigin-RevId: 396477636
  Source-Link: googleapis/googleapis@067740a

chore: Remove unnecessary double space in example API
  PiperOrigin-RevId: 396382685
  Source-Link: googleapis/googleapis@885183f

Synchronize new proto/yaml changes.
  PiperOrigin-RevId: 396379148
  Source-Link: googleapis/googleapis@de0d477
ansh0l pushed a commit to ansh0l/java-spanner that referenced this pull request Nov 10, 2022
This is an auto-generated regeneration of the .pb.go files by
cloud.google.com/go/internal/gapicgen. Once this PR is submitted, genbot will
update the corresponding PR to depend on the newer version of go-genproto, and
assign reviewers. Whilst this or any regen PR is open in go-genproto, genbot
will not create any more regeneration PRs. If all regen PRs are closed,
gapicgen will create a new set of regeneration PRs once per night.

If you have been assigned to review this PR, please:

- Ensure that CI is passing. If it's failing, it requires your manual attention.
- Approve and submit this PR if you believe it's ready to ship. That will prompt
genbot to assign reviewers to the google-cloud-go PR.

Corresponding google-cloud-go PR: googleapis/google-cloud-go#5112

Changes:

feat(texttospeech): update v1beta1 proto
  PiperOrigin-RevId: 409139454
  Source-Link: googleapis/googleapis@7c10623

chore: regenerate API index

  Source-Link: googleapis/googleapis@753ad85

chore(compute): Add C# generation for Compute v1

  Source-Link: googleapis/googleapis@05a6a82

feat(dialogflow/cx): allow setting custom CA for generic webhooks
  PiperOrigin-RevId: 408995680
  Source-Link: googleapis/googleapis@76f7f48

fix!(networkconnectivity): Mark a couple networkconnectivity API fields as required, to match implemented behavior
  PiperOrigin-RevId: 408969147
  Source-Link: googleapis/googleapis@cc003a4

chore(aiplatform): Add partial C# generation to AI Platform
  PiperOrigin-RevId: 408964828
  Source-Link: googleapis/googleapis@895ad28

chore(binaryauthorization): Fix SystemPolicy service name for BinaryAuthorization V1beta1
  PiperOrigin-RevId: 408764899
  Source-Link: googleapis/googleapis@66878ca

chore(iam/credentials): Update iam/credentials BUILD.bazel package name to google-cloud-iam chore(python): Update iam/credentials namespace to google.cloud.iam_credentials
  PiperOrigin-RevId: 408717007
  Source-Link: googleapis/googleapis@171d777

docs: fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408715661
  Source-Link: googleapis/googleapis@5bb0518

chore(container): Update container BUILD.bazel package name to google-cloud-container
  chore(python): Update namespace for container API to google.cloud

  PiperOrigin-RevId: 408673815
  Source-Link: googleapis/googleapis@c08b149

chore: Add C# generation rules
  PiperOrigin-RevId: 408640431
  Source-Link: googleapis/googleapis@b32a324

docs(datacatalog): Improved formatting
  PiperOrigin-RevId: 408569512
  Source-Link: googleapis/googleapis@c7b3bd0

docs(securitycenter): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408564402
  Source-Link: googleapis/googleapis@3020af5

feat(compute): Move compute.v1 from googleapis-discovery to googleapis (googleapis#675)
  * feat: Move compute.v1 from googleapis-discovery to googleapis

  The WORKSPACE file changes are expected to be overridden by the next sync, and it is ok, as the synce'd copy will contain the same changes.

  * feat: sync latest compute.proto files from googleapis-discovery
  Source-Link: googleapis/googleapis@691a18b

docs(samples): add example tags to generated samples
  PiperOrigin-RevId: 408439482
  Source-Link: googleapis/googleapis@b9f6184

chore(aiplatform): update Java and Python dependencies
  PiperOrigin-RevId: 408420890
  Source-Link: googleapis/googleapis@2921f9f

feat: update gapic-generator-csharp to 1.3.15 feat: update rules_gapic to 0.10.0
  Committer: @viacheslav-rostovtsev
  PiperOrigin-RevId: 408407783
  Source-Link: googleapis/googleapis@1bd869b

docs(gaming): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 408383287
  Source-Link: googleapis/googleapis@2aec4d0

feat(securitycenter): Added resource type and display_name field to the FindingResult, and supported them in the filter for ListFindings and GroupFindings. Also added display_name to the resource which is surfaced in NotificationMessage
  PiperOrigin-RevId: 408362247
  Source-Link: googleapis/googleapis@4d71c45

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360324
  Source-Link: googleapis/googleapis@78eb8a2

feat(redis): [Cloud Memorystore for Redis] Support Multiple Read Replicas when creating Instance
  PiperOrigin-RevId: 408360267
  Source-Link: googleapis/googleapis@8625cf0

docs(storage/internal): Add comments to GCS gRPC API proto spec to describe how naming works
  PiperOrigin-RevId: 408352508
  Source-Link: googleapis/googleapis@be4be3d

chore: regenerate API index

  Source-Link: googleapis/googleapis@9974d09

feat(binaryauthorization): add new admission rule types to Policy feat: update SignatureAlgorithm enum to match algorithm names in KMS feat: add SystemPolicyV1Beta1 service
  PiperOrigin-RevId: 408346628
  Source-Link: googleapis/googleapis@3dfbdc3

feat(datacatalog): Added BigQueryDateShardedSpec.latest_shard_resource field feat: Added SearchCatalogResult.display_name field feat: Added SearchCatalogResult.description field
  PiperOrigin-RevId: 408274419
  Source-Link: googleapis/googleapis@cbba92c

docs(resourcemanager): fix docstring formatting
  Committer: @parthea
  PiperOrigin-RevId: 407854413
  Source-Link: googleapis/googleapis@f81b7bd

chore: try to fix the mistaken-pull-closer config
  PiperOrigin-RevId: 407849101
  Source-Link: googleapis/googleapis@9e6c8c6

docs(ruby): Add simple code examples for all RPC methods
  PiperOrigin-RevId: 407847849
  Source-Link: googleapis/googleapis@1112610

feat(workflows/executions): add a stack_trace field to the Error messages specifying where the error occured feat: add call_log_level field to Execution messages doc: clarify requirement to escape strings within JSON arguments
  Update the Execution proto with stack_trace field which is populated on output if an error occurs, and the call_log_level field can be specified on input to request that function calls and/or errors for the given execution be logged to Cloud Logging.

  PiperOrigin-RevId: 407842136
  Source-Link: googleapis/googleapis@cd48c16

feat(dialogflow): added support to configure security settings, language code and time zone on conversation profile
  PiperOrigin-RevId: 407663596
  Source-Link: googleapis/googleapis@f9acb37

chore: generate java files for apps/script/type protos
  PiperOrigin-RevId: 407655547
  Source-Link: googleapis/googleapis@5946b7a

feat(functions): Secret Manager integration fields 'secret_environment_variables' and 'secret_volumes' added feat: CMEK integration fields 'kms_key_name' and 'docker_repository' added
  PiperOrigin-RevId: 407654258
  Source-Link: googleapis/googleapis@09b2576

chore: regenerate API index

  Source-Link: googleapis/googleapis@ddd6637

feat(contactcenterinsights): Add ability to update phrase matchers feat: Add issue model stats to time series feat: Add display name to issue model stats
  PiperOrigin-RevId: 407647313
  Source-Link: googleapis/googleapis@33fd29d
rajatbhatta pushed a commit to rajatbhatta/java-spanner that referenced this pull request Nov 17, 2022
🤖 I have created a release \*beep\* \*boop\*
---
### Updating meta-information for bleeding-edge SNAPSHOT release.
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the googleapis/java-spanner API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants