diff --git a/.github/readme/synth.metadata/synth.metadata b/.github/readme/synth.metadata/synth.metadata deleted file mode 100644 index f65c96d9b97..00000000000 --- a/.github/readme/synth.metadata/synth.metadata +++ /dev/null @@ -1,18 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/java-spanner.git", - "sha": "0d8aa7d2c576740ab608cba641bbe90a997c1010" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "e770c12f2a9a5f84566fe04b16a4ceec1c8c109b" - } - } - ] -} \ No newline at end of file diff --git a/.github/readme/synth.py b/.github/readme/synth.py deleted file mode 100644 index 7b48cc28d36..00000000000 --- a/.github/readme/synth.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""This script is used to synthesize generated the README for this library.""" - -from synthtool.languages import java - -java.custom_templates(["java_library/README.md"]) diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml index f247d5c7893..a0ba1f7d907 100644 --- a/.github/trusted-contribution.yml +++ b/.github/trusted-contribution.yml @@ -1,2 +1,3 @@ trustedContributors: -- renovate-bot \ No newline at end of file +- renovate-bot +- gcf-owl-bot[bot] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d510359d97d..3becb5c022a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,6 +12,9 @@ jobs: java: [8, 11] steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: ${{matrix.java}} @@ -23,6 +26,9 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: 8 @@ -37,6 +43,9 @@ jobs: java: [8, 11] steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: ${{matrix.java}} @@ -46,6 +55,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: 8 @@ -57,6 +69,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: 8 diff --git a/.github/workflows/integration-tests-against-emulator.yaml b/.github/workflows/integration-tests-against-emulator.yaml index adb38152d12..7dd5d159224 100644 --- a/.github/workflows/integration-tests-against-emulator.yaml +++ b/.github/workflows/integration-tests-against-emulator.yaml @@ -17,6 +17,9 @@ jobs: steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: 8 diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml index 4af5faaec87..474dd5f7b25 100644 --- a/.github/workflows/samples.yaml +++ b/.github/workflows/samples.yaml @@ -6,6 +6,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: 8 @@ -19,6 +22,9 @@ jobs: java: [8, 11] steps: - uses: actions/checkout@v2 + - uses: stCarolas/setup-maven@v4 + with: + maven-version: 3.8.1 - uses: actions/setup-java@v1 with: java-version: ${{matrix.java}} diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 7640116ebbb..55441238bf8 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -47,7 +47,10 @@ set +e case ${JOB_TYPE} in test) - mvn test -B -Dclirr.skip=true -Denforcer.skip=true + mvn test -B \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Djava.net.preferIPv4Stack=true RETURN_CODE=$? ;; lint) @@ -62,6 +65,7 @@ integration) mvn -B ${INTEGRATION_TEST_ARGS} \ -ntp \ -Penable-integration-tests \ + -Djava.net.preferIPv4Stack=true \ -DtrimStackTrace=false \ -Dclirr.skip=true \ -Denforcer.skip=true \ @@ -69,6 +73,19 @@ integration) verify RETURN_CODE=$? ;; +slowtests) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ + -Pslow-tests \ + -Djava.net.preferIPv4Stack=true \ + -DskipITs=false \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; samples) SAMPLES_DIR=samples # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. diff --git a/.kokoro/continuous/readme.cfg b/.kokoro/continuous/readme.cfg deleted file mode 100644 index acd7dd9717e..00000000000 --- a/.kokoro/continuous/readme.cfg +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" -} - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-spanner/.kokoro/readme.sh" -} - -# Build logs will be here -action { - define_artifacts { - regex: "**/*sponge_log.xml" - regex: "**/*sponge_log.log" - } -} - -# The github token is stored here. -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - # TODO(theacodes): remove this after secrets have globally propagated - backend_type: FASTCONFIGPUSH - } - } -} - -# Common env vars for all repositories and builds. -env_vars: { - key: "GITHUB_USER" - value: "yoshi-automation" -} -env_vars: { - key: "GITHUB_EMAIL" - value: "yoshi-automation@google.com" -} diff --git a/.kokoro/nightly/slow-tests.cfg b/.kokoro/nightly/slow-tests.cfg new file mode 100644 index 00000000000..e9fb72c59d7 --- /dev/null +++ b/.kokoro/nightly/slow-tests.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto +# Runs the slow tests only in the nightly build + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "slowtests" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh index 6e3f65999b3..7f78ee414fa 100755 --- a/.kokoro/release/common.sh +++ b/.kokoro/release/common.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh index 5c4551efa2c..742ec1a8860 100755 --- a/.kokoro/release/drop.sh +++ b/.kokoro/release/drop.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh index 1fa95fa537a..3cac3d8a97d 100755 --- a/.kokoro/release/promote.sh +++ b/.kokoro/release/promote.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh index ecdcccffed3..40c2797223b 100755 --- a/.kokoro/release/publish_javadoc.sh +++ b/.kokoro/release/publish_javadoc.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2019 Google Inc. +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh index 7f17db09b2d..43db20d266f 100755 --- a/.kokoro/release/publish_javadoc11.sh +++ b/.kokoro/release/publish_javadoc11.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2021 Google Inc. +# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh index 8a1033843cb..77dc4e8f0f3 100755 --- a/.kokoro/release/stage.sh +++ b/.kokoro/release/stage.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh index 9da0f839877..8b69b793c9e 100644 --- a/.kokoro/trampoline.sh +++ b/.kokoro/trampoline.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2018 Google Inc. +# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/CHANGELOG.md b/CHANGELOG.md index 40003760f64..a3b87f8a622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +### [6.12.5](https://www.github.com/googleapis/java-spanner/compare/v6.12.4...v6.12.5) (2021-09-27) + + +### Bug Fixes + +* sessions were not always removed from checkedOutSessions ([#1438](https://www.github.com/googleapis/java-spanner/issues/1438)) ([49360b1](https://www.github.com/googleapis/java-spanner/commit/49360b13e5d8904bfdc09cb4db8c24848debfa0b)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-monitoring to v3.0.6 ([#1443](https://www.github.com/googleapis/java-spanner/issues/1443)) ([159c026](https://www.github.com/googleapis/java-spanner/commit/159c026a250e6f9d6d583ef3123403a64f817e40)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.3.0 ([#1439](https://www.github.com/googleapis/java-spanner/issues/1439)) ([6bdeddf](https://www.github.com/googleapis/java-spanner/commit/6bdeddf7612964d4d59061d0a7c2956d66619a4b)) +* update dependency com.google.cloud:google-cloud-trace to v2.0.5 ([#1459](https://www.github.com/googleapis/java-spanner/issues/1459)) ([2ce9a1b](https://www.github.com/googleapis/java-spanner/commit/2ce9a1bd5cf8edb36b1c4fe57f2d9b304dcd6ccc)) + +### [6.12.4](https://www.github.com/googleapis/java-spanner/compare/v6.12.3...v6.12.4) (2021-09-16) + + +### Bug Fixes + +* do not serialize unnecessary fields ([#1426](https://www.github.com/googleapis/java-spanner/issues/1426)) ([29209f8](https://www.github.com/googleapis/java-spanner/commit/29209f83d10fa01b5566da66259da95dd60abca0)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-monitoring to v3.0.5 ([#1431](https://www.github.com/googleapis/java-spanner/issues/1431)) ([32eee0a](https://www.github.com/googleapis/java-spanner/commit/32eee0aa14f0b276673dca7a65e011a509e96453)) + +### [6.12.3](https://www.github.com/googleapis/java-spanner/compare/v6.12.2...v6.12.3) (2021-09-15) + + +### Bug Fixes + +* drop databases after sample tests ([#1401](https://www.github.com/googleapis/java-spanner/issues/1401)) ([c9f5048](https://www.github.com/googleapis/java-spanner/commit/c9f504829f53bfcff6f78bbbbc447cc8f10f5940)) +* fix JSON sample test ([#1417](https://www.github.com/googleapis/java-spanner/issues/1417)) ([dc1f9a9](https://www.github.com/googleapis/java-spanner/commit/dc1f9a92a7562e2585e2762c2749eb3207f67c25)) +* revert test category refactoring ([#1419](https://www.github.com/googleapis/java-spanner/issues/1419)) ([fe2ad14](https://www.github.com/googleapis/java-spanner/commit/fe2ad14eae2002552d61e497f9892c96584efc24)) + + +### Dependencies + +* update dependency com.google.cloud:google-cloud-monitoring to v3.0.4 ([#1422](https://www.github.com/googleapis/java-spanner/issues/1422)) ([d57d47e](https://www.github.com/googleapis/java-spanner/commit/d57d47eb3086d7352b6f7af1c4cc694de030e3ee)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.1 ([#1420](https://www.github.com/googleapis/java-spanner/issues/1420)) ([85b4f31](https://www.github.com/googleapis/java-spanner/commit/85b4f31d065202527ad3220cca9df94d40020e0a)) +* update dependency com.google.cloud:google-cloud-trace to v2.0.4 ([#1425](https://www.github.com/googleapis/java-spanner/issues/1425)) ([ce8776a](https://www.github.com/googleapis/java-spanner/commit/ce8776a310f0d53ea2aee738e0d56dc56371fa51)) + ### [6.12.2](https://www.github.com/googleapis/java-spanner/compare/v6.12.1...v6.12.2) (2021-09-01) diff --git a/README.md b/README.md index 894e767dddc..afc7da32bf2 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-spanner - 6.12.1 + 6.12.2 ``` @@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-spanner' If you are using Gradle without BOM, add this to your dependencies ```Groovy -implementation 'com.google.cloud:google-cloud-spanner:6.12.1' +implementation 'com.google.cloud:google-cloud-spanner:6.12.2' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.12.1" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.12.2" ``` ## Authentication diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 9c7c80d675e..73c83d5f355 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.12.2 + 6.12.5 pom com.google.cloud google-cloud-shared-config - 1.0.1 + 1.0.3 Google Cloud Spanner BOM @@ -54,43 +54,43 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.12.2 + 6.12.5 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.12.2 + 6.12.5 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.12.2 + 6.12.5 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.12.2 + 6.12.5 com.google.cloud google-cloud-spanner - 6.12.2 + 6.12.5 com.google.cloud google-cloud-spanner test-jar - 6.12.2 + 6.12.5 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.12.2 + 6.12.5 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.12.2 + 6.12.5 diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index b057e7bc717..055883422a0 100644 --- a/google-cloud-spanner/pom.xml +++ b/google-cloud-spanner/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner - 6.12.2 + 6.12.5 jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 google-cloud-spanner @@ -47,6 +47,7 @@ + default-test com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.IntegrationTest @@ -73,26 +74,14 @@ gcloud-devel projects/gcloud-devel/locations/us-central1/keyRings/spanner-test-keyring/cryptoKeys/spanner-test-key - 3000 + 6000 + default - com.google.cloud.spanner.IntegrationTest - com.google.cloud.spanner.FlakyTest,com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.ParallelIntegrationTest - - - - parallel-integration-test - - integration-test - - - com.google.cloud.spanner.ParallelIntegrationTest - com.google.cloud.spanner.FlakyTest,com.google.cloud.spanner.TracerTest,com.google.cloud.spanner.IntegrationTest - 8 - true + com.google.cloud.spanner.SerialIntegrationTest, com.google.cloud.spanner.ParallelIntegrationTest @@ -365,6 +354,47 @@ + + slow-tests + + + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + com.google.cloud.spanner.SlowTest + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + default + + com.google.cloud.spanner.SlowTest + + + + + parallel-integration-test + + integration-test + + + true + + + + + + + spanner-directpath-it @@ -380,7 +410,7 @@ true ipv4 - 3000 + 6000 diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index fbfc472bf53..95cc167fe10 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -1250,25 +1250,27 @@ public void prepareReadWriteTransaction() { @Override public void close() { - synchronized (lock) { - leakedException = null; - checkedOutSessions.remove(this); - } - PooledSession delegate = getOrNull(); - if (delegate != null) { - delegate.close(); + try { + asyncClose().get(); + } catch (InterruptedException e) { + throw SpannerExceptionFactory.propagateInterrupt(e); + } catch (ExecutionException e) { + throw SpannerExceptionFactory.asSpannerException(e.getCause()); } } @Override public ApiFuture asyncClose() { - synchronized (lock) { - leakedException = null; - checkedOutSessions.remove(this); - } - PooledSession delegate = getOrNull(); - if (delegate != null) { - return delegate.asyncClose(); + try { + PooledSession delegate = getOrNull(); + if (delegate != null) { + return delegate.asyncClose(); + } + } finally { + synchronized (lock) { + leakedException = null; + checkedOutSessions.remove(this); + } } return ApiFutures.immediateFuture(Empty.getDefaultInstance()); } @@ -1777,7 +1779,8 @@ private enum Position { private final Set allSessions = new HashSet<>(); @GuardedBy("lock") - private final Set checkedOutSessions = new HashSet<>(); + @VisibleForTesting + final Set checkedOutSessions = new HashSet<>(); private final SessionConsumer sessionConsumer = new SessionConsumerImpl(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java index d1dbb494594..aea9b512a1c 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java @@ -557,7 +557,9 @@ public static List getDefaultServiceScopes() { /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); } /** Returns a builder for the default ChannelProvider for this service. */ diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java index 556fa9a1b12..9f9cce8660e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/instance/v1/stub/InstanceAdminStubSettings.java @@ -350,7 +350,9 @@ public static List getDefaultServiceScopes() { /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); } /** Returns a builder for the default ChannelProvider for this service. */ diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementImpl.java index e9c9c1654e9..05dbc8975ce 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementImpl.java @@ -131,10 +131,10 @@ public String getMessage() { private ClientSideSetStatementImpl setStatement; /** The compiled regex pattern for recognizing this statement. */ - private Pattern pattern; + private transient Pattern pattern; /** A reference to the executor that should be used. */ - private ClientSideStatementExecutor executor; + private transient ClientSideStatementExecutor executor; /** * Compiles this {@link ClientSideStatementImpl}. Throws a {@link CompileException} if the diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java index badbcd98ed0..dfa85e2d85d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java @@ -300,7 +300,9 @@ public static List getDefaultServiceScopes() { /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); } /** Returns a builder for the default ChannelProvider for this service. */ diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java index 0a1efc2a48c..c2d6dc4cd21 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java @@ -69,6 +69,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -534,13 +535,18 @@ public void testAsyncTransactionManagerCommitWithTag() { @Test public void singleUse() { - DatabaseClient client = - spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + DatabaseClientImpl client = + (DatabaseClientImpl) + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + Set checkedOut = client.pool.checkedOutSessions; + assertThat(checkedOut).isEmpty(); try (ResultSet rs = client.singleUse().executeQuery(SELECT1)) { assertThat(rs.next()).isTrue(); + assertThat(checkedOut).hasSize(1); assertThat(rs.getLong(0)).isEqualTo(1L); assertThat(rs.next()).isFalse(); } + assertThat(checkedOut).isEmpty(); } @Test @@ -2097,4 +2103,71 @@ public void testAsyncTransactionManagerCommitWithPriority() { assertNotNull(request.getRequestOptions()); assertEquals(Priority.PRIORITY_HIGH, request.getRequestOptions().getPriority()); } + + @Test + public void singleUseNoAction_ClearsCheckedOutSession() { + DatabaseClientImpl client = + (DatabaseClientImpl) + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + Set checkedOut = client.pool.checkedOutSessions; + assertThat(checkedOut).isEmpty(); + + // Getting a single use read-only transaction and not using it should not cause any sessions + // to be stuck in the map of checked out sessions. + client.singleUse().close(); + + assertThat(checkedOut).isEmpty(); + } + + @Test + public void singleUseReadOnlyTransactionNoAction_ClearsCheckedOutSession() { + DatabaseClientImpl client = + (DatabaseClientImpl) + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + Set checkedOut = client.pool.checkedOutSessions; + assertThat(checkedOut).isEmpty(); + + client.singleUseReadOnlyTransaction().close(); + + assertThat(checkedOut).isEmpty(); + } + + @Test + public void readWriteTransactionNoAction_ClearsCheckedOutSession() { + DatabaseClientImpl client = + (DatabaseClientImpl) + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + Set checkedOut = client.pool.checkedOutSessions; + assertThat(checkedOut).isEmpty(); + + client.readWriteTransaction(); + + assertThat(checkedOut).isEmpty(); + } + + @Test + public void readOnlyTransactionNoAction_ClearsCheckedOutSession() { + DatabaseClientImpl client = + (DatabaseClientImpl) + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + Set checkedOut = client.pool.checkedOutSessions; + assertThat(checkedOut).isEmpty(); + + client.readOnlyTransaction().close(); + + assertThat(checkedOut).isEmpty(); + } + + @Test + public void transactionManagerNoAction_ClearsCheckedOutSession() { + DatabaseClientImpl client = + (DatabaseClientImpl) + spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE)); + Set checkedOut = client.pool.checkedOutSessions; + assertThat(checkedOut).isEmpty(); + + client.transactionManager().close(); + + assertThat(checkedOut).isEmpty(); + } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ITSessionPoolIntegrationTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ITSessionPoolIntegrationTest.java index 0bf38ca0316..36b9bee0af7 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ITSessionPoolIntegrationTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ITSessionPoolIntegrationTest.java @@ -40,7 +40,7 @@ *

See also {@code it/WriteIntegrationTest}, which provides coverage of writing and reading back * all Cloud Spanner types. */ -@Category(IntegrationTest.class) +@Category(SerialIntegrationTest.class) @RunWith(JUnit4.class) public class ITSessionPoolIntegrationTest { @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ParallelIntegrationTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ParallelIntegrationTest.java index 382f826c6ad..3553f331b31 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ParallelIntegrationTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ParallelIntegrationTest.java @@ -17,4 +17,4 @@ package com.google.cloud.spanner; /** Parallel Integration Test interface. */ -public interface ParallelIntegrationTest {} +public interface ParallelIntegrationTest extends IntegrationTest {} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SerialIntegrationTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SerialIntegrationTest.java new file mode 100644 index 00000000000..1aab60acf99 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SerialIntegrationTest.java @@ -0,0 +1,20 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner; + +/** Serial Integration Test interface. */ +public interface SerialIntegrationTest {} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SlowTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SlowTest.java new file mode 100644 index 00000000000..ba5e58f81f6 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SlowTest.java @@ -0,0 +1,20 @@ +/* + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner; + +/** Category of slow tests, to be run on the nightly build * */ +public interface SlowTest extends IntegrationTest {} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpanTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpanTest.java index 1ba1e9c25ca..34db11d3054 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpanTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpanTest.java @@ -48,8 +48,8 @@ import org.junit.runners.JUnit4; import org.threeten.bp.Duration; -@RunWith(JUnit4.class) @Category(TracerTest.class) +@RunWith(JUnit4.class) public class SpanTest { private static final String TEST_PROJECT = "my-project"; private static final String TEST_INSTANCE = "my-instance"; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TracerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TracerTest.java index cad3dd19fdf..c52070b02ab 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TracerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TracerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 Google LLC + * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,10 @@ package com.google.cloud.spanner; -import org.junit.experimental.categories.Category; - /** - * Tests marked with this {@link Category} will be executed in a separate execution with the - * maven-surefire plugin. The tests will be excluded from execution with the maven-failsafe plugin. + * Tests marked with this {@link org.junit.experimental.categories.Category} will be executed in a + * separate execution with the maven-surefire plugin. The tests will be excluded from execution with + * the maven-failsafe plugin. * *

Separate execution prevents the injection of any custom tracing configuration from interfering * with other tests, as most tracing configuration is stored in static final variables. diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITBulkConnectionTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITBulkConnectionTest.java index 8c1f0b3c945..9cc46e6ee13 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITBulkConnectionTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITBulkConnectionTest.java @@ -20,8 +20,8 @@ import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; -import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.ResultSet; +import com.google.cloud.spanner.SerialIntegrationTest; import com.google.cloud.spanner.Statement; import com.google.cloud.spanner.connection.ITAbstractSpannerTest; import java.util.ArrayList; @@ -39,7 +39,7 @@ * parallel with other tests, as it tries to close all active connections, and should not try to * close connections of other integration tests. */ -@Category(IntegrationTest.class) +@Category(SerialIntegrationTest.class) @RunWith(JUnit4.class) public class ITBulkConnectionTest extends ITAbstractSpannerTest { private static final int NUMBER_OF_TEST_CONNECTIONS = 250; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncAPITest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncAPITest.java index ab24219d7ed..ebd3ab4883f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncAPITest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncAPITest.java @@ -36,13 +36,13 @@ import com.google.cloud.spanner.DatabaseClient; import com.google.cloud.spanner.DatabaseId; import com.google.cloud.spanner.ErrorCode; -import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.IntegrationTestEnv; import com.google.cloud.spanner.Key; import com.google.cloud.spanner.KeyRange; import com.google.cloud.spanner.KeySet; import com.google.cloud.spanner.Mutation; import com.google.cloud.spanner.Options; +import com.google.cloud.spanner.SerialIntegrationTest; import com.google.cloud.spanner.SpannerException; import com.google.cloud.spanner.Statement; import com.google.cloud.spanner.Struct; @@ -68,7 +68,7 @@ import org.junit.runners.JUnit4; /** Integration tests for asynchronous APIs. */ -@Category(IntegrationTest.class) +@Category(SerialIntegrationTest.class) @RunWith(JUnit4.class) public class ITAsyncAPITest { @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncExamplesTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncExamplesTest.java index c340ebd21ed..5a22c64009f 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncExamplesTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITAsyncExamplesTest.java @@ -29,12 +29,12 @@ import com.google.cloud.spanner.Database; import com.google.cloud.spanner.DatabaseClient; import com.google.cloud.spanner.ErrorCode; -import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.IntegrationTestEnv; import com.google.cloud.spanner.Key; import com.google.cloud.spanner.KeySet; import com.google.cloud.spanner.Mutation; import com.google.cloud.spanner.ReadOnlyTransaction; +import com.google.cloud.spanner.SerialIntegrationTest; import com.google.cloud.spanner.SpannerException; import com.google.cloud.spanner.Statement; import com.google.cloud.spanner.Struct; @@ -59,7 +59,7 @@ import org.junit.runners.JUnit4; /** Integration tests for asynchronous APIs. */ -@Category(IntegrationTest.class) +@Category(SerialIntegrationTest.class) @RunWith(JUnit4.class) public class ITAsyncExamplesTest { @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java index fcda2603cad..df541e84ef0 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java @@ -25,9 +25,9 @@ import com.google.cloud.spanner.InstanceAdminClient; import com.google.cloud.spanner.InstanceConfig; import com.google.cloud.spanner.InstanceInfo; -import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.IntegrationTestEnv; import com.google.cloud.spanner.Options; +import com.google.cloud.spanner.SerialIntegrationTest; import com.google.common.collect.Iterators; import com.google.spanner.admin.instance.v1.UpdateInstanceMetadata; import java.util.ArrayList; @@ -42,7 +42,7 @@ import org.junit.runners.JUnit4; /** Integration tests for {@link com.google.cloud.spanner.InstanceAdminClient}. */ -@Category(IntegrationTest.class) +@Category(SerialIntegrationTest.class) @RunWith(JUnit4.class) public class ITInstanceAdminTest { @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITVPCNegativeTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITVPCNegativeTest.java index 584ab0ff86f..01d2dc1ad37 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITVPCNegativeTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITVPCNegativeTest.java @@ -35,10 +35,10 @@ import com.google.cloud.spanner.ErrorCode; import com.google.cloud.spanner.InstanceAdminClient; import com.google.cloud.spanner.InstanceId; -import com.google.cloud.spanner.IntegrationTest; import com.google.cloud.spanner.KeySet; import com.google.cloud.spanner.Options; import com.google.cloud.spanner.ResultSet; +import com.google.cloud.spanner.SerialIntegrationTest; import com.google.cloud.spanner.SessionPoolOptions; import com.google.cloud.spanner.Spanner; import com.google.cloud.spanner.SpannerException; @@ -62,7 +62,7 @@ import org.junit.runners.JUnit4; /** Integration tests for VPC-SC */ -@Category(IntegrationTest.class) +@Category(SerialIntegrationTest.class) @RunWith(JUnit4.class) public class ITVPCNegativeTest { private static final Logger logger = Logger.getLogger(ITVPCNegativeTest.class.getName()); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITBackupTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java similarity index 99% rename from google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITBackupTest.java rename to google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java index 6ccce161f08..672f6551e99 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITBackupTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.cloud.spanner.it; +package com.google.cloud.spanner.it.slow; import static com.google.cloud.spanner.testing.EmulatorSpannerHelper.isUsingEmulator; import static com.google.cloud.spanner.testing.TimestampHelper.afterDays; @@ -42,9 +42,9 @@ import com.google.cloud.spanner.IntegrationTestEnv; import com.google.cloud.spanner.Mutation; import com.google.cloud.spanner.Options; -import com.google.cloud.spanner.ParallelIntegrationTest; import com.google.cloud.spanner.Restore; import com.google.cloud.spanner.ResultSet; +import com.google.cloud.spanner.SlowTest; import com.google.cloud.spanner.SpannerException; import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.Statement; @@ -85,7 +85,7 @@ * Integration tests creating, reading, updating and deleting backups. This test class combines * several tests into one long test to reduce the total execution time. */ -@Category(ParallelIntegrationTest.class) +@Category(SlowTest.class) @RunWith(JUnit4.class) public class ITBackupTest { private static final Logger logger = Logger.getLogger(ITBackupTest.class.getName()); diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index e9d15cf45f7..5b9a3b4bd04 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.12.2 + 6.12.5 grpc-google-cloud-spanner-admin-database-v1 GRPC library for grpc-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 123a3e55993..d79e5557a26 100644 --- a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.12.2 + 6.12.5 grpc-google-cloud-spanner-admin-instance-v1 GRPC library for grpc-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index b84cb1fe1cf..1408646f387 100644 --- a/grpc-google-cloud-spanner-v1/pom.xml +++ b/grpc-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.12.2 + 6.12.5 grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 diff --git a/pom.xml b/pom.xml index 60771971086..313c7767aad 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.12.2 + 6.12.5 Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.0.1 + 1.0.3 @@ -54,7 +54,7 @@ UTF-8 github google-cloud-spanner-parent - 2.2.0 + 2.3.0 @@ -62,37 +62,37 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.12.2 + 6.12.5 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.12.2 + 6.12.5 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.12.2 + 6.12.5 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.12.2 + 6.12.5 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.12.2 + 6.12.5 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.12.2 + 6.12.5 com.google.cloud google-cloud-spanner - 6.12.2 + 6.12.5 @@ -186,7 +186,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.3.0 + 3.3.1 html diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 473ac667376..f884ebdc747 100644 --- a/proto-google-cloud-spanner-admin-database-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-database-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.12.2 + 6.12.5 proto-google-cloud-spanner-admin-database-v1 PROTO library for proto-google-cloud-spanner-admin-database-v1 com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index af158ed266f..072468a787c 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/pom.xml +++ b/proto-google-cloud-spanner-admin-instance-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.12.2 + 6.12.5 proto-google-cloud-spanner-admin-instance-v1 PROTO library for proto-google-cloud-spanner-admin-instance-v1 com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index a1e34ca382f..e0f8a8c9933 100644 --- a/proto-google-cloud-spanner-v1/pom.xml +++ b/proto-google-cloud-spanner-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.12.2 + 6.12.5 proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.12.2 + 6.12.5 diff --git a/renovate.json b/renovate.json index de367d36a86..6c98729fcab 100644 --- a/renovate.json +++ b/renovate.json @@ -70,8 +70,5 @@ } ], "semanticCommits": true, - "dependencyDashboard": true, - "dependencyDashboardLabels": [ - "type: process" - ] + "dependencyDashboard": true } diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index e827248d0cf..0a046fc9613 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -22,8 +22,8 @@ 1.8 UTF-8 0.28.3 - 2.0.3 - 3.0.3 + 2.0.5 + 3.0.6 @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.12.1 + 6.12.2 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 6fe06a44f8c..cf476922ec5 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -22,8 +22,8 @@ 1.8 UTF-8 0.28.3 - 2.0.3 - 3.0.3 + 2.0.5 + 3.0.6 @@ -31,7 +31,7 @@ com.google.cloud google-cloud-spanner - 6.12.2 + 6.12.5 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 586d1dcfd26..4c6677f8b28 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -33,7 +33,7 @@ com.google.cloud libraries-bom - 22.0.0 + 23.0.0 pom import diff --git a/samples/snippets/src/main/java/com/example/spanner/QueryWithJsonParameterSample.java b/samples/snippets/src/main/java/com/example/spanner/QueryWithJsonParameterSample.java index c311901a1fa..022818cec66 100644 --- a/samples/snippets/src/main/java/com/example/spanner/QueryWithJsonParameterSample.java +++ b/samples/snippets/src/main/java/com/example/spanner/QueryWithJsonParameterSample.java @@ -42,7 +42,7 @@ static void queryWithJsonParameter() { } static void queryWithJsonParameter(DatabaseClient client) { - String exampleJson = "{rating: 9}"; + String exampleJson = "{\"rating\": 9}"; Statement statement = Statement.newBuilder( "SELECT VenueId, VenueDetails\n" @@ -56,7 +56,7 @@ static void queryWithJsonParameter(DatabaseClient client) { while (resultSet.next()) { System.out.printf( "VenueId: %s, VenueDetails: %s%n", - resultSet.getLong("VenueId"), resultSet.getString("VenueDetails")); + resultSet.getLong("VenueId"), resultSet.getJson("VenueDetails")); } } } diff --git a/samples/snippets/src/test/java/com/example/spanner/SampleTestBase.java b/samples/snippets/src/test/java/com/example/spanner/SampleTestBase.java index d492a88e10e..81286eb366d 100644 --- a/samples/snippets/src/test/java/com/example/spanner/SampleTestBase.java +++ b/samples/snippets/src/test/java/com/example/spanner/SampleTestBase.java @@ -61,30 +61,26 @@ public static void beforeClass() { @AfterClass public static void afterClass() { for (String databaseId : idGenerator.getDatabaseIds()) { + System.out.println("Trying to drop " + databaseId); try { + // If the database is not found, it is ignored (no exception is thrown) databaseAdminClient.dropDatabase(instanceId, databaseId); - } catch (Exception e1) { - try { - databaseAdminClient.dropDatabase(multiRegionalInstanceId, databaseId); - } catch (Exception e2) { - System.out.println( - "Failed to drop database " + databaseId + " due to " + e2.getMessage() - + ", skipping..." - ); - } + databaseAdminClient.dropDatabase(multiRegionalInstanceId, databaseId); + } catch (Exception e) { + System.out.println( + "Failed to drop database " + databaseId + " due to " + e.getMessage() + ", skipping..." + ); } } for (String backupId : idGenerator.getBackupIds()) { try { + // If the backup is not found, it is ignored (no exception is thrown) databaseAdminClient.deleteBackup(instanceId, backupId); - } catch (Exception e1) { - try { - databaseAdminClient.deleteBackup(multiRegionalInstanceId, backupId); - } catch (Exception e2) { - System.out.println( - "Failed to delete backup " + backupId + " due to " + e2.getMessage() + ", skipping..." - ); - } + databaseAdminClient.deleteBackup(multiRegionalInstanceId, backupId); + } catch (Exception e) { + System.out.println( + "Failed to delete backup " + backupId + " due to " + e.getMessage() + ", skipping..." + ); } } spanner.close(); diff --git a/samples/snippets/src/test/java/com/example/spanner/SpannerStandaloneExamplesIT.java b/samples/snippets/src/test/java/com/example/spanner/SpannerStandaloneExamplesIT.java index c98c9c590b3..03291a91f61 100644 --- a/samples/snippets/src/test/java/com/example/spanner/SpannerStandaloneExamplesIT.java +++ b/samples/snippets/src/test/java/com/example/spanner/SpannerStandaloneExamplesIT.java @@ -238,7 +238,7 @@ public void updateJsonData_shouldWriteData() { () -> UpdateJsonDataSample.updateJsonData( spanner.getDatabaseClient(DatabaseId.of(projectId, instanceId, databaseId)))); - assertThat(out).contains("VenueDetails successfully updated"); + assertThat(out).contains("Venues successfully updated"); } @Test @@ -274,6 +274,6 @@ public void queryWithJsonParameter_shouldReturnResults() { + "\"tags\":[\"large\",\"airy\"]}")) .build())); String out = runExample(() -> QueryWithJsonParameterSample.queryWithJsonParameter(client)); - assertThat(out).contains("4 35000"); + assertThat(out).contains("VenueId: 19, VenueDetails: {\"open\":true,\"rating\":9}"); } } diff --git a/synth.metadata b/synth.metadata index 838f3afd372..392814c1d12 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,22 +4,22 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-spanner.git", - "sha": "d28d8a1d710b1cd47ef3b2ca1fa87750a007b5cf" + "sha": "06f98b174b785d61ad430b27a3a8216e3c874318" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "a739464cacb3aa6d375683aefe16b79c21da1bb0", - "internalRef": "389657692" + "sha": "e1738ee972b49fd0c4d4718b035444495142b781", + "internalRef": "391407209" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "9a238a0623879c3de129a376c6085d4a862f6eb9" + "sha": "0752ff727a19a467dffed335d5e59303689cf0d1" } } ], @@ -58,7 +58,6 @@ ".github/ISSUE_TEMPLATE/support_request.md", ".github/PULL_REQUEST_TEMPLATE.md", ".github/generated-files-bot.yml", - ".github/readme/synth.py", ".github/release-trigger.yml", ".github/snippet-bot.yml", ".github/trusted-contribution.yml", @@ -66,12 +65,10 @@ ".github/workflows/auto-release.yaml", ".github/workflows/ci.yaml", ".kokoro/build.bat", - ".kokoro/build.sh", ".kokoro/coerce_logs.sh", ".kokoro/common.cfg", ".kokoro/common.sh", ".kokoro/continuous/java8.cfg", - ".kokoro/continuous/readme.cfg", ".kokoro/dependencies.sh", ".kokoro/nightly/integration.cfg", ".kokoro/nightly/java11.cfg", diff --git a/synth.py b/synth.py index 436da376787..4eebd59f180 100644 --- a/synth.py +++ b/synth.py @@ -93,4 +93,5 @@ '.github/release-please.yml', '.github/blunderbuss.yml', '.github/workflows/samples.yaml', + '.kokoro/build.sh', ]) diff --git a/versions.txt b/versions.txt index 3dd8259d6bb..14afe0755fb 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.12.2:6.12.2 -proto-google-cloud-spanner-v1:6.12.2:6.12.2 -proto-google-cloud-spanner-admin-database-v1:6.12.2:6.12.2 -grpc-google-cloud-spanner-v1:6.12.2:6.12.2 -grpc-google-cloud-spanner-admin-instance-v1:6.12.2:6.12.2 -grpc-google-cloud-spanner-admin-database-v1:6.12.2:6.12.2 -google-cloud-spanner:6.12.2:6.12.2 \ No newline at end of file +proto-google-cloud-spanner-admin-instance-v1:6.12.5:6.12.5 +proto-google-cloud-spanner-v1:6.12.5:6.12.5 +proto-google-cloud-spanner-admin-database-v1:6.12.5:6.12.5 +grpc-google-cloud-spanner-v1:6.12.5:6.12.5 +grpc-google-cloud-spanner-admin-instance-v1:6.12.5:6.12.5 +grpc-google-cloud-spanner-admin-database-v1:6.12.5:6.12.5 +google-cloud-spanner:6.12.5:6.12.5 \ No newline at end of file