diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 954edcdc46b..8807efcad4b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,16 @@ +# Copyright 2022 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. docker: - digest: sha256:4e961d006ec9e44501273788f3cbe1e060c4666742ba190f60d6a05bcdf3ac8f image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest + digest: sha256:7c853edc4136ae8f19f9d46d4569d38de2e446db2eea057f32e412bdba255846 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 403e068506e..f95770d7cb4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,7 +21,7 @@ If you are still having issues, please include as much information as possible: General, Core, and Other are also allowed as types 2. OS type and version: 3. Java version: -4. spanner version(s): +4. version(s): #### Steps to reproduce diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml index 7513acaebcc..c5132427982 100644 --- a/.github/workflows/approve-readme.yaml +++ b/.github/workflows/approve-readme.yaml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' steps: - - uses: actions/github-script@v3 + - uses: actions/github-script@v5 with: github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} script: | diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml index 9b4fd4d8348..59c7cadde31 100644 --- a/.github/workflows/auto-release.yaml +++ b/.github/workflows/auto-release.yaml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest if: contains(github.head_ref, 'release-please') steps: - - uses: actions/github-script@v3 + - uses: actions/github-script@v5 with: github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} debug: true diff --git a/.kokoro/nightly/java11-integration.cfg b/.kokoro/nightly/java11-integration.cfg new file mode 100644 index 00000000000..58049cc38f1 --- /dev/null +++ b/.kokoro/nightly/java11-integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-public-resources/java11014" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# 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/.readme-partials.yaml b/.readme-partials.yaml index c57d2e9035c..f2872f805b6 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -67,9 +67,9 @@ custom_content: | * `cloud.google.com/java/spanner/max_allowed_sessions`: This shows the maximum number of sessions allowed. - * `cloud.google.com/java/spanner/in_use_sessions`: This metric allows users to + * `cloud.google.com/java/spanner/num_sessions_in_pool`: This metric allows users to see instance-level and database-level data for the total number of sessions in - use (or checked out from the pool) at this very moment. + the pool at this very moment. * `cloud.google.com/java/spanner/num_acquired_sessions`: This metric allows users to see the total number of acquired sessions. @@ -83,24 +83,31 @@ custom_content: | it waits until a session is released into the pool by another thread) due to pool exhaustion since the server process started. + * `cloud.google.com/java/spanner/gfe_latency`: This metric shows latency between + Google's network receiving an RPC and reading back the first byte of the response. + + * `cloud.google.com/java/spanner/gfe_header_missing_count`: This metric shows the + number of RPC responses received without the server-timing header, most likely + indicating that the RPC never reached Google's network. + If you are using Maven, add this to your pom.xml file ```xml io.opencensus opencensus-impl - 0.26.0 + 0.30.0 runtime io.opencensus opencensus-exporter-stats-stackdriver - 0.26.0 + 0.30.0 ``` If you are using Gradle, add this to your dependencies ```Groovy - compile 'io.opencensus:opencensus-impl:0.26.0' - compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.26.0' + compile 'io.opencensus:opencensus-impl:0.30.0' + compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.30.0' ``` At the start of your application configure the exporter: diff --git a/.repo-metadata.json b/.repo-metadata.json index 1ca236f59c8..d047e61ba9c 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,11 +1,11 @@ { - "name": "spanner", + "api_shortname": "spanner", "name_pretty": "Cloud Spanner", "product_documentation": "https://cloud.google.com/spanner/docs/", "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-spanner/latest/history", "api_description": "is a fully managed, mission-critical, \nrelational database service that offers transactional consistency at global scale, \nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \nfor high availability.\n\nBe sure to activate the Cloud Spanner API on the Developer's Console to\nuse Cloud Spanner from your project.", "issue_tracker": "https://issuetracker.google.com/issues?q=componentid:190851%2B%20status:open", - "release_level": "ga", + "release_level": "stable", "language": "java", "min_java_version": 8, "repo": "googleapis/java-spanner", diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc8f065f34..79dc4815b89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [6.18.0](https://github.com/googleapis/java-spanner/compare/v6.17.4...v6.18.0) (2022-02-03) + + +### Features + +* add database dialect ([#1657](https://github.com/googleapis/java-spanner/issues/1657)) ([269f090](https://github.com/googleapis/java-spanner/commit/269f090805b366fcd7a7163a6602268b4d143aa4)) +* Updating readme with new gfe latency metrics ([#1630](https://github.com/googleapis/java-spanner/issues/1630)) ([d02601a](https://github.com/googleapis/java-spanner/commit/d02601ac73a1b9ab580480c4370ba26260996d8c)) + + +### Dependencies + +* **java:** update actions/github-script action to v5 ([#1339](https://github.com/googleapis/java-spanner/issues/1339)) ([#1659](https://github.com/googleapis/java-spanner/issues/1659)) ([203b346](https://github.com/googleapis/java-spanner/commit/203b346e748b78e56aad2246c3970593a7584825)) +* update actions/github-script action to v5 ([#1658](https://github.com/googleapis/java-spanner/issues/1658)) ([a2f3790](https://github.com/googleapis/java-spanner/commit/a2f3790c35ecc960b50979caa12f6355f397c127)) +* update dependency com.google.cloud:google-cloud-monitoring to v3.2.1 ([#1637](https://github.com/googleapis/java-spanner/issues/1637)) ([73c9434](https://github.com/googleapis/java-spanner/commit/73c94349b56710adc788c3a8440648e7f66f228b)) +* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.7.0 ([#1662](https://github.com/googleapis/java-spanner/issues/1662)) ([ece31c0](https://github.com/googleapis/java-spanner/commit/ece31c0d873ee537b167792dcbe9dc62d783a52d)) +* update opencensus.version to v0.31.0 ([#1661](https://github.com/googleapis/java-spanner/issues/1661)) ([1e86a3a](https://github.com/googleapis/java-spanner/commit/1e86a3a4542e6744cb1d8a8dbca36218c147c9f0)) + ### [6.17.4](https://www.github.com/googleapis/java-spanner/compare/v6.17.3...v6.17.4) (2022-01-07) diff --git a/README.md b/README.md index 126190e6bb8..6779605fedc 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file com.google.cloud libraries-bom - 24.1.2 + 24.2.0 pom import @@ -41,7 +41,7 @@ If you are using Maven without BOM, add this to your dependencies: com.google.cloud google-cloud-spanner - 6.17.3 + 6.17.4 ``` @@ -49,20 +49,20 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies ```Groovy -implementation platform('com.google.cloud:libraries-bom:24.1.2') +implementation platform('com.google.cloud:libraries-bom:24.2.0') 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.17.3' +implementation 'com.google.cloud:google-cloud-spanner:6.17.4' ``` If you are using SBT, add this to your dependencies ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.17.3" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.17.4" ``` ## Authentication @@ -171,9 +171,9 @@ with `grpc.io/client/`. * `cloud.google.com/java/spanner/max_allowed_sessions`: This shows the maximum number of sessions allowed. -* `cloud.google.com/java/spanner/in_use_sessions`: This metric allows users to +* `cloud.google.com/java/spanner/num_sessions_in_pool`: This metric allows users to see instance-level and database-level data for the total number of sessions in - use (or checked out from the pool) at this very moment. + the pool at this very moment. * `cloud.google.com/java/spanner/num_acquired_sessions`: This metric allows users to see the total number of acquired sessions. @@ -187,24 +187,31 @@ with `grpc.io/client/`. it waits until a session is released into the pool by another thread) due to pool exhaustion since the server process started. +* `cloud.google.com/java/spanner/gfe_latency`: This metric shows latency between + Google's network receiving an RPC and reading back the first byte of the response. + +* `cloud.google.com/java/spanner/gfe_header_missing_count`: This metric shows the + number of RPC responses received without the server-timing header, most likely + indicating that the RPC never reached Google's network. + If you are using Maven, add this to your pom.xml file ```xml io.opencensus opencensus-impl - 0.26.0 + 0.30.0 runtime io.opencensus opencensus-exporter-stats-stackdriver - 0.26.0 + 0.30.0 ``` If you are using Gradle, add this to your dependencies ```Groovy -compile 'io.opencensus:opencensus-impl:0.26.0' -compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.26.0' +compile 'io.opencensus:opencensus-impl:0.30.0' +compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.30.0' ``` At the start of your application configure the exporter: @@ -370,7 +377,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java8-win.html [kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.svg [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html -[stability-image]: https://img.shields.io/badge/stability-ga-green +[stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg [maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-spanner&core=gav [authentication]: https://github.com/googleapis/google-cloud-java#authentication diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 6578ace9e45..14e39747f65 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.17.4 + 6.18.0 pom com.google.cloud google-cloud-shared-config - 1.2.4 + 1.2.6 Google Cloud Spanner BOM @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.17.4 + 6.18.0 com.google.cloud google-cloud-spanner test-jar - 6.17.4 + 6.18.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.17.4 + 6.18.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.17.4 + 6.18.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.17.4 + 6.18.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.17.4 + 6.18.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.17.4 + 6.18.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.17.4 + 6.18.0 @@ -100,7 +100,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.9.0 1.8 1.8 diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index 7d63ff9b30b..76bea85ee73 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.17.4 + 6.18.0 jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,11 +11,11 @@ com.google.cloud google-cloud-spanner-parent - 6.17.4 + 6.18.0 google-cloud-spanner - 0.30.0 + 0.31.0 @@ -288,7 +288,7 @@ org.mockito mockito-core - 4.2.0 + 4.3.1 test @@ -394,6 +394,8 @@ default com.google.cloud.spanner.SlowTest + + 7200 diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java index 091cdf486f3..ac602861ce0 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java @@ -77,9 +77,9 @@ /** * Service Description: Cloud Spanner Database Admin API * - *

The Cloud Spanner Database Admin API can be used to create, drop, and list databases. It also - * enables updating the schema of pre-existing databases. It can be also used to create, delete and - * list backups for a database and to restore from an existing backup. + *

The Cloud Spanner Database Admin API can be used to: * create, drop, and list databases + * * update the schema of pre-existing databases * create, delete and list backups for a + * database * restore a database from an existing backup * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: @@ -438,6 +438,7 @@ public final OperationFuture createDatabaseAsy * .setCreateStatement("createStatement744686547") * .addAllExtraStatements(new ArrayList()) * .setEncryptionConfig(EncryptionConfig.newBuilder().build()) + * .setDatabaseDialect(DatabaseDialect.forNumber(0)) * .build(); * Database response = databaseAdminClient.createDatabaseAsync(request).get(); * } @@ -471,6 +472,7 @@ public final OperationFuture createDatabaseAsy * .setCreateStatement("createStatement744686547") * .addAllExtraStatements(new ArrayList()) * .setEncryptionConfig(EncryptionConfig.newBuilder().build()) + * .setDatabaseDialect(DatabaseDialect.forNumber(0)) * .build(); * OperationFuture future = * databaseAdminClient.createDatabaseOperationCallable().futureCall(request); @@ -504,6 +506,7 @@ public final OperationFuture createDatabaseAsy * .setCreateStatement("createStatement744686547") * .addAllExtraStatements(new ArrayList()) * .setEncryptionConfig(EncryptionConfig.newBuilder().build()) + * .setDatabaseDialect(DatabaseDialect.forNumber(0)) * .build(); * ApiFuture future = * databaseAdminClient.createDatabaseCallable().futureCall(request); @@ -772,7 +775,8 @@ public final UnaryCallable updateDatabaseDd // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be - * retained according to their `expire_time`. + * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept + * requests for a few seconds after the database has been deleted. * *

Sample code: * @@ -797,7 +801,8 @@ public final void dropDatabase(DatabaseName database) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be - * retained according to their `expire_time`. + * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept + * requests for a few seconds after the database has been deleted. * *

Sample code: * @@ -819,7 +824,8 @@ public final void dropDatabase(String database) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be - * retained according to their `expire_time`. + * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept + * requests for a few seconds after the database has been deleted. * *

Sample code: * @@ -843,7 +849,8 @@ public final void dropDatabase(DropDatabaseRequest request) { // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be - * retained according to their `expire_time`. + * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept + * requests for a few seconds after the database has been deleted. * *

Sample code: * diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/package-info.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/package-info.java index 50846d9be21..42874c08c82 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/package-info.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/package-info.java @@ -21,9 +21,9 @@ * *

Service Description: Cloud Spanner Database Admin API * - *

The Cloud Spanner Database Admin API can be used to create, drop, and list databases. It also - * enables updating the schema of pre-existing databases. It can be also used to create, delete and - * list backups for a database and to restore from an existing backup. + *

The Cloud Spanner Database Admin API can be used to: * create, drop, and list databases + * * update the schema of pre-existing databases * create, delete and list backups for a + * database * restore a database from an existing backup * *

Sample for DatabaseAdminClient: * diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java index e37cf2bc316..ef43a4b44c2 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClientTest.java @@ -49,6 +49,7 @@ import com.google.spanner.admin.database.v1.CreateBackupRequest; import com.google.spanner.admin.database.v1.CreateDatabaseRequest; import com.google.spanner.admin.database.v1.Database; +import com.google.spanner.admin.database.v1.DatabaseDialect; import com.google.spanner.admin.database.v1.DatabaseName; import com.google.spanner.admin.database.v1.DeleteBackupRequest; import com.google.spanner.admin.database.v1.DropDatabaseRequest; @@ -224,6 +225,7 @@ public void createDatabaseTest() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -280,6 +282,7 @@ public void createDatabaseTest2() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -336,6 +339,7 @@ public void getDatabaseTest() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); mockDatabaseAdmin.addResponse(expectedResponse); @@ -381,6 +385,7 @@ public void getDatabaseTest2() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); mockDatabaseAdmin.addResponse(expectedResponse); @@ -900,6 +905,7 @@ public void createBackupTest() throws Exception { .setSizeBytes(-1796325715) .addAllReferencingDatabases(new ArrayList()) .setEncryptionInfo(EncryptionInfo.newBuilder().build()) + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -959,6 +965,7 @@ public void createBackupTest2() throws Exception { .setSizeBytes(-1796325715) .addAllReferencingDatabases(new ArrayList()) .setEncryptionInfo(EncryptionInfo.newBuilder().build()) + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -1018,6 +1025,7 @@ public void getBackupTest() throws Exception { .setSizeBytes(-1796325715) .addAllReferencingDatabases(new ArrayList()) .setEncryptionInfo(EncryptionInfo.newBuilder().build()) + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); mockDatabaseAdmin.addResponse(expectedResponse); @@ -1063,6 +1071,7 @@ public void getBackupTest2() throws Exception { .setSizeBytes(-1796325715) .addAllReferencingDatabases(new ArrayList()) .setEncryptionInfo(EncryptionInfo.newBuilder().build()) + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); mockDatabaseAdmin.addResponse(expectedResponse); @@ -1108,6 +1117,7 @@ public void updateBackupTest() throws Exception { .setSizeBytes(-1796325715) .addAllReferencingDatabases(new ArrayList()) .setEncryptionInfo(EncryptionInfo.newBuilder().build()) + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); mockDatabaseAdmin.addResponse(expectedResponse); @@ -1312,6 +1322,7 @@ public void restoreDatabaseTest() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -1371,6 +1382,7 @@ public void restoreDatabaseTest2() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -1430,6 +1442,7 @@ public void restoreDatabaseTest3() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() @@ -1489,6 +1502,7 @@ public void restoreDatabaseTest4() throws Exception { .setVersionRetentionPeriod("versionRetentionPeriod-629783929") .setEarliestVersionTime(Timestamp.newBuilder().build()) .setDefaultLeader("defaultLeader759009962") + .setDatabaseDialect(DatabaseDialect.forNumber(0)) .build(); Operation resultOperation = Operation.newBuilder() diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java index 8bcaa1c54cf..a40a416b4c9 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/slow/ITBackupTest.java @@ -20,8 +20,11 @@ import static com.google.cloud.spanner.testing.TimestampHelper.afterDays; import static com.google.cloud.spanner.testing.TimestampHelper.afterMinutes; import static com.google.cloud.spanner.testing.TimestampHelper.daysAgo; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeFalse; import com.google.api.client.util.Lists; @@ -32,6 +35,7 @@ import com.google.cloud.Timestamp; import com.google.cloud.spanner.Backup; import com.google.cloud.spanner.BackupId; +import com.google.cloud.spanner.BackupInfo.State; import com.google.cloud.spanner.Database; import com.google.cloud.spanner.DatabaseAdminClient; import com.google.cloud.spanner.DatabaseClient; @@ -48,7 +52,6 @@ import com.google.cloud.spanner.SlowTest; import com.google.cloud.spanner.Spanner; import com.google.cloud.spanner.SpannerException; -import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.SpannerOptions; import com.google.cloud.spanner.Statement; import com.google.cloud.spanner.encryption.EncryptionConfigs; @@ -71,6 +74,7 @@ import io.grpc.Metadata; import io.grpc.MethodDescriptor; import io.grpc.Status; +import io.grpc.Status.Code; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -86,14 +90,17 @@ import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.junit.After; -import org.junit.Before; +import java.util.stream.StreamSupport; +import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.ClassRule; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import org.junit.runners.MethodSorters; /** * Integration tests creating, reading, updating and deleting backups. This test class combines @@ -101,40 +108,36 @@ */ @Category(SlowTest.class) @RunWith(JUnit4.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ITBackupTest { + private static final long BACKUP_TIMEOUT_MINUTES = 30L; private static final long DATABASE_TIMEOUT_MINUTES = 5; - private static final long RESTORE_TIMEOUT_MINUTES = 20; - private static final long BACKUP_TIMEOUT_MINUTES = 30; private static final Logger logger = Logger.getLogger(ITBackupTest.class.getName()); private static final String EXPECTED_OP_NAME_FORMAT = "%s/backups/%s/operations/"; private static final String KMS_KEY_NAME_PROPERTY = "spanner.testenv.kms_key.name"; @ClassRule public static IntegrationTestEnv env = new IntegrationTestEnv(); private static String keyName; - private DatabaseAdminClient dbAdminClient; - private InstanceAdminClient instanceAdminClient; - private Instance instance; - private RemoteSpannerHelper testHelper; - private List databases = new ArrayList<>(); - private List backups = new ArrayList<>(); - private String projectId; - private String instanceId; + private static DatabaseAdminClient dbAdminClient; + private static Instance instance; + private static RemoteSpannerHelper testHelper; + private static final List databases = new ArrayList<>(); + private static final List backups = new ArrayList<>(); + private static String projectId; + private static String instanceId; @BeforeClass - public static void doNotRunOnEmulator() { + public static void setup() { assumeFalse("backups are not supported on the emulator", isUsingEmulator()); keyName = System.getProperty(KMS_KEY_NAME_PROPERTY); Preconditions.checkNotNull( keyName, "Key name is null, please set a key to be used for this test. The necessary permissions should be grant to the spanner service account according to the CMEK user guide."); - } - @Before - public void setUp() { logger.info("Setting up tests"); testHelper = env.getTestHelper(); dbAdminClient = testHelper.getClient().getDatabaseAdminClient(); - instanceAdminClient = testHelper.getClient().getInstanceAdminClient(); + InstanceAdminClient instanceAdminClient = testHelper.getClient().getInstanceAdminClient(); instance = instanceAdminClient.getInstance(testHelper.getInstanceId().getInstance()); projectId = testHelper.getInstanceId().getProject(); instanceId = testHelper.getInstanceId().getInstance(); @@ -163,7 +166,7 @@ public void setUp() { logger.warning( String.format( "Cancelling test backup operation %s that was started at %s", - operation.getName(), startTime.toString())); + operation.getName(), startTime)); dbAdminClient.cancelOperation(operation.getName()); } } @@ -175,22 +178,27 @@ public void setUp() { logger.info("Finished checking existing test backup operations"); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { + logger.info("Starting test teardown"); for (String backup : backups) { + logger.info(String.format("Waiting for optimize operation for backup %s to finish", backup)); waitForDbOperations(backup); + logger.info(String.format("Deleting backup %s", backup)); dbAdminClient.deleteBackup(testHelper.getInstanceId().getInstance(), backup); } backups.clear(); for (String db : databases) { + logger.info(String.format("Dropping database %s", db)); dbAdminClient.dropDatabase(testHelper.getInstanceId().getInstance(), db); } } - private void waitForDbOperations(String backupId) throws InterruptedException { + private static void waitForDbOperations(String backupId) throws InterruptedException { try { Backup backupMetadata = dbAdminClient.getBackup(testHelper.getInstanceId().getInstance(), backupId); + assertNotNull(backupMetadata.getProto()); boolean allDbOpsDone = false; while (!allDbOpsDone) { allDbOpsDone = true; @@ -198,8 +206,12 @@ private void waitForDbOperations(String backupId) throws InterruptedException { String filter = String.format( "name:%s/operations/ AND " + + "(" + + "(metadata.@type:type.googleapis.com/" + + "google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata) OR " + "(metadata.@type:type.googleapis.com/" - + "google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata)", + + "google.spanner.admin.database.v1.RestoreDatabaseMetadata)" + + ")", referencingDb); for (Operation op : dbAdminClient @@ -223,38 +235,27 @@ private void waitForDbOperations(String backupId) throws InterruptedException { } @Test - public void testBackups() throws InterruptedException, ExecutionException, TimeoutException { - // Create two test databases in parallel. - final String db1Id = testHelper.getUniqueDatabaseId() + "_db1"; - final Database sourceDatabase1 = + public void test01_Backups() throws InterruptedException, ExecutionException, TimeoutException { + final String databaseId = testHelper.getUniqueDatabaseId() + "_db1"; + final Database sourceDatabase = dbAdminClient - .newDatabaseBuilder(DatabaseId.of(projectId, instanceId, db1Id)) + .newDatabaseBuilder(DatabaseId.of(projectId, instanceId, databaseId)) .setEncryptionConfig(EncryptionConfigs.customerManagedEncryption(keyName)) .build(); - logger.info(String.format("Creating test database %s", db1Id)); - OperationFuture dbOp1 = + logger.info(String.format("Creating test database %s", databaseId)); + OperationFuture createDatabaseOperation = dbAdminClient.createDatabase( - sourceDatabase1, + sourceDatabase, Collections.singletonList( "CREATE TABLE FOO (ID INT64, NAME STRING(100)) PRIMARY KEY (ID)")); - String db2Id = testHelper.getUniqueDatabaseId() + "_db2"; - logger.info(String.format("Creating test database %s", db2Id)); - OperationFuture dbOp2 = - dbAdminClient.createDatabase( - testHelper.getInstanceId().getInstance(), - testHelper.getUniqueDatabaseId() + "_db2", - Collections.singletonList( - "CREATE TABLE BAR (ID INT64, NAME STRING(100)) PRIMARY KEY (ID)")); - // Make sure all databases are created before we try to create any backups. - Database db1 = dbOp1.get(DATABASE_TIMEOUT_MINUTES, TimeUnit.MINUTES); - Database db2 = dbOp2.get(DATABASE_TIMEOUT_MINUTES, TimeUnit.MINUTES); - databases.add(db1.getId().getDatabase()); - databases.add(db2.getId().getDatabase()); - // Insert some data into db2 to make sure the backup will have a size>0. - DatabaseClient client = testHelper.getDatabaseClient(db2); + // Make sure the database has been created before we try to create a backup. + Database database = createDatabaseOperation.get(DATABASE_TIMEOUT_MINUTES, TimeUnit.MINUTES); + databases.add(database.getId().getDatabase()); + // Insert some data to make sure the backup will have a size>0. + DatabaseClient client = testHelper.getDatabaseClient(database); client.writeAtLeastOnce( Collections.singletonList( - Mutation.newInsertOrUpdateBuilder("BAR") + Mutation.newInsertOrUpdateBuilder("FOO") .set("ID") .to(1L) .set("NAME") @@ -262,82 +263,46 @@ public void testBackups() throws InterruptedException, ExecutionException, Timeo .build())); // Verifies that the database encryption has been properly set - testDatabaseEncryption(db1, keyName); + testDatabaseEncryption(database, keyName); - // Create two backups in parallel. - String backupId1 = testHelper.getUniqueBackupId() + "_bck1"; - String backupId2 = testHelper.getUniqueBackupId() + "_bck2"; + // Create a backup of the database. + String backupId = testHelper.getUniqueBackupId() + "_bck1"; Timestamp expireTime = afterDays(7); Timestamp versionTime = getCurrentTimestamp(client); - logger.info(String.format("Creating backups %s and %s in parallel", backupId1, backupId2)); + logger.info(String.format("Creating backup %s", backupId)); // This backup has the version time specified as the server's current timestamp // This backup is encrypted with a customer managed key - final Backup backupToCreate1 = + // The expiry time is 7 days in the future. + final Backup backupToCreate = dbAdminClient - .newBackupBuilder(BackupId.of(projectId, instanceId, backupId1)) - .setDatabase(db1.getId()) + .newBackupBuilder(BackupId.of(projectId, instanceId, backupId)) + .setDatabase(database.getId()) .setExpireTime(expireTime) .setVersionTime(versionTime) - .setEncryptionConfig(EncryptionConfigs.customerManagedEncryption(keyName)) - .build(); - // This backup has no version time specified - final Backup backupToCreate2 = - dbAdminClient - .newBackupBuilder(BackupId.of(projectId, instanceId, backupId2)) - .setDatabase(db2.getId()) .setExpireTime(expireTime) + .setEncryptionConfig(EncryptionConfigs.customerManagedEncryption(keyName)) .build(); - OperationFuture op1 = dbAdminClient.createBackup(backupToCreate1); - OperationFuture op2 = dbAdminClient.createBackup(backupToCreate2); - backups.add(backupId1); - backups.add(backupId2); + OperationFuture operation = + dbAdminClient.createBackup(backupToCreate); + backups.add(backupId); // Execute metadata tests as part of this integration test to reduce total execution time. - testMetadata(op1, op2, backupId1, backupId2, db1, db2); + testMetadata(operation, backupId, database); - // Ensure both backups have been created before we proceed. - logger.info("Waiting for backup operations to finish"); - Backup backup1; - Backup backup2; - Stopwatch watch = Stopwatch.createStarted(); - try { - backup1 = op1.get(6L, TimeUnit.MINUTES); - backup2 = op2.get(Math.max(1L, 6L - watch.elapsed(TimeUnit.MINUTES)), TimeUnit.MINUTES); - } catch (TimeoutException e) { - logger.warning( - "Waiting for backup operations to finish timed out. Getting long-running operations."); - while (watch.elapsed(TimeUnit.MINUTES) < 12L - && (!dbAdminClient.getOperation(op1.getName()).getDone() - || !dbAdminClient.getOperation(op2.getName()).getDone())) { - Thread.sleep(10_000L); - } - if (!dbAdminClient.getOperation(op1.getName()).getDone()) { - logger.warning(String.format("Operation %s still not finished", op1.getName())); - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.DEADLINE_EXCEEDED, - "Backup1 still not finished. Test is giving up waiting for it."); - } - if (!dbAdminClient.getOperation(op2.getName()).getDone()) { - logger.warning(String.format("Operation %s still not finished", op2.getName())); - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.DEADLINE_EXCEEDED, - "Backup2 still not finished. Test is giving up waiting for it."); - } - logger.info("Long-running operations finished. Getting backups by id."); - backup1 = dbAdminClient.getBackup(instance.getId().getInstance(), backupId1); - backup2 = dbAdminClient.getBackup(instance.getId().getInstance(), backupId2); - } + // Ensure that the backup has been created before we proceed. + logger.info("Waiting for backup operation to finish"); + Backup backup = operation.get(BACKUP_TIMEOUT_MINUTES, TimeUnit.MINUTES); // Verifies that backup version time is the specified one - testBackupVersionTime(backup1, versionTime); + testBackupVersionTime(backup, versionTime); // Verifies that backup encryption has been properly set - testBackupEncryption(backup1, keyName); + testBackupEncryption(backup, keyName); - // Insert some more data into db2 to get a timestamp from the server. + // Insert some more data into the database to get a timestamp from the server. Timestamp commitTs = client.writeAtLeastOnce( Collections.singletonList( - Mutation.newInsertOrUpdateBuilder("BAR") + Mutation.newInsertOrUpdateBuilder("FOO") .set("ID") .to(2L) .set("NAME") @@ -347,60 +312,63 @@ public void testBackups() throws InterruptedException, ExecutionException, Timeo // Test listing operations. // List all backups. logger.info("Listing all backups"); - assertThat(instance.listBackups().iterateAll()).containsAtLeast(backup1, backup2); + assertTrue(Iterables.contains(instance.listBackups().iterateAll(), backup)); // List all backups whose names contain 'bck1'. logger.info("Listing backups with name bck1"); - assertThat( + assertTrue( + Iterables.elementsEqual( dbAdminClient .listBackups( - instanceId, Options.filter(String.format("name:%s", backup1.getId().getName()))) - .iterateAll()) - .containsExactly(backup1); + instanceId, Options.filter(String.format("name:%s", backup.getId().getName()))) + .iterateAll(), + Collections.singleton(backup))); logger.info("Listing ready backups"); Iterable readyBackups = dbAdminClient.listBackups(instanceId, Options.filter("state:READY")).iterateAll(); - assertThat(readyBackups).containsAtLeast(backup1, backup2); + assertTrue(Iterables.contains(readyBackups, backup)); // List all backups for databases whose names contain 'db1'. logger.info("Listing backups for database db1"); - assertThat( + assertTrue( + Iterables.elementsEqual( dbAdminClient .listBackups( - instanceId, Options.filter(String.format("database:%s", db1.getId().getName()))) - .iterateAll()) - .containsExactly(backup1); + instanceId, + Options.filter(String.format("database:%s", database.getId().getName()))) + .iterateAll(), + Collections.singleton(backup))); // List all backups that were created before a certain time. Timestamp ts = Timestamp.ofTimeSecondsAndNanos(commitTs.getSeconds(), 0); logger.info(String.format("Listing backups created before %s", ts)); - assertThat( + assertTrue( + Iterables.contains( dbAdminClient .listBackups(instanceId, Options.filter(String.format("create_time<\"%s\"", ts))) - .iterateAll()) - .containsAtLeast(backup1, backup2); + .iterateAll(), + backup)); // List all backups with a size > 0. logger.info("Listing backups with size>0"); - assertThat(dbAdminClient.listBackups(instanceId, Options.filter("size_bytes>0")).iterateAll()) - .contains(backup2); - assertThat(dbAdminClient.listBackups(instanceId, Options.filter("size_bytes>0")).iterateAll()) - .doesNotContain(backup1); + assertTrue( + Iterables.contains( + dbAdminClient.listBackups(instanceId, Options.filter("size_bytes>0")).iterateAll(), + backup)); // Test pagination. - testPagination(2); + testPagination(); logger.info("Finished listBackup tests"); // Execute other tests as part of this integration test to reduce total execution time. - testGetBackup(db2, backupId2, expireTime); - testUpdateBackup(backup1); - testCreateInvalidExpirationDate(db1); - testRestore(backup1, versionTime, keyName); + testGetBackup(database, backupId, expireTime); + testUpdateBackup(backup); + testCreateInvalidExpirationDate(database); + testRestore(backup, versionTime, keyName); - testDelete(backupId2); - testCancelBackupOperation(db1); + testCancelBackupOperation(database); // Finished all tests. logger.info("Finished all backup tests"); } @Test - public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Exception { + public void test02_RetryNonIdempotentRpcsReturningLongRunningOperations() throws Exception { assumeFalse( "Querying long-running operations is not supported on the emulator", isUsingEmulator()); @@ -412,7 +380,6 @@ public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Ex // operation. List databases = new ArrayList<>(); - List backups = new ArrayList<>(); String initialDatabaseId; Timestamp initialDbCreateTime; @@ -435,8 +402,8 @@ public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Ex initialDbCreateTime = op.get(DATABASE_TIMEOUT_MINUTES, TimeUnit.MINUTES).getCreateTime(); // Assert that the CreateDatabase RPC was called only once, and that the operation tracking // was resumed through a GetOperation call. - assertThat(createDbInterceptor.methodCount.get()).isEqualTo(1); - assertThat(createDbInterceptor.getOperationCount.get()).isAtLeast(1); + assertEquals(1, createDbInterceptor.methodCount.get()); + assertTrue(createDbInterceptor.getOperationCount.get() >= 1); } // CreateBackup @@ -444,9 +411,9 @@ public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Ex new InjectErrorInterceptorProvider("CreateBackup"); options = testHelper.getOptions().toBuilder().setInterceptorProvider(createBackupInterceptor).build(); + String backupId = String.format("test-bck-%08d", new Random().nextInt(100000000)); try (Spanner spanner = options.getService()) { String databaseId = databases.get(0).getId().getDatabase(); - String backupId = String.format("test-bck-%08d", new Random().nextInt(100000000)); DatabaseAdminClient client = spanner.getDatabaseAdminClient(); OperationFuture op = client.createBackup( @@ -455,18 +422,24 @@ public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Ex databaseId, Timestamp.ofTimeSecondsAndNanos( Timestamp.now().getSeconds() + TimeUnit.SECONDS.convert(7L, TimeUnit.DAYS), 0)); - backups.add(op.get(BACKUP_TIMEOUT_MINUTES, TimeUnit.MINUTES)); + Stopwatch watch = Stopwatch.createStarted(); + while (createBackupInterceptor.methodCount.get() < 1 + && createBackupInterceptor.getOperationCount.get() < 1 + && watch.elapsed(TimeUnit.SECONDS) < 120) { + //noinspection BusyWait + Thread.sleep(5000L); + } + client.cancelOperation(op.getName()); // Assert that the CreateBackup RPC was called only once, and that the operation tracking // was resumed through a GetOperation call. - assertThat(createDbInterceptor.methodCount.get()).isEqualTo(1); - assertThat(createDbInterceptor.getOperationCount.get()).isAtLeast(1); + assertEquals(1, createBackupInterceptor.methodCount.get()); + assertTrue(createBackupInterceptor.getOperationCount.get() >= 1); } // RestoreBackup - int attempts = 0; - while (true) { + if (!backups.isEmpty()) { InjectErrorInterceptorProvider restoreBackupInterceptor = - new InjectErrorInterceptorProvider("RestoreBackup"); + new InjectErrorInterceptorProvider("RestoreDatabase"); options = testHelper .getOptions() @@ -474,37 +447,34 @@ public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Ex .setInterceptorProvider(restoreBackupInterceptor) .build(); try (Spanner spanner = options.getService()) { - String backupId = backups.get(0).getId().getBackup(); String restoredDbId = testHelper.getUniqueDatabaseId(); DatabaseAdminClient client = spanner.getDatabaseAdminClient(); OperationFuture op = client.restoreDatabase( testHelper.getInstanceId().getInstance(), - backupId, + backups.get(0), testHelper.getInstanceId().getInstance(), restoredDbId); - databases.add(op.get(RESTORE_TIMEOUT_MINUTES, TimeUnit.MINUTES)); - // Assert that the RestoreDatabase RPC was called only once, and that the operation - // tracking was resumed through a GetOperation call. - assertThat(createDbInterceptor.methodCount.get()).isEqualTo(1); - assertThat(createDbInterceptor.getOperationCount.get()).isAtLeast(1); - break; - } catch (ExecutionException e) { - if (e.getCause() instanceof SpannerException - && ((SpannerException) e.getCause()).getErrorCode() == ErrorCode.FAILED_PRECONDITION - && e.getCause() - .getMessage() - .contains("Please retry the operation once the pending restores complete")) { - attempts++; - if (attempts == 10) { - // Still same error after 10 attempts. Ignore. - break; + Stopwatch watch = Stopwatch.createStarted(); + while (restoreBackupInterceptor.methodCount.get() < 1 + && restoreBackupInterceptor.getOperationCount.get() < 1 + && watch.elapsed(TimeUnit.SECONDS) < 120) { + //noinspection BusyWait + Thread.sleep(5000L); + } + try { + client.cancelOperation(op.getName()); + } catch (SpannerException e) { + // Ignore UNIMPLEMENTED errors, as it seems that Cloud Spanner cannot cancel a restore + // operation that has already started. + if (e.getErrorCode() != ErrorCode.UNIMPLEMENTED) { + throw e; } - // wait and then retry. - Thread.sleep(60_000L); - } else { - throw e; } + // Assert that the RestoreDatabase RPC was called only once, and that the operation + // tracking was resumed through a GetOperation call. + assertEquals(1, restoreBackupInterceptor.methodCount.get()); + assertTrue(restoreBackupInterceptor.getOperationCount.get() >= 1); } } @@ -526,16 +496,38 @@ public void testRetryNonIdempotentRpcsReturningLongRunningOperations() throws Ex op.get(DATABASE_TIMEOUT_MINUTES, TimeUnit.MINUTES).getCreateTime(); // TODO: Change this to greaterThan when the create time of a database is reported back by // the server. - assertThat(secondCreationTime).isAtLeast(initialDbCreateTime); + assertTrue(secondCreationTime.compareTo(initialDbCreateTime) >= 0); // Assert that the CreateDatabase RPC was called only once, and that the operation tracking // was resumed through a GetOperation call. - assertThat(createDbInterceptor.methodCount.get()).isEqualTo(1); - assertThat(createDbInterceptor.getOperationCount.get()).isAtLeast(1); + assertEquals(1, createDbInterceptor.methodCount.get()); + assertTrue(createDbInterceptor.getOperationCount.get() >= 1); } } + @Test + public void test03_Delete() throws InterruptedException { + Assert.assertFalse("No backups created", backups.isEmpty()); + String backupId = backups.get(0); + waitForDbOperations(backupId); + // Get the backup. + logger.info(String.format("Fetching backup %s", backupId)); + Backup backup = instance.getBackup(backupId); + // Delete it. + logger.info(String.format("Deleting backup %s", backupId)); + backup.delete(); + // Try to get it again. This should cause a NOT_FOUND error. + logger.info(String.format("Fetching non-existent backup %s", backupId)); + SpannerException exception = + assertThrows(SpannerException.class, () -> instance.getBackup(backupId)); + assertEquals(ErrorCode.NOT_FOUND, exception.getErrorCode()); + // Try to delete the non-existent backup. This should be a no-op. + logger.info(String.format("Deleting non-existent backup %s", backupId)); + backup.delete(); + logger.info("Finished delete tests"); + } + @Test(expected = SpannerException.class) - public void backupCreationWithVersionTimeTooFarInThePastFails() throws Exception { + public void test04_backupCreationWithVersionTimeTooFarInThePastFails() throws Exception { final Database testDatabase = testHelper.createTestDatabase(); final DatabaseId databaseId = testDatabase.getId(); final InstanceId instanceId = databaseId.getInstanceId(); @@ -554,7 +546,7 @@ public void backupCreationWithVersionTimeTooFarInThePastFails() throws Exception } @Test(expected = SpannerException.class) - public void backupCreationWithVersionTimeInTheFutureFails() throws Exception { + public void test05_backupCreationWithVersionTimeInTheFutureFails() throws Exception { final Database testDatabase = testHelper.createTestDatabase(); final DatabaseId databaseId = testDatabase.getId(); final InstanceId instanceId = databaseId.getInstanceId(); @@ -572,10 +564,10 @@ public void backupCreationWithVersionTimeInTheFutureFails() throws Exception { getOrThrow(dbAdminClient.createBackup(backupToCreate)); } - private T getOrThrow(OperationFuture operation) + private void getOrThrow(OperationFuture operation) throws InterruptedException, ExecutionException { try { - return operation.get(); + operation.get(); } catch (ExecutionException e) { if (e.getCause() instanceof SpannerException) { throw (SpannerException) e.getCause(); @@ -595,78 +587,62 @@ private Timestamp getCurrentTimestamp(DatabaseClient client) { private void testBackupVersionTime(Backup backup, Timestamp versionTime) { logger.info("Verifying backup version time for " + backup.getId()); - assertThat(backup.getVersionTime()).isEqualTo(versionTime); + assertEquals(versionTime, backup.getVersionTime()); logger.info("Done verifying backup version time for " + backup.getId()); } private void testDatabaseEncryption(Database database, String expectedKey) { logger.info("Verifying database encryption for " + database.getId()); - assertThat(database.getEncryptionConfig()).isNotNull(); - assertThat(database.getEncryptionConfig().getKmsKeyName()).isEqualTo(expectedKey); + assertNotNull(database.getEncryptionConfig()); + assertEquals(expectedKey, database.getEncryptionConfig().getKmsKeyName()); logger.info("Done verifying database encryption for " + database.getId()); } private void testBackupEncryption(Backup backup, String expectedKey) { logger.info("Verifying backup encryption for " + backup.getId()); - assertThat(backup.getEncryptionInfo()).isNotNull(); - assertThat(backup.getEncryptionInfo().getKmsKeyVersion()).contains(expectedKey); + assertNotNull(backup.getEncryptionInfo()); + assertTrue(backup.getEncryptionInfo().getKmsKeyVersion().contains(expectedKey)); logger.info("Done verifying backup encryption for " + backup.getId()); } private void testMetadata( - OperationFuture op1, - OperationFuture op2, - String backupId1, - String backupId2, - Database db1, - Database db2) + OperationFuture operation, String backupId, Database database) throws InterruptedException, ExecutionException { - logger.info("Getting operation metadata 1"); - CreateBackupMetadata metadata1 = op1.getMetadata().get(); - logger.info("Getting operation metadata 2"); - CreateBackupMetadata metadata2 = op2.getMetadata().get(); + logger.info("Getting operation metadata"); + CreateBackupMetadata metadata1 = operation.getMetadata().get(); String expectedOperationName1 = - String.format(EXPECTED_OP_NAME_FORMAT, testHelper.getInstanceId().getName(), backupId1); - String expectedOperationName2 = - String.format(EXPECTED_OP_NAME_FORMAT, testHelper.getInstanceId().getName(), backupId2); - assertThat(op1.getName()).startsWith(expectedOperationName1); - assertThat(op2.getName()).startsWith(expectedOperationName2); - assertThat(metadata1.getDatabase()).isEqualTo(db1.getId().getName()); - assertThat(metadata2.getDatabase()).isEqualTo(db2.getId().getName()); - assertThat(metadata1.getName()) - .isEqualTo(BackupId.of(testHelper.getInstanceId(), backupId1).getName()); - assertThat(metadata2.getName()) - .isEqualTo(BackupId.of(testHelper.getInstanceId(), backupId2).getName()); + String.format(EXPECTED_OP_NAME_FORMAT, testHelper.getInstanceId().getName(), backupId); + assertTrue(operation.getName().startsWith(expectedOperationName1)); + assertEquals(database.getId().getName(), metadata1.getDatabase()); + assertEquals(BackupId.of(testHelper.getInstanceId(), backupId).getName(), metadata1.getName()); logger.info("Finished metadata tests"); } - private void testCreateInvalidExpirationDate(Database db) throws InterruptedException { + private void testCreateInvalidExpirationDate(Database database) { // This is not allowed, the expiration date must be at least 6 hours in the future. Timestamp expireTime = daysAgo(1); String backupId = testHelper.getUniqueBackupId(); logger.info(String.format("Creating backup %s with invalid expiration date", backupId)); OperationFuture op = - dbAdminClient.createBackup(instanceId, backupId, db.getId().getDatabase(), expireTime); + dbAdminClient.createBackup( + instanceId, backupId, database.getId().getDatabase(), expireTime); backups.add(backupId); - try { - op.get(); - fail("missing expected exception"); - } catch (ExecutionException e) { - Throwable cause = e.getCause(); - assertThat(cause).isInstanceOf(SpannerException.class); - SpannerException se = (SpannerException) cause; - assertThat(se.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); - } + ExecutionException executionException = assertThrows(ExecutionException.class, op::get); + Throwable cause = executionException.getCause(); + assertEquals(SpannerException.class, cause.getClass()); + SpannerException spannerException = (SpannerException) cause; + assertEquals(ErrorCode.INVALID_ARGUMENT, spannerException.getErrorCode()); } - private void testCancelBackupOperation(Database db) + private void testCancelBackupOperation(Database database) throws InterruptedException, ExecutionException { Timestamp expireTime = afterDays(7); String backupId = testHelper.getUniqueBackupId(); logger.info(String.format("Starting to create backup %s", backupId)); OperationFuture op = - dbAdminClient.createBackup(instanceId, backupId, db.getId().getDatabase(), expireTime); + dbAdminClient.createBackup( + instanceId, backupId, database.getId().getDatabase(), expireTime); backups.add(backupId); // Cancel the backup operation. logger.info(String.format("Cancelling the creation of backup %s", backupId)); @@ -678,21 +654,21 @@ private void testCancelBackupOperation(Database db) .listBackupOperations( instanceId, Options.filter(String.format("name:%s", op.getName()))) .iterateAll()) { - assertThat(operation.getError().getCode()).isEqualTo(Status.Code.CANCELLED.value()); + assertEquals(Code.CANCELLED.value(), operation.getError().getCode()); operationFound = true; } - assertThat(operationFound).isTrue(); + assertTrue(operationFound); logger.info("Finished cancel test"); } - private void testGetBackup(Database db, String backupId, Timestamp expireTime) { + private void testGetBackup(Database database, String backupId, Timestamp expireTime) { // Get the most recent version of the backup. logger.info(String.format("Getting backup %s", backupId)); Backup backup = instance.getBackup(backupId); - assertThat(backup.getState()).isEqualTo(Backup.State.READY); - assertThat(backup.getSize()).isGreaterThan(0L); - assertThat(backup.getExpireTime()).isEqualTo(expireTime); - assertThat(backup.getDatabase()).isEqualTo(db.getId()); + assertEquals(State.READY, backup.getState()); + assertTrue(backup.getSize() > 0L); + assertEquals(expireTime, backup.getExpireTime()); + assertEquals(database.getId(), backup.getDatabase()); } private void testUpdateBackup(Backup backup) { @@ -705,26 +681,24 @@ private void testUpdateBackup(Backup backup) { // Re-get the backup and ensure the expire time was updated. logger.info(String.format("Reloading backup %s", backup.getId().getBackup())); backup = backup.reload(); - assertThat(backup.getExpireTime()).isEqualTo(tomorrow); + assertEquals(tomorrow, backup.getExpireTime()); // Try to set the expire time to 5 minutes in the future. Timestamp in5Minutes = afterMinutes(5); - backup = backup.toBuilder().setExpireTime(in5Minutes).build(); - try { - logger.info( - String.format( - "Updating expire time of backup %s to 5 minutes", backup.getId().getBackup())); - backup.updateExpireTime(); - fail("Missing expected exception"); - } catch (SpannerException e) { - assertThat(e.getErrorCode()).isEqualTo(ErrorCode.INVALID_ARGUMENT); - } + final Backup backupWithNewExpireTime = backup.toBuilder().setExpireTime(in5Minutes).build(); + logger.info( + String.format( + "Updating expire time of backup %s to 5 minutes", backup.getId().getBackup())); + SpannerException spannerException = + assertThrows(SpannerException.class, backupWithNewExpireTime::updateExpireTime); + assertEquals(ErrorCode.INVALID_ARGUMENT, spannerException.getErrorCode()); + // Re-get the backup and ensure the expire time is still in one week. backup = backup.reload(); - assertThat(backup.getExpireTime()).isEqualTo(tomorrow); + assertEquals(tomorrow, backup.getExpireTime()); } - private void testPagination(int expectedMinimumTotalBackups) { + private void testPagination() { logger.info("Listing backups using pagination"); // First get all current backups without using pagination so we can compare that list with @@ -735,9 +709,9 @@ private void testPagination(int expectedMinimumTotalBackups) { int numBackups = 0; logger.info("Fetching first page"); Page page = dbAdminClient.listBackups(instanceId, Options.pageSize(1)); - assertThat(page.getValues()).hasSize(1); + assertEquals(1, Iterables.size(page.getValues())); numBackups++; - assertThat(page.hasNextPage()).isTrue(); + assertTrue(page.hasNextPage()); Set seenPageTokens = new HashSet<>(); seenPageTokens.add(""); while (page.hasNextPage()) { @@ -760,37 +734,15 @@ private void testPagination(int expectedMinimumTotalBackups) { logger.info(backup.getId().toString()); } } - assertThat(seenPageTokens).doesNotContain(page.getNextPageToken()); + assertFalse(Iterables.contains(seenPageTokens, page.getNextPageToken())); seenPageTokens.add(page.getNextPageToken()); page = dbAdminClient.listBackups( instanceId, Options.pageToken(page.getNextPageToken()), Options.pageSize(1)); - assertThat(page.getValues()).hasSize(1); + assertEquals(1, Iterables.size(page.getValues())); numBackups++; } - assertThat(numBackups).isAtLeast(expectedMinimumTotalBackups); - } - - private void testDelete(String backupId) throws InterruptedException { - waitForDbOperations(backupId); - // Get the backup. - logger.info(String.format("Fetching backup %s", backupId)); - Backup backup = instance.getBackup(backupId); - // Delete it. - logger.info(String.format("Deleting backup %s", backupId)); - backup.delete(); - // Try to get it again. This should cause a NOT_FOUND error. - try { - logger.info(String.format("Fetching non-existent backup %s", backupId)); - instance.getBackup(backupId); - fail("Missing expected exception"); - } catch (SpannerException e) { - assertThat(e.getErrorCode()).isEqualTo(ErrorCode.NOT_FOUND); - } - // Try to delete the non-existent backup. This should be a no-op. - logger.info(String.format("Deleting non-existent backup %s", backupId)); - backup.delete(); - logger.info("Finished delete tests"); + assertTrue(numBackups >= 1); } private void testRestore(Backup backup, Timestamp versionTime, String expectedKey) @@ -829,6 +781,7 @@ private void testRestore(Backup backup, Timestamp versionTime, String expectedKe String.format( "Restoring backup %s to database %s must wait because of other pending restore operation", backup.getId().getBackup(), restoredDb)); + //noinspection BusyWait Thread.sleep(60_000L); } else { throw e; @@ -838,12 +791,11 @@ private void testRestore(Backup backup, Timestamp versionTime, String expectedKe databases.add(restoredDb); logger.info(String.format("Restore operation %s running", restoreOperationName)); RestoreDatabaseMetadata metadata = restoreOperation.getMetadata().get(); - assertThat(metadata.getBackupInfo().getBackup()).isEqualTo(backup.getId().getName()); - assertThat(metadata.getSourceType()).isEqualTo(RestoreSourceType.BACKUP); - assertThat(metadata.getName()) - .isEqualTo(DatabaseId.of(testHelper.getInstanceId(), restoredDb).getName()); - assertThat(Timestamp.fromProto(metadata.getBackupInfo().getVersionTime())) - .isEqualTo(versionTime); + assertEquals(backup.getId().getName(), metadata.getBackupInfo().getBackup()); + assertEquals(RestoreSourceType.BACKUP, metadata.getSourceType()); + assertEquals( + DatabaseId.of(testHelper.getInstanceId(), restoredDb).getName(), metadata.getName()); + assertEquals(versionTime, Timestamp.fromProto(metadata.getBackupInfo().getVersionTime())); // Ensure the operations show up in the right collections. // TODO: Re-enable when it is clear why this fails on the CI environment. @@ -851,55 +803,46 @@ private void testRestore(Backup backup, Timestamp versionTime, String expectedKe // Wait until the restore operation has finished successfully. Database database = restoreOperation.get(); - assertThat(database.getId().getDatabase()).isEqualTo(restoredDb); + assertEquals(restoredDb, database.getId().getDatabase()); // Reloads the database final Database reloadedDatabase = database.reload(); - assertThat( - Timestamp.fromProto( - reloadedDatabase.getProto().getRestoreInfo().getBackupInfo().getVersionTime())) - .isEqualTo(versionTime); + assertNotNull(reloadedDatabase.getProto()); + assertEquals( + versionTime, + Timestamp.fromProto( + reloadedDatabase.getProto().getRestoreInfo().getBackupInfo().getVersionTime())); testDatabaseEncryption(reloadedDatabase, expectedKey); // Restoring the backup to an existing database should fail. - try { - logger.info( - String.format( - "Restoring backup %s to existing database %s", - backup.getId().getBackup(), restoredDb)); - backup.restore(DatabaseId.of(testHelper.getInstanceId(), restoredDb)).get(); - fail("Missing expected exception"); - } catch (ExecutionException ee) { - assertThat(ee.getCause()).isInstanceOf(SpannerException.class); - SpannerException e = (SpannerException) ee.getCause(); - assertThat(e.getErrorCode()).isEqualTo(ErrorCode.ALREADY_EXISTS); - } + logger.info( + String.format( + "Restoring backup %s to existing database %s", backup.getId().getBackup(), restoredDb)); + ExecutionException executionException = + assertThrows( + ExecutionException.class, + () -> backup.restore(DatabaseId.of(testHelper.getInstanceId(), restoredDb)).get()); + assertEquals(SpannerException.class, executionException.getCause().getClass()); + SpannerException spannerException = (SpannerException) executionException.getCause(); + assertEquals(ErrorCode.ALREADY_EXISTS, spannerException.getErrorCode()); } // TODO: Remove when this verification can be re-enabled. @SuppressWarnings("unused") private void verifyRestoreOperations( final String backupOperationName, final String restoreOperationName) { - assertThat( - Iterables.any( - instance.listBackupOperations().iterateAll(), - input -> input.getName().equals(backupOperationName))) - .isTrue(); - assertThat( - Iterables.any( - instance.listBackupOperations().iterateAll(), - input -> input.getName().equals(restoreOperationName))) - .isFalse(); - assertThat( - Iterables.any( - instance.listDatabaseOperations().iterateAll(), - input -> input.getName().equals(backupOperationName))) - .isFalse(); - assertThat( - Iterables.any( - instance.listDatabaseOperations().iterateAll(), - input -> input.getName().equals(restoreOperationName))) - .isTrue(); + assertTrue( + StreamSupport.stream(instance.listBackupOperations().iterateAll().spliterator(), false) + .anyMatch(input -> input.getName().equals(backupOperationName))); + assertFalse( + StreamSupport.stream(instance.listBackupOperations().iterateAll().spliterator(), false) + .anyMatch(input -> input.getName().equals(restoreOperationName))); + assertFalse( + StreamSupport.stream(instance.listDatabaseOperations().iterateAll().spliterator(), false) + .anyMatch(input -> input.getName().equals(backupOperationName))); + assertTrue( + StreamSupport.stream(instance.listDatabaseOperations().iterateAll().spliterator(), false) + .anyMatch(input -> input.getName().equals(restoreOperationName))); } private static final class InjectErrorInterceptorProvider implements GrpcInterceptorProvider { diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 77d906b01df..df6507267ae 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.17.4 + 6.18.0 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.17.4 + 6.18.0 diff --git a/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java b/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java index 09cee7bcf81..55afe37254c 100644 --- a/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java +++ b/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java @@ -22,10 +22,11 @@ * *

  * Cloud Spanner Database Admin API
- * The Cloud Spanner Database Admin API can be used to create, drop, and
- * list databases. It also enables updating the schema of pre-existing
- * databases. It can be also used to create, delete and list backups for a
- * database and to restore from an existing backup.
+ * The Cloud Spanner Database Admin API can be used to:
+ *   * create, drop, and list databases
+ *   * update the schema of pre-existing databases
+ *   * create, delete and list backups for a database
+ *   * restore a database from an existing backup
  * 
*/ @javax.annotation.Generated( @@ -851,10 +852,11 @@ public DatabaseAdminFutureStub newStub( * *
    * Cloud Spanner Database Admin API
-   * The Cloud Spanner Database Admin API can be used to create, drop, and
-   * list databases. It also enables updating the schema of pre-existing
-   * databases. It can be also used to create, delete and list backups for a
-   * database and to restore from an existing backup.
+   * The Cloud Spanner Database Admin API can be used to:
+   *   * create, drop, and list databases
+   *   * update the schema of pre-existing databases
+   *   * create, delete and list backups for a database
+   *   * restore a database from an existing backup
    * 
*/ public abstract static class DatabaseAdminImplBase implements io.grpc.BindableService { @@ -937,6 +939,8 @@ public void updateDatabaseDdl( * Drops (aka deletes) a Cloud Spanner database. * Completed backups for the database will be retained according to their * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. * */ public void dropDatabase( @@ -1306,10 +1310,11 @@ public final io.grpc.ServerServiceDefinition bindService() { * *
    * Cloud Spanner Database Admin API
-   * The Cloud Spanner Database Admin API can be used to create, drop, and
-   * list databases. It also enables updating the schema of pre-existing
-   * databases. It can be also used to create, delete and list backups for a
-   * database and to restore from an existing backup.
+   * The Cloud Spanner Database Admin API can be used to:
+   *   * create, drop, and list databases
+   *   * update the schema of pre-existing databases
+   *   * create, delete and list backups for a database
+   *   * restore a database from an existing backup
    * 
*/ public static final class DatabaseAdminStub @@ -1409,6 +1414,8 @@ public void updateDatabaseDdl( * Drops (aka deletes) a Cloud Spanner database. * Completed backups for the database will be retained according to their * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. * */ public void dropDatabase( @@ -1689,10 +1696,11 @@ public void listBackupOperations( * *
    * Cloud Spanner Database Admin API
-   * The Cloud Spanner Database Admin API can be used to create, drop, and
-   * list databases. It also enables updating the schema of pre-existing
-   * databases. It can be also used to create, delete and list backups for a
-   * database and to restore from an existing backup.
+   * The Cloud Spanner Database Admin API can be used to:
+   *   * create, drop, and list databases
+   *   * update the schema of pre-existing databases
+   *   * create, delete and list backups for a database
+   *   * restore a database from an existing backup
    * 
*/ public static final class DatabaseAdminBlockingStub @@ -1779,6 +1787,8 @@ public com.google.longrunning.Operation updateDatabaseDdl( * Drops (aka deletes) a Cloud Spanner database. * Completed backups for the database will be retained according to their * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. * */ public com.google.protobuf.Empty dropDatabase( @@ -2014,10 +2024,11 @@ public com.google.spanner.admin.database.v1.ListBackupOperationsResponse listBac * *
    * Cloud Spanner Database Admin API
-   * The Cloud Spanner Database Admin API can be used to create, drop, and
-   * list databases. It also enables updating the schema of pre-existing
-   * databases. It can be also used to create, delete and list backups for a
-   * database and to restore from an existing backup.
+   * The Cloud Spanner Database Admin API can be used to:
+   *   * create, drop, and list databases
+   *   * update the schema of pre-existing databases
+   *   * create, delete and list backups for a database
+   *   * restore a database from an existing backup
    * 
*/ public static final class DatabaseAdminFutureStub @@ -2106,6 +2117,8 @@ protected DatabaseAdminFutureStub build( * Drops (aka deletes) a Cloud Spanner database. * Completed backups for the database will be retained according to their * `expire_time`. + * Note: Cloud Spanner might continue to accept requests for a few seconds + * after the database has been deleted. * */ public com.google.common.util.concurrent.ListenableFuture diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index ff20181e6df..265693ff83d 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.17.4 + 6.18.0 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.17.4 + 6.18.0 diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index 5b30e829182..c82e975c726 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.17.4 + 6.18.0 grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.17.4 + 6.18.0 diff --git a/pom.xml b/pom.xml index 7b916654382..5194c127a0c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.17.4 + 6.18.0 Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -14,7 +14,7 @@ com.google.cloud google-cloud-shared-config - 1.2.4 + 1.2.6 @@ -54,7 +54,7 @@ UTF-8 github google-cloud-spanner-parent - 2.6.0 + 2.7.0 @@ -62,37 +62,37 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.17.4 + 6.18.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.17.4 + 6.18.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.17.4 + 6.18.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.17.4 + 6.18.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.17.4 + 6.18.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.17.4 + 6.18.0 com.google.cloud google-cloud-spanner - 6.17.4 + 6.18.0 @@ -141,7 +141,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.9.0 1.8 1.8 diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index d52bfb92d2a..5527b946790 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.17.4 + 6.18.0 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.17.4 + 6.18.0 diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Backup.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Backup.java index 55738fe00ce..3a974718685 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Backup.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Backup.java @@ -42,6 +42,7 @@ private Backup() { name_ = ""; state_ = 0; referencingDatabases_ = com.google.protobuf.LazyStringArrayList.EMPTY; + databaseDialect_ = 0; } @java.lang.Override @@ -170,6 +171,13 @@ private Backup( versionTime_ = subBuilder.buildPartial(); } + break; + } + case 80: + { + int rawValue = input.readEnum(); + + databaseDialect_ = rawValue; break; } default: @@ -870,6 +878,48 @@ public com.google.spanner.admin.database.v1.EncryptionInfoOrBuilder getEncryptio return getEncryptionInfo(); } + public static final int DATABASE_DIALECT_FIELD_NUMBER = 10; + private int databaseDialect_; + /** + * + * + *
+   * Output only. The database dialect information for the backup.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + @java.lang.Override + public int getDatabaseDialectValue() { + return databaseDialect_; + } + /** + * + * + *
+   * Output only. The database dialect information for the backup.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The databaseDialect. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect() { + @SuppressWarnings("deprecation") + com.google.spanner.admin.database.v1.DatabaseDialect result = + com.google.spanner.admin.database.v1.DatabaseDialect.valueOf(databaseDialect_); + return result == null + ? com.google.spanner.admin.database.v1.DatabaseDialect.UNRECOGNIZED + : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -912,6 +962,11 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (versionTime_ != null) { output.writeMessage(9, getVersionTime()); } + if (databaseDialect_ + != com.google.spanner.admin.database.v1.DatabaseDialect.DATABASE_DIALECT_UNSPECIFIED + .getNumber()) { + output.writeEnum(10, databaseDialect_); + } unknownFields.writeTo(output); } @@ -953,6 +1008,11 @@ public int getSerializedSize() { if (versionTime_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getVersionTime()); } + if (databaseDialect_ + != com.google.spanner.admin.database.v1.DatabaseDialect.DATABASE_DIALECT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(10, databaseDialect_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -990,6 +1050,7 @@ public boolean equals(final java.lang.Object obj) { if (hasEncryptionInfo()) { if (!getEncryptionInfo().equals(other.getEncryptionInfo())) return false; } + if (databaseDialect_ != other.databaseDialect_) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1029,6 +1090,8 @@ public int hashCode() { hash = (37 * hash) + ENCRYPTION_INFO_FIELD_NUMBER; hash = (53 * hash) + getEncryptionInfo().hashCode(); } + hash = (37 * hash) + DATABASE_DIALECT_FIELD_NUMBER; + hash = (53 * hash) + databaseDialect_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1208,6 +1271,8 @@ public Builder clear() { encryptionInfo_ = null; encryptionInfoBuilder_ = null; } + databaseDialect_ = 0; + return this; } @@ -1265,6 +1330,7 @@ public com.google.spanner.admin.database.v1.Backup buildPartial() { } else { result.encryptionInfo_ = encryptionInfoBuilder_.build(); } + result.databaseDialect_ = databaseDialect_; onBuilt(); return result; } @@ -1350,6 +1416,9 @@ public Builder mergeFrom(com.google.spanner.admin.database.v1.Backup other) { if (other.hasEncryptionInfo()) { mergeEncryptionInfo(other.getEncryptionInfo()); } + if (other.databaseDialect_ != 0) { + setDatabaseDialectValue(other.getDatabaseDialectValue()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -2922,6 +2991,109 @@ public com.google.spanner.admin.database.v1.EncryptionInfo.Builder getEncryption return encryptionInfoBuilder_; } + private int databaseDialect_ = 0; + /** + * + * + *
+     * Output only. The database dialect information for the backup.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + @java.lang.Override + public int getDatabaseDialectValue() { + return databaseDialect_; + } + /** + * + * + *
+     * Output only. The database dialect information for the backup.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for databaseDialect to set. + * @return This builder for chaining. + */ + public Builder setDatabaseDialectValue(int value) { + + databaseDialect_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The database dialect information for the backup.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The databaseDialect. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect() { + @SuppressWarnings("deprecation") + com.google.spanner.admin.database.v1.DatabaseDialect result = + com.google.spanner.admin.database.v1.DatabaseDialect.valueOf(databaseDialect_); + return result == null + ? com.google.spanner.admin.database.v1.DatabaseDialect.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Output only. The database dialect information for the backup.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The databaseDialect to set. + * @return This builder for chaining. + */ + public Builder setDatabaseDialect(com.google.spanner.admin.database.v1.DatabaseDialect value) { + if (value == null) { + throw new NullPointerException(); + } + + databaseDialect_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The database dialect information for the backup.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearDatabaseDialect() { + + databaseDialect_ = 0; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupOrBuilder.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupOrBuilder.java index e9107cacb60..8810b28ee0c 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupOrBuilder.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupOrBuilder.java @@ -404,4 +404,33 @@ public interface BackupOrBuilder * */ com.google.spanner.admin.database.v1.EncryptionInfoOrBuilder getEncryptionInfoOrBuilder(); + + /** + * + * + *
+   * Output only. The database dialect information for the backup.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + int getDatabaseDialectValue(); + /** + * + * + *
+   * Output only. The database dialect information for the backup.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The databaseDialect. + */ + com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect(); } diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupProto.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupProto.java index 19c3efd2e3d..aafa5c2fc9b 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupProto.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/BackupProto.java @@ -86,13 +86,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n-google/spanner/admin/database/v1/backu" + "p.proto\022 google.spanner.admin.database.v" - + "1\032\037google/api/field_behavior.proto\032\031goog" - + "le/api/resource.proto\032#google/longrunnin" - + "g/operations.proto\032 google/protobuf/fiel" - + "d_mask.proto\032\037google/protobuf/timestamp." - + "proto\032-google/spanner/admin/database/v1/" - + "common.proto\032\034google/api/annotations.pro" - + "to\"\363\004\n\006Backup\0226\n\010database\030\002 \001(\tB$\372A!\n\037sp" + + "1\032\034google/api/annotations.proto\032\037google/" + + "api/field_behavior.proto\032\031google/api/res" + + "ource.proto\032#google/longrunning/operatio" + + "ns.proto\032 google/protobuf/field_mask.pro" + + "to\032\037google/protobuf/timestamp.proto\032-goo" + + "gle/spanner/admin/database/v1/common.pro" + + "to\"\305\005\n\006Backup\0226\n\010database\030\002 \001(\tB$\372A!\n\037sp" + "anner.googleapis.com/Database\0220\n\014version" + "_time\030\t \001(\0132\032.google.protobuf.Timestamp\022" + "/\n\013expire_time\030\003 \001(\0132\032.google.protobuf.T" @@ -104,76 +104,78 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "B\'\340A\003\372A!\n\037spanner.googleapis.com/Databas" + "e\022N\n\017encryption_info\030\010 \001(\01320.google.span" + "ner.admin.database.v1.EncryptionInfoB\003\340A" - + "\003\"7\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010CRE" - + "ATING\020\001\022\t\n\005READY\020\002:\\\352AY\n\035spanner.googlea" - + "pis.com/Backup\0228projects/{project}/insta" - + "nces/{instance}/backups/{backup}\"\205\002\n\023Cre" - + "ateBackupRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!" - + "\n\037spanner.googleapis.com/Instance\022\026\n\tbac" - + "kup_id\030\002 \001(\tB\003\340A\002\022=\n\006backup\030\003 \001(\0132(.goog" - + "le.spanner.admin.database.v1.BackupB\003\340A\002" - + "\022^\n\021encryption_config\030\004 \001(\0132>.google.spa" - + "nner.admin.database.v1.CreateBackupEncry" - + "ptionConfigB\003\340A\001\"\370\001\n\024CreateBackupMetadat" - + "a\0220\n\004name\030\001 \001(\tB\"\372A\037\n\035spanner.googleapis" - + ".com/Backup\0226\n\010database\030\002 \001(\tB$\372A!\n\037span" - + "ner.googleapis.com/Database\022E\n\010progress\030" - + "\003 \001(\01323.google.spanner.admin.database.v1" - + ".OperationProgress\022/\n\013cancel_time\030\004 \001(\0132" - + "\032.google.protobuf.Timestamp\"\212\001\n\023UpdateBa" - + "ckupRequest\022=\n\006backup\030\001 \001(\0132(.google.spa" - + "nner.admin.database.v1.BackupB\003\340A\002\0224\n\013up" - + "date_mask\030\002 \001(\0132\032.google.protobuf.FieldM" - + "askB\003\340A\002\"G\n\020GetBackupRequest\0223\n\004name\030\001 \001" - + "(\tB%\340A\002\372A\037\n\035spanner.googleapis.com/Backu" - + "p\"J\n\023DeleteBackupRequest\0223\n\004name\030\001 \001(\tB%" - + "\340A\002\372A\037\n\035spanner.googleapis.com/Backup\"\204\001" - + "\n\022ListBackupsRequest\0227\n\006parent\030\001 \001(\tB\'\340A" - + "\002\372A!\n\037spanner.googleapis.com/Instance\022\016\n" - + "\006filter\030\002 \001(\t\022\021\n\tpage_size\030\003 \001(\005\022\022\n\npage" - + "_token\030\004 \001(\t\"i\n\023ListBackupsResponse\0229\n\007b" - + "ackups\030\001 \003(\0132(.google.spanner.admin.data" - + "base.v1.Backup\022\027\n\017next_page_token\030\002 \001(\t\"" - + "\215\001\n\033ListBackupOperationsRequest\0227\n\006paren" - + "t\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis.com/" - + "Instance\022\016\n\006filter\030\002 \001(\t\022\021\n\tpage_size\030\003 " - + "\001(\005\022\022\n\npage_token\030\004 \001(\t\"j\n\034ListBackupOpe" - + "rationsResponse\0221\n\noperations\030\001 \003(\0132\035.go" - + "ogle.longrunning.Operation\022\027\n\017next_page_" - + "token\030\002 \001(\t\"\342\001\n\nBackupInfo\0222\n\006backup\030\001 \001" - + "(\tB\"\372A\037\n\035spanner.googleapis.com/Backup\0220" - + "\n\014version_time\030\004 \001(\0132\032.google.protobuf.T" - + "imestamp\022/\n\013create_time\030\002 \001(\0132\032.google.p" - + "rotobuf.Timestamp\022=\n\017source_database\030\003 \001" - + "(\tB$\372A!\n\037spanner.googleapis.com/Database" - + "\"\335\002\n\034CreateBackupEncryptionConfig\022k\n\017enc" - + "ryption_type\030\001 \001(\0162M.google.spanner.admi" - + "n.database.v1.CreateBackupEncryptionConf" - + "ig.EncryptionTypeB\003\340A\002\022?\n\014kms_key_name\030\002" - + " \001(\tB)\340A\001\372A#\n!cloudkms.googleapis.com/Cr" - + "yptoKey\"\216\001\n\016EncryptionType\022\037\n\033ENCRYPTION" - + "_TYPE_UNSPECIFIED\020\000\022\033\n\027USE_DATABASE_ENCR" - + "YPTION\020\001\022\035\n\031GOOGLE_DEFAULT_ENCRYPTION\020\002\022" - + "\037\n\033CUSTOMER_MANAGED_ENCRYPTION\020\003B\377\001\n$com" - + ".google.spanner.admin.database.v1B\013Backu" - + "pProtoP\001ZHgoogle.golang.org/genproto/goo" - + "gleapis/spanner/admin/database/v1;databa" - + "se\252\002&Google.Cloud.Spanner.Admin.Database" - + ".V1\312\002&Google\\Cloud\\Spanner\\Admin\\Databas" - + "e\\V1\352\002+Google::Cloud::Spanner::Admin::Da" - + "tabase::V1b\006proto3" + + "\003\022P\n\020database_dialect\030\n \001(\01621.google.spa" + + "nner.admin.database.v1.DatabaseDialectB\003" + + "\340A\003\"7\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010C" + + "REATING\020\001\022\t\n\005READY\020\002:\\\352AY\n\035spanner.googl" + + "eapis.com/Backup\0228projects/{project}/ins" + + "tances/{instance}/backups/{backup}\"\205\002\n\023C" + + "reateBackupRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372" + + "A!\n\037spanner.googleapis.com/Instance\022\026\n\tb" + + "ackup_id\030\002 \001(\tB\003\340A\002\022=\n\006backup\030\003 \001(\0132(.go" + + "ogle.spanner.admin.database.v1.BackupB\003\340" + + "A\002\022^\n\021encryption_config\030\004 \001(\0132>.google.s" + + "panner.admin.database.v1.CreateBackupEnc" + + "ryptionConfigB\003\340A\001\"\370\001\n\024CreateBackupMetad" + + "ata\0220\n\004name\030\001 \001(\tB\"\372A\037\n\035spanner.googleap" + + "is.com/Backup\0226\n\010database\030\002 \001(\tB$\372A!\n\037sp" + + "anner.googleapis.com/Database\022E\n\010progres" + + "s\030\003 \001(\01323.google.spanner.admin.database." + + "v1.OperationProgress\022/\n\013cancel_time\030\004 \001(" + + "\0132\032.google.protobuf.Timestamp\"\212\001\n\023Update" + + "BackupRequest\022=\n\006backup\030\001 \001(\0132(.google.s" + + "panner.admin.database.v1.BackupB\003\340A\002\0224\n\013" + + "update_mask\030\002 \001(\0132\032.google.protobuf.Fiel" + + "dMaskB\003\340A\002\"G\n\020GetBackupRequest\0223\n\004name\030\001" + + " \001(\tB%\340A\002\372A\037\n\035spanner.googleapis.com/Bac" + + "kup\"J\n\023DeleteBackupRequest\0223\n\004name\030\001 \001(\t" + + "B%\340A\002\372A\037\n\035spanner.googleapis.com/Backup\"" + + "\204\001\n\022ListBackupsRequest\0227\n\006parent\030\001 \001(\tB\'" + + "\340A\002\372A!\n\037spanner.googleapis.com/Instance\022" + + "\016\n\006filter\030\002 \001(\t\022\021\n\tpage_size\030\003 \001(\005\022\022\n\npa" + + "ge_token\030\004 \001(\t\"i\n\023ListBackupsResponse\0229\n" + + "\007backups\030\001 \003(\0132(.google.spanner.admin.da" + + "tabase.v1.Backup\022\027\n\017next_page_token\030\002 \001(" + + "\t\"\215\001\n\033ListBackupOperationsRequest\0227\n\006par" + + "ent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis.co" + + "m/Instance\022\016\n\006filter\030\002 \001(\t\022\021\n\tpage_size\030" + + "\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"j\n\034ListBackupO" + + "perationsResponse\0221\n\noperations\030\001 \003(\0132\035." + + "google.longrunning.Operation\022\027\n\017next_pag" + + "e_token\030\002 \001(\t\"\342\001\n\nBackupInfo\0222\n\006backup\030\001" + + " \001(\tB\"\372A\037\n\035spanner.googleapis.com/Backup" + + "\0220\n\014version_time\030\004 \001(\0132\032.google.protobuf" + + ".Timestamp\022/\n\013create_time\030\002 \001(\0132\032.google" + + ".protobuf.Timestamp\022=\n\017source_database\030\003" + + " \001(\tB$\372A!\n\037spanner.googleapis.com/Databa" + + "se\"\335\002\n\034CreateBackupEncryptionConfig\022k\n\017e" + + "ncryption_type\030\001 \001(\0162M.google.spanner.ad" + + "min.database.v1.CreateBackupEncryptionCo" + + "nfig.EncryptionTypeB\003\340A\002\022?\n\014kms_key_name" + + "\030\002 \001(\tB)\340A\001\372A#\n!cloudkms.googleapis.com/" + + "CryptoKey\"\216\001\n\016EncryptionType\022\037\n\033ENCRYPTI" + + "ON_TYPE_UNSPECIFIED\020\000\022\033\n\027USE_DATABASE_EN" + + "CRYPTION\020\001\022\035\n\031GOOGLE_DEFAULT_ENCRYPTION\020" + + "\002\022\037\n\033CUSTOMER_MANAGED_ENCRYPTION\020\003B\377\001\n$c" + + "om.google.spanner.admin.database.v1B\013Bac" + + "kupProtoP\001ZHgoogle.golang.org/genproto/g" + + "oogleapis/spanner/admin/database/v1;data" + + "base\252\002&Google.Cloud.Spanner.Admin.Databa" + + "se.V1\312\002&Google\\Cloud\\Spanner\\Admin\\Datab" + + "ase\\V1\352\002+Google::Cloud::Spanner::Admin::" + + "Database::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.longrunning.OperationsProto.getDescriptor(), com.google.protobuf.FieldMaskProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.spanner.admin.database.v1.CommonProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_spanner_admin_database_v1_Backup_descriptor = getDescriptor().getMessageTypes().get(0); @@ -190,6 +192,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "State", "ReferencingDatabases", "EncryptionInfo", + "DatabaseDialect", }); internal_static_google_spanner_admin_database_v1_CreateBackupRequest_descriptor = getDescriptor().getMessageTypes().get(1); @@ -286,13 +289,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.longrunning.OperationsProto.getDescriptor(); com.google.protobuf.FieldMaskProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.spanner.admin.database.v1.CommonProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CommonProto.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CommonProto.java index 331423327d4..157e9098686 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CommonProto.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CommonProto.java @@ -50,10 +50,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n-google/spanner/admin/database/v1/commo" + "n.proto\022 google.spanner.admin.database.v" - + "1\032\037google/api/field_behavior.proto\032\031goog" - + "le/api/resource.proto\032\037google/protobuf/t" - + "imestamp.proto\032\027google/rpc/status.proto\032" - + "\034google/api/annotations.proto\"\213\001\n\021Operat" + + "1\032\034google/api/annotations.proto\032\037google/" + + "api/field_behavior.proto\032\031google/api/res" + + "ource.proto\032\037google/protobuf/timestamp.p" + + "roto\032\027google/rpc/status.proto\"\213\001\n\021Operat" + "ionProgress\022\030\n\020progress_percent\030\001 \001(\005\022.\n" + "\nstart_time\030\002 \001(\0132\032.google.protobuf.Time" + "stamp\022,\n\010end_time\030\003 \001(\0132\032.google.protobu" @@ -67,31 +67,33 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "A*\n(cloudkms.googleapis.com/CryptoKeyVer" + "sion\"\\\n\004Type\022\024\n\020TYPE_UNSPECIFIED\020\000\022\035\n\031GO" + "OGLE_DEFAULT_ENCRYPTION\020\001\022\037\n\033CUSTOMER_MA" - + "NAGED_ENCRYPTION\020\002B\244\004\n$com.google.spanne" - + "r.admin.database.v1B\013CommonProtoP\001ZHgoog" - + "le.golang.org/genproto/googleapis/spanne" - + "r/admin/database/v1;database\252\002&Google.Cl" - + "oud.Spanner.Admin.Database.V1\312\002&Google\\C" - + "loud\\Spanner\\Admin\\Database\\V1\352\002+Google:" - + ":Cloud::Spanner::Admin::Database::V1\352Ax\n" - + "!cloudkms.googleapis.com/CryptoKey\022Sproj" - + "ects/{project}/locations/{location}/keyR" - + "ings/{key_ring}/cryptoKeys/{crypto_key}\352" - + "A\246\001\n(cloudkms.googleapis.com/CryptoKeyVe" - + "rsion\022zprojects/{project}/locations/{loc" - + "ation}/keyRings/{key_ring}/cryptoKeys/{c" - + "rypto_key}/cryptoKeyVersions/{crypto_key" - + "_version}b\006proto3" + + "NAGED_ENCRYPTION\020\002*\\\n\017DatabaseDialect\022 \n" + + "\034DATABASE_DIALECT_UNSPECIFIED\020\000\022\027\n\023GOOGL" + + "E_STANDARD_SQL\020\001\022\016\n\nPOSTGRESQL\020\002B\244\004\n$com" + + ".google.spanner.admin.database.v1B\013Commo" + + "nProtoP\001ZHgoogle.golang.org/genproto/goo" + + "gleapis/spanner/admin/database/v1;databa" + + "se\252\002&Google.Cloud.Spanner.Admin.Database" + + ".V1\312\002&Google\\Cloud\\Spanner\\Admin\\Databas" + + "e\\V1\352\002+Google::Cloud::Spanner::Admin::Da" + + "tabase::V1\352Ax\n!cloudkms.googleapis.com/C" + + "ryptoKey\022Sprojects/{project}/locations/{" + + "location}/keyRings/{key_ring}/cryptoKeys" + + "/{crypto_key}\352A\246\001\n(cloudkms.googleapis.c" + + "om/CryptoKeyVersion\022zprojects/{project}/" + + "locations/{location}/keyRings/{key_ring}" + + "/cryptoKeys/{crypto_key}/cryptoKeyVersio" + + "ns/{crypto_key_version}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.rpc.StatusProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_spanner_admin_database_v1_OperationProgress_descriptor = getDescriptor().getMessageTypes().get(0); @@ -124,11 +126,11 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.rpc.StatusProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequest.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequest.java index 8d9df6aa618..9e75cb8015a 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequest.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequest.java @@ -41,6 +41,7 @@ private CreateDatabaseRequest() { parent_ = ""; createStatement_ = ""; extraStatements_ = com.google.protobuf.LazyStringArrayList.EMPTY; + databaseDialect_ = 0; } @java.lang.Override @@ -112,6 +113,13 @@ private CreateDatabaseRequest( encryptionConfig_ = subBuilder.buildPartial(); } + break; + } + case 40: + { + int rawValue = input.readEnum(); + + databaseDialect_ = rawValue; break; } default: @@ -397,6 +405,48 @@ public com.google.spanner.admin.database.v1.EncryptionConfig getEncryptionConfig return getEncryptionConfig(); } + public static final int DATABASE_DIALECT_FIELD_NUMBER = 5; + private int databaseDialect_; + /** + * + * + *
+   * Optional. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + @java.lang.Override + public int getDatabaseDialectValue() { + return databaseDialect_; + } + /** + * + * + *
+   * Optional. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The databaseDialect. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect() { + @SuppressWarnings("deprecation") + com.google.spanner.admin.database.v1.DatabaseDialect result = + com.google.spanner.admin.database.v1.DatabaseDialect.valueOf(databaseDialect_); + return result == null + ? com.google.spanner.admin.database.v1.DatabaseDialect.UNRECOGNIZED + : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -423,6 +473,11 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (encryptionConfig_ != null) { output.writeMessage(4, getEncryptionConfig()); } + if (databaseDialect_ + != com.google.spanner.admin.database.v1.DatabaseDialect.DATABASE_DIALECT_UNSPECIFIED + .getNumber()) { + output.writeEnum(5, databaseDialect_); + } unknownFields.writeTo(output); } @@ -449,6 +504,11 @@ public int getSerializedSize() { if (encryptionConfig_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getEncryptionConfig()); } + if (databaseDialect_ + != com.google.spanner.admin.database.v1.DatabaseDialect.DATABASE_DIALECT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, databaseDialect_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -472,6 +532,7 @@ public boolean equals(final java.lang.Object obj) { if (hasEncryptionConfig()) { if (!getEncryptionConfig().equals(other.getEncryptionConfig())) return false; } + if (databaseDialect_ != other.databaseDialect_) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -495,6 +556,8 @@ public int hashCode() { hash = (37 * hash) + ENCRYPTION_CONFIG_FIELD_NUMBER; hash = (53 * hash) + getEncryptionConfig().hashCode(); } + hash = (37 * hash) + DATABASE_DIALECT_FIELD_NUMBER; + hash = (53 * hash) + databaseDialect_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -653,6 +716,8 @@ public Builder clear() { encryptionConfig_ = null; encryptionConfigBuilder_ = null; } + databaseDialect_ = 0; + return this; } @@ -693,6 +758,7 @@ public com.google.spanner.admin.database.v1.CreateDatabaseRequest buildPartial() } else { result.encryptionConfig_ = encryptionConfigBuilder_.build(); } + result.databaseDialect_ = databaseDialect_; onBuilt(); return result; } @@ -764,6 +830,9 @@ public Builder mergeFrom(com.google.spanner.admin.database.v1.CreateDatabaseRequ if (other.hasEncryptionConfig()) { mergeEncryptionConfig(other.getEncryptionConfig()); } + if (other.databaseDialect_ != 0) { + setDatabaseDialectValue(other.getDatabaseDialectValue()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1464,6 +1533,109 @@ public Builder clearEncryptionConfig() { return encryptionConfigBuilder_; } + private int databaseDialect_ = 0; + /** + * + * + *
+     * Optional. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + @java.lang.Override + public int getDatabaseDialectValue() { + return databaseDialect_; + } + /** + * + * + *
+     * Optional. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The enum numeric value on the wire for databaseDialect to set. + * @return This builder for chaining. + */ + public Builder setDatabaseDialectValue(int value) { + + databaseDialect_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The databaseDialect. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect() { + @SuppressWarnings("deprecation") + com.google.spanner.admin.database.v1.DatabaseDialect result = + com.google.spanner.admin.database.v1.DatabaseDialect.valueOf(databaseDialect_); + return result == null + ? com.google.spanner.admin.database.v1.DatabaseDialect.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Optional. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The databaseDialect to set. + * @return This builder for chaining. + */ + public Builder setDatabaseDialect(com.google.spanner.admin.database.v1.DatabaseDialect value) { + if (value == null) { + throw new NullPointerException(); + } + + databaseDialect_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearDatabaseDialect() { + + databaseDialect_ = 0; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequestOrBuilder.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequestOrBuilder.java index e1a5b67eb94..537e9c161fa 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequestOrBuilder.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequestOrBuilder.java @@ -196,4 +196,33 @@ public interface CreateDatabaseRequestOrBuilder * */ com.google.spanner.admin.database.v1.EncryptionConfigOrBuilder getEncryptionConfigOrBuilder(); + + /** + * + * + *
+   * Optional. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + int getDatabaseDialectValue(); + /** + * + * + *
+   * Optional. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The databaseDialect. + */ + com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect(); } diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Database.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Database.java index 87c222f21a0..02000562c6d 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Database.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Database.java @@ -43,6 +43,7 @@ private Database() { encryptionInfo_ = java.util.Collections.emptyList(); versionRetentionPeriod_ = ""; defaultLeader_ = ""; + databaseDialect_ = 0; } @java.lang.Override @@ -179,6 +180,13 @@ private Database( defaultLeader_ = s; break; } + case 80: + { + int rawValue = input.readEnum(); + + databaseDialect_ = rawValue; + break; + } default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { @@ -969,6 +977,48 @@ public com.google.protobuf.ByteString getDefaultLeaderBytes() { } } + public static final int DATABASE_DIALECT_FIELD_NUMBER = 10; + private int databaseDialect_; + /** + * + * + *
+   * Output only. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + @java.lang.Override + public int getDatabaseDialectValue() { + return databaseDialect_; + } + /** + * + * + *
+   * Output only. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The databaseDialect. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect() { + @SuppressWarnings("deprecation") + com.google.spanner.admin.database.v1.DatabaseDialect result = + com.google.spanner.admin.database.v1.DatabaseDialect.valueOf(databaseDialect_); + return result == null + ? com.google.spanner.admin.database.v1.DatabaseDialect.UNRECOGNIZED + : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -1011,6 +1061,11 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultLeader_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 9, defaultLeader_); } + if (databaseDialect_ + != com.google.spanner.admin.database.v1.DatabaseDialect.DATABASE_DIALECT_UNSPECIFIED + .getNumber()) { + output.writeEnum(10, databaseDialect_); + } unknownFields.writeTo(output); } @@ -1048,6 +1103,11 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(defaultLeader_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, defaultLeader_); } + if (databaseDialect_ + != com.google.spanner.admin.database.v1.DatabaseDialect.DATABASE_DIALECT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(10, databaseDialect_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1085,6 +1145,7 @@ public boolean equals(final java.lang.Object obj) { if (!getEarliestVersionTime().equals(other.getEarliestVersionTime())) return false; } if (!getDefaultLeader().equals(other.getDefaultLeader())) return false; + if (databaseDialect_ != other.databaseDialect_) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1124,6 +1185,8 @@ public int hashCode() { } hash = (37 * hash) + DEFAULT_LEADER_FIELD_NUMBER; hash = (53 * hash) + getDefaultLeader().hashCode(); + hash = (37 * hash) + DATABASE_DIALECT_FIELD_NUMBER; + hash = (53 * hash) + databaseDialect_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1309,6 +1372,8 @@ public Builder clear() { } defaultLeader_ = ""; + databaseDialect_ = 0; + return this; } @@ -1370,6 +1435,7 @@ public com.google.spanner.admin.database.v1.Database buildPartial() { result.earliestVersionTime_ = earliestVersionTimeBuilder_.build(); } result.defaultLeader_ = defaultLeader_; + result.databaseDialect_ = databaseDialect_; onBuilt(); return result; } @@ -1473,6 +1539,9 @@ public Builder mergeFrom(com.google.spanner.admin.database.v1.Database other) { defaultLeader_ = other.defaultLeader_; onChanged(); } + if (other.databaseDialect_ != 0) { + setDatabaseDialectValue(other.getDatabaseDialectValue()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -3384,6 +3453,109 @@ public Builder setDefaultLeaderBytes(com.google.protobuf.ByteString value) { return this; } + private int databaseDialect_ = 0; + /** + * + * + *
+     * Output only. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + @java.lang.Override + public int getDatabaseDialectValue() { + return databaseDialect_; + } + /** + * + * + *
+     * Output only. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for databaseDialect to set. + * @return This builder for chaining. + */ + public Builder setDatabaseDialectValue(int value) { + + databaseDialect_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The databaseDialect. + */ + @java.lang.Override + public com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect() { + @SuppressWarnings("deprecation") + com.google.spanner.admin.database.v1.DatabaseDialect result = + com.google.spanner.admin.database.v1.DatabaseDialect.valueOf(databaseDialect_); + return result == null + ? com.google.spanner.admin.database.v1.DatabaseDialect.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Output only. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The databaseDialect to set. + * @return This builder for chaining. + */ + public Builder setDatabaseDialect(com.google.spanner.admin.database.v1.DatabaseDialect value) { + if (value == null) { + throw new NullPointerException(); + } + + databaseDialect_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The dialect of the Cloud Spanner Database.
+     * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearDatabaseDialect() { + + databaseDialect_ = 0; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseDialect.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseDialect.java new file mode 100644 index 00000000000..b2898046416 --- /dev/null +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseDialect.java @@ -0,0 +1,178 @@ +/* + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/admin/database/v1/common.proto + +package com.google.spanner.admin.database.v1; + +/** + * + * + *
+ * Indicates the dialect type of a database.
+ * 
+ * + * Protobuf enum {@code google.spanner.admin.database.v1.DatabaseDialect} + */ +public enum DatabaseDialect implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Default value. This value will create a database with the
+   * GOOGLE_STANDARD_SQL dialect.
+   * 
+ * + * DATABASE_DIALECT_UNSPECIFIED = 0; + */ + DATABASE_DIALECT_UNSPECIFIED(0), + /** + * + * + *
+   * Google standard SQL.
+   * 
+ * + * GOOGLE_STANDARD_SQL = 1; + */ + GOOGLE_STANDARD_SQL(1), + /** + * + * + *
+   * PostgreSQL supported SQL.
+   * 
+ * + * POSTGRESQL = 2; + */ + POSTGRESQL(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Default value. This value will create a database with the
+   * GOOGLE_STANDARD_SQL dialect.
+   * 
+ * + * DATABASE_DIALECT_UNSPECIFIED = 0; + */ + public static final int DATABASE_DIALECT_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * Google standard SQL.
+   * 
+ * + * GOOGLE_STANDARD_SQL = 1; + */ + public static final int GOOGLE_STANDARD_SQL_VALUE = 1; + /** + * + * + *
+   * PostgreSQL supported SQL.
+   * 
+ * + * POSTGRESQL = 2; + */ + public static final int POSTGRESQL_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DatabaseDialect valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static DatabaseDialect forNumber(int value) { + switch (value) { + case 0: + return DATABASE_DIALECT_UNSPECIFIED; + case 1: + return GOOGLE_STANDARD_SQL; + case 2: + return POSTGRESQL; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public DatabaseDialect findValueByNumber(int number) { + return DatabaseDialect.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.spanner.admin.database.v1.CommonProto.getDescriptor().getEnumTypes().get(0); + } + + private static final DatabaseDialect[] VALUES = values(); + + public static DatabaseDialect valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private DatabaseDialect(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.spanner.admin.database.v1.DatabaseDialect) +} diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseOrBuilder.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseOrBuilder.java index 0c858530793..de9373a0f9e 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseOrBuilder.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseOrBuilder.java @@ -428,4 +428,33 @@ com.google.spanner.admin.database.v1.EncryptionInfoOrBuilder getEncryptionInfoOr * @return The bytes for defaultLeader. */ com.google.protobuf.ByteString getDefaultLeaderBytes(); + + /** + * + * + *
+   * Output only. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for databaseDialect. + */ + int getDatabaseDialectValue(); + /** + * + * + *
+   * Output only. The dialect of the Cloud Spanner Database.
+   * 
+ * + * + * .google.spanner.admin.database.v1.DatabaseDialect database_dialect = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The databaseDialect. + */ + com.google.spanner.admin.database.v1.DatabaseDialect getDatabaseDialect(); } diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/SpannerDatabaseAdminProto.java b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/SpannerDatabaseAdminProto.java index 4396736d3c8..1acad6985e1 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/SpannerDatabaseAdminProto.java +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/SpannerDatabaseAdminProto.java @@ -116,209 +116,214 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "source.proto\032\036google/iam/v1/iam_policy.p" + "roto\032\032google/iam/v1/policy.proto\032#google" + "/longrunning/operations.proto\032\033google/pr" - + "otobuf/empty.proto\032\037google/protobuf/time" - + "stamp.proto\032-google/spanner/admin/databa" - + "se/v1/backup.proto\032-google/spanner/admin" - + "/database/v1/common.proto\"\253\001\n\013RestoreInf" - + "o\022H\n\013source_type\030\001 \001(\01623.google.spanner." - + "admin.database.v1.RestoreSourceType\022C\n\013b" - + "ackup_info\030\002 \001(\0132,.google.spanner.admin." - + "database.v1.BackupInfoH\000B\r\n\013source_info\"" - + "\276\005\n\010Database\022\021\n\004name\030\001 \001(\tB\003\340A\002\022D\n\005state" - + "\030\002 \001(\01620.google.spanner.admin.database.v" - + "1.Database.StateB\003\340A\003\0224\n\013create_time\030\003 \001" - + "(\0132\032.google.protobuf.TimestampB\003\340A\003\022H\n\014r" - + "estore_info\030\004 \001(\0132-.google.spanner.admin" - + ".database.v1.RestoreInfoB\003\340A\003\022R\n\021encrypt" - + "ion_config\030\005 \001(\01322.google.spanner.admin." - + "database.v1.EncryptionConfigB\003\340A\003\022N\n\017enc" - + "ryption_info\030\010 \003(\01320.google.spanner.admi" - + "n.database.v1.EncryptionInfoB\003\340A\003\022%\n\030ver" - + "sion_retention_period\030\006 \001(\tB\003\340A\003\022>\n\025earl" - + "iest_version_time\030\007 \001(\0132\032.google.protobu" - + "f.TimestampB\003\340A\003\022\033\n\016default_leader\030\t \001(\t" - + "B\003\340A\003\"M\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n" - + "\010CREATING\020\001\022\t\n\005READY\020\002\022\024\n\020READY_OPTIMIZI" - + "NG\020\003:b\352A_\n\037spanner.googleapis.com/Databa" - + "se\022\202\323\344" - + "\223\002/\022-/v1/{parent=projects/*/instances/*}" - + "/databases\332A\006parent\022\244\002\n\016CreateDatabase\0227" - + ".google.spanner.admin.database.v1.Create" - + "DatabaseRequest\032\035.google.longrunning.Ope" - + "ration\"\271\001\202\323\344\223\0022\"-/v1/{parent=projects/*/" - + "instances/*}/databases:\001*\332A\027parent,creat" - + "e_statement\312Ad\n)google.spanner.admin.dat" - + "abase.v1.Database\0227google.spanner.admin." - + "database.v1.CreateDatabaseMetadata\022\255\001\n\013G" - + "etDatabase\0224.google.spanner.admin.databa" - + "se.v1.GetDatabaseRequest\032*.google.spanne" - + "r.admin.database.v1.Database\"<\202\323\344\223\002/\022-/v" - + "1/{name=projects/*/instances/*/databases" - + "/*}\332A\004name\022\235\002\n\021UpdateDatabaseDdl\022:.googl" - + "e.spanner.admin.database.v1.UpdateDataba" - + "seDdlRequest\032\035.google.longrunning.Operat" - + "ion\"\254\001\202\323\344\223\002:25/v1/{database=projects/*/i" - + "nstances/*/databases/*}/ddl:\001*\332A\023databas" - + "e,statements\312AS\n\025google.protobuf.Empty\022:" - + "google.spanner.admin.database.v1.UpdateD" - + "atabaseDdlMetadata\022\243\001\n\014DropDatabase\0225.go" - + "ogle.spanner.admin.database.v1.DropDatab" - + "aseRequest\032\026.google.protobuf.Empty\"D\202\323\344\223" - + "\0023*1/v1/{database=projects/*/instances/*" - + "/databases/*}\332A\010database\022\315\001\n\016GetDatabase" - + "Ddl\0227.google.spanner.admin.database.v1.G" - + "etDatabaseDdlRequest\0328.google.spanner.ad" - + "min.database.v1.GetDatabaseDdlResponse\"H" - + "\202\323\344\223\0027\0225/v1/{database=projects/*/instanc" - + "es/*/databases/*}/ddl\332A\010database\022\353\001\n\014Set" - + "IamPolicy\022\".google.iam.v1.SetIamPolicyRe" - + "quest\032\025.google.iam.v1.Policy\"\237\001\202\323\344\223\002\206\001\">" - + "/v1/{resource=projects/*/instances/*/dat" - + "abases/*}:setIamPolicy:\001*ZA\"/v" + + "otobuf/empty.proto\032 google/protobuf/fiel" + + "d_mask.proto\032\037google/protobuf/timestamp." + + "proto\032-google/spanner/admin/database/v1/" + + "backup.proto\032-google/spanner/admin/datab" + + "ase/v1/common.proto\"\253\001\n\013RestoreInfo\022H\n\013s" + + "ource_type\030\001 \001(\01623.google.spanner.admin." + + "database.v1.RestoreSourceType\022C\n\013backup_" + + "info\030\002 \001(\0132,.google.spanner.admin.databa" + + "se.v1.BackupInfoH\000B\r\n\013source_info\"\220\006\n\010Da" + + "tabase\022\021\n\004name\030\001 \001(\tB\003\340A\002\022D\n\005state\030\002 \001(\016" + + "20.google.spanner.admin.database.v1.Data" + + "base.StateB\003\340A\003\0224\n\013create_time\030\003 \001(\0132\032.g" + + "oogle.protobuf.TimestampB\003\340A\003\022H\n\014restore" + + "_info\030\004 \001(\0132-.google.spanner.admin.datab" + + "ase.v1.RestoreInfoB\003\340A\003\022R\n\021encryption_co" + + "nfig\030\005 \001(\01322.google.spanner.admin.databa" + + "se.v1.EncryptionConfigB\003\340A\003\022N\n\017encryptio" + + "n_info\030\010 \003(\01320.google.spanner.admin.data" + + "base.v1.EncryptionInfoB\003\340A\003\022%\n\030version_r" + + "etention_period\030\006 \001(\tB\003\340A\003\022>\n\025earliest_v" + + "ersion_time\030\007 \001(\0132\032.google.protobuf.Time" + + "stampB\003\340A\003\022\033\n\016default_leader\030\t \001(\tB\003\340A\003\022" + + "P\n\020database_dialect\030\n \001(\01621.google.spann" + + "er.admin.database.v1.DatabaseDialectB\003\340A" + + "\003\"M\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010CRE" + + "ATING\020\001\022\t\n\005READY\020\002\022\024\n\020READY_OPTIMIZING\020\003" + + ":b\352A_\n\037spanner.googleapis.com/Database\022<" + + "projects/{project}/instances/{instance}/" + + "databases/{database}\"v\n\024ListDatabasesReq" + + "uest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.go" + + "ogleapis.com/Instance\022\021\n\tpage_size\030\003 \001(\005" + + "\022\022\n\npage_token\030\004 \001(\t\"o\n\025ListDatabasesRes" + + "ponse\022=\n\tdatabases\030\001 \003(\0132*.google.spanne" + + "r.admin.database.v1.Database\022\027\n\017next_pag" + + "e_token\030\002 \001(\t\"\264\002\n\025CreateDatabaseRequest\022" + + "7\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googlea" + + "pis.com/Instance\022\035\n\020create_statement\030\002 \001" + + "(\tB\003\340A\002\022\035\n\020extra_statements\030\003 \003(\tB\003\340A\001\022R" + + "\n\021encryption_config\030\004 \001(\01322.google.spann" + + "er.admin.database.v1.EncryptionConfigB\003\340" + + "A\001\022P\n\020database_dialect\030\005 \001(\01621.google.sp" + + "anner.admin.database.v1.DatabaseDialectB" + + "\003\340A\001\"P\n\026CreateDatabaseMetadata\0226\n\010databa" + + "se\030\001 \001(\tB$\372A!\n\037spanner.googleapis.com/Da" + + "tabase\"K\n\022GetDatabaseRequest\0225\n\004name\030\001 \001" + + "(\tB\'\340A\002\372A!\n\037spanner.googleapis.com/Datab" + + "ase\"\204\001\n\030UpdateDatabaseDdlRequest\0229\n\010data" + + "base\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis.c" + + "om/Database\022\027\n\nstatements\030\002 \003(\tB\003\340A\002\022\024\n\014" + + "operation_id\030\003 \001(\t\"\375\001\n\031UpdateDatabaseDdl" + + "Metadata\0226\n\010database\030\001 \001(\tB$\372A!\n\037spanner" + + ".googleapis.com/Database\022\022\n\nstatements\030\002" + + " \003(\t\0225\n\021commit_timestamps\030\003 \003(\0132\032.google" + + ".protobuf.Timestamp\022\026\n\tthrottled\030\004 \001(\010B\003" + + "\340A\003\022E\n\010progress\030\005 \003(\01323.google.spanner.a" + + "dmin.database.v1.OperationProgress\"P\n\023Dr" + + "opDatabaseRequest\0229\n\010database\030\001 \001(\tB\'\340A\002" + + "\372A!\n\037spanner.googleapis.com/Database\"R\n\025" + + "GetDatabaseDdlRequest\0229\n\010database\030\001 \001(\tB" + + "\'\340A\002\372A!\n\037spanner.googleapis.com/Database" + + "\",\n\026GetDatabaseDdlResponse\022\022\n\nstatements" + + "\030\001 \003(\t\"\217\001\n\035ListDatabaseOperationsRequest" + + "\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.google" + + "apis.com/Instance\022\016\n\006filter\030\002 \001(\t\022\021\n\tpag" + + "e_size\030\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"l\n\036List" + + "DatabaseOperationsResponse\0221\n\noperations" + + "\030\001 \003(\0132\035.google.longrunning.Operation\022\027\n" + + "\017next_page_token\030\002 \001(\t\"\216\002\n\026RestoreDataba" + + "seRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spann" + + "er.googleapis.com/Instance\022\030\n\013database_i" + + "d\030\002 \001(\tB\003\340A\002\0224\n\006backup\030\003 \001(\tB\"\372A\037\n\035spann" + + "er.googleapis.com/BackupH\000\022a\n\021encryption" + + "_config\030\004 \001(\0132A.google.spanner.admin.dat" + + "abase.v1.RestoreDatabaseEncryptionConfig" + + "B\003\340A\001B\010\n\006source\"\363\002\n\037RestoreDatabaseEncry" + + "ptionConfig\022n\n\017encryption_type\030\001 \001(\0162P.g" + + "oogle.spanner.admin.database.v1.RestoreD" + + "atabaseEncryptionConfig.EncryptionTypeB\003" + + "\340A\002\022?\n\014kms_key_name\030\002 \001(\tB)\340A\001\372A#\n!cloud" + + "kms.googleapis.com/CryptoKey\"\236\001\n\016Encrypt" + + "ionType\022\037\n\033ENCRYPTION_TYPE_UNSPECIFIED\020\000" + + "\022+\n\'USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPT" + + "ION\020\001\022\035\n\031GOOGLE_DEFAULT_ENCRYPTION\020\002\022\037\n\033" + + "CUSTOMER_MANAGED_ENCRYPTION\020\003\"\215\003\n\027Restor" + + "eDatabaseMetadata\0222\n\004name\030\001 \001(\tB$\372A!\n\037sp" + + "anner.googleapis.com/Database\022H\n\013source_" + + "type\030\002 \001(\01623.google.spanner.admin.databa" + + "se.v1.RestoreSourceType\022C\n\013backup_info\030\003" + + " \001(\0132,.google.spanner.admin.database.v1." + + "BackupInfoH\000\022E\n\010progress\030\004 \001(\01323.google." + + "spanner.admin.database.v1.OperationProgr" + + "ess\022/\n\013cancel_time\030\005 \001(\0132\032.google.protob" + + "uf.Timestamp\022(\n optimize_database_operat" + + "ion_name\030\006 \001(\tB\r\n\013source_info\"\235\001\n Optimi" + + "zeRestoredDatabaseMetadata\0222\n\004name\030\001 \001(\t" + + "B$\372A!\n\037spanner.googleapis.com/Database\022E" + + "\n\010progress\030\002 \001(\01323.google.spanner.admin." + + "database.v1.OperationProgress*5\n\021Restore" + + "SourceType\022\024\n\020TYPE_UNSPECIFIED\020\000\022\n\n\006BACK" + + "UP\020\0012\223\037\n\rDatabaseAdmin\022\300\001\n\rListDatabases" + + "\0226.google.spanner.admin.database.v1.List" + + "DatabasesRequest\0327.google.spanner.admin." + + "database.v1.ListDatabasesResponse\">\202\323\344\223\002" + + "/\022-/v1/{parent=projects/*/instances/*}/d" + + "atabases\332A\006parent\022\244\002\n\016CreateDatabase\0227.g" + + "oogle.spanner.admin.database.v1.CreateDa" + + "tabaseRequest\032\035.google.longrunning.Opera" + + "tion\"\271\001\202\323\344\223\0022\"-/v1/{parent=projects/*/in" + + "stances/*}/databases:\001*\332A\027parent,create_" + + "statement\312Ad\n)google.spanner.admin.datab" + + "ase.v1.Database\0227google.spanner.admin.da" + + "tabase.v1.CreateDatabaseMetadata\022\255\001\n\013Get" + + "Database\0224.google.spanner.admin.database" + + ".v1.GetDatabaseRequest\032*.google.spanner." + + "admin.database.v1.Database\"<\202\323\344\223\002/\022-/v1/" + + "{name=projects/*/instances/*/databases/*" + + "}\332A\004name\022\235\002\n\021UpdateDatabaseDdl\022:.google." + + "spanner.admin.database.v1.UpdateDatabase" + + "DdlRequest\032\035.google.longrunning.Operatio" + + "n\"\254\001\202\323\344\223\002:25/v1/{database=projects/*/ins" + + "tances/*/databases/*}/ddl:\001*\332A\023database," + + "statements\312AS\n\025google.protobuf.Empty\022:go" + + "ogle.spanner.admin.database.v1.UpdateDat" + + "abaseDdlMetadata\022\243\001\n\014DropDatabase\0225.goog" + + "le.spanner.admin.database.v1.DropDatabas" + + "eRequest\032\026.google.protobuf.Empty\"D\202\323\344\223\0023" + + "*1/v1/{database=projects/*/instances/*/d" + + "atabases/*}\332A\010database\022\315\001\n\016GetDatabaseDd" + + "l\0227.google.spanner.admin.database.v1.Get" + + "DatabaseDdlRequest\0328.google.spanner.admi" + + "n.database.v1.GetDatabaseDdlResponse\"H\202\323" + + "\344\223\0027\0225/v1/{database=projects/*/instances" + + "/*/databases/*}/ddl\332A\010database\022\353\001\n\014SetIa" + + "mPolicy\022\".google.iam.v1.SetIamPolicyRequ" + + "est\032\025.google.iam.v1.Policy\"\237\001\202\323\344\223\002\206\001\">/v" + "1/{resource=projects/*/instances/*/datab" - + "ases/*}:getIamPolicy:\001*ZA\".google.spanner.adm" - + "in.database.v1.ListBackupOperationsRespo" - + "nse\"E\202\323\344\223\0026\0224/v1/{parent=projects/*/inst" - + "ances/*}/backupOperations\332A\006parent\032x\312A\026s" - + "panner.googleapis.com\322A\\https://www.goog" - + "leapis.com/auth/cloud-platform,https://w" - + "ww.googleapis.com/auth/spanner.adminB\332\002\n" - + "$com.google.spanner.admin.database.v1B\031S" - + "pannerDatabaseAdminProtoP\001ZHgoogle.golan" - + "g.org/genproto/googleapis/spanner/admin/" - + "database/v1;database\252\002&Google.Cloud.Span" - + "ner.Admin.Database.V1\312\002&Google\\Cloud\\Spa" - + "nner\\Admin\\Database\\V1\352\002+Google::Cloud::" - + "Spanner::Admin::Database::V1\352AJ\n\037spanner" - + ".googleapis.com/Instance\022\'projects/{proj" - + "ect}/instances/{instance}b\006proto3" + + "ases/*}:setIamPolicy:\001*ZA\"/v1/" + + "{resource=projects/*/instances/*/databas" + + "es/*}:getIamPolicy:\001*ZA\".google.spanner.admin" + + ".database.v1.ListBackupOperationsRespons" + + "e\"E\202\323\344\223\0026\0224/v1/{parent=projects/*/instan" + + "ces/*}/backupOperations\332A\006parent\032x\312A\026spa" + + "nner.googleapis.com\322A\\https://www.google" + + "apis.com/auth/cloud-platform,https://www" + + ".googleapis.com/auth/spanner.adminB\332\002\n$c" + + "om.google.spanner.admin.database.v1B\031Spa" + + "nnerDatabaseAdminProtoP\001ZHgoogle.golang." + + "org/genproto/googleapis/spanner/admin/da" + + "tabase/v1;database\252\002&Google.Cloud.Spanne" + + "r.Admin.Database.V1\312\002&Google\\Cloud\\Spann" + + "er\\Admin\\Database\\V1\352\002+Google::Cloud::Sp" + + "anner::Admin::Database::V1\352AJ\n\037spanner.g" + + "oogleapis.com/Instance\022\'projects/{projec" + + "t}/instances/{instance}b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -332,6 +337,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.iam.v1.PolicyProto.getDescriptor(), com.google.longrunning.OperationsProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), com.google.spanner.admin.database.v1.BackupProto.getDescriptor(), com.google.spanner.admin.database.v1.CommonProto.getDescriptor(), @@ -359,6 +365,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "VersionRetentionPeriod", "EarliestVersionTime", "DefaultLeader", + "DatabaseDialect", }); internal_static_google_spanner_admin_database_v1_ListDatabasesRequest_descriptor = getDescriptor().getMessageTypes().get(2); @@ -382,7 +389,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_database_v1_CreateDatabaseRequest_descriptor, new java.lang.String[] { - "Parent", "CreateStatement", "ExtraStatements", "EncryptionConfig", + "Parent", "CreateStatement", "ExtraStatements", "EncryptionConfig", "DatabaseDialect", }); internal_static_google_spanner_admin_database_v1_CreateDatabaseMetadata_descriptor = getDescriptor().getMessageTypes().get(5); @@ -515,6 +522,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.iam.v1.PolicyProto.getDescriptor(); com.google.longrunning.OperationsProto.getDescriptor(); com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); com.google.spanner.admin.database.v1.BackupProto.getDescriptor(); com.google.spanner.admin.database.v1.CommonProto.getDescriptor(); diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/backup.proto b/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/backup.proto index ba57c1731ce..1e9ce30058a 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/backup.proto +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/backup.proto @@ -16,13 +16,13 @@ syntax = "proto3"; package google.spanner.admin.database.v1; +import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/spanner/admin/database/v1/common.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database"; @@ -117,6 +117,9 @@ message Backup { // Output only. The encryption information for the backup. EncryptionInfo encryption_info = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The database dialect information for the backup. + DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup]. diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/common.proto b/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/common.proto index 29aabff0ba4..739a486458e 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/common.proto +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/common.proto @@ -16,11 +16,11 @@ syntax = "proto3"; package google.spanner.admin.database.v1; +import "google/api/annotations.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.Spanner.Admin.Database.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/admin/database/v1;database"; @@ -98,3 +98,16 @@ message EncryptionInfo { } ]; } + +// Indicates the dialect type of a database. +enum DatabaseDialect { + // Default value. This value will create a database with the + // GOOGLE_STANDARD_SQL dialect. + DATABASE_DIALECT_UNSPECIFIED = 0; + + // Google standard SQL. + GOOGLE_STANDARD_SQL = 1; + + // PostgreSQL supported SQL. + POSTGRESQL = 2; +} diff --git a/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/spanner_database_admin.proto b/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/spanner_database_admin.proto index 002717505b1..89d582412db 100644 --- a/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/spanner_database_admin.proto +++ b/proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/spanner_database_admin.proto @@ -24,6 +24,7 @@ import "google/iam/v1/iam_policy.proto"; import "google/iam/v1/policy.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; import "google/spanner/admin/database/v1/backup.proto"; import "google/spanner/admin/database/v1/common.proto"; @@ -42,10 +43,11 @@ option (google.api.resource_definition) = { // Cloud Spanner Database Admin API // -// The Cloud Spanner Database Admin API can be used to create, drop, and -// list databases. It also enables updating the schema of pre-existing -// databases. It can be also used to create, delete and list backups for a -// database and to restore from an existing backup. +// The Cloud Spanner Database Admin API can be used to: +// * create, drop, and list databases +// * update the schema of pre-existing databases +// * create, delete and list backups for a database +// * restore a database from an existing backup service DatabaseAdmin { option (google.api.default_host) = "spanner.googleapis.com"; option (google.api.oauth_scopes) = @@ -110,6 +112,8 @@ service DatabaseAdmin { // Drops (aka deletes) a Cloud Spanner database. // Completed backups for the database will be retained according to their // `expire_time`. + // Note: Cloud Spanner might continue to accept requests for a few seconds + // after the database has been deleted. rpc DropDatabase(DropDatabaseRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/{database=projects/*/instances/*/databases/*}" @@ -407,6 +411,9 @@ message Database { // database option set using DatabaseAdmin.CreateDatabase or // DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. string default_leader = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The dialect of the Cloud Spanner Database. + DatabaseDialect database_dialect = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; } // The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases]. @@ -469,6 +476,9 @@ message CreateDatabaseRequest { // specified, Cloud Spanner will encrypt/decrypt all data at rest using // Google default encryption. EncryptionConfig encryption_config = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The dialect of the Cloud Spanner Database. + DatabaseDialect database_dialect = 5 [(google.api.field_behavior) = OPTIONAL]; } // Metadata type for the operation returned by diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index a323f644fe1..3df1e39b291 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.17.4 + 6.18.0 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.17.4 + 6.18.0 diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index 7e37d812a9a..4229203912a 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.17.4 + 6.18.0 proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.17.4 + 6.18.0 diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java index 1c3c7790028..8079a480ee1 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java @@ -146,9 +146,9 @@ public interface CommitStatsOrBuilder * `mutation_count` value can help you maximize the number of mutations * in a transaction and minimize the number of API round trips. You can * also monitor this value to prevent transactions from exceeding the system - * [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). * * * int64 mutation_count = 1; @@ -256,9 +256,9 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { * `mutation_count` value can help you maximize the number of mutations * in a transaction and minimize the number of API round trips. You can * also monitor this value to prevent transactions from exceeding the system - * [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). * * * int64 mutation_count = 1; @@ -600,9 +600,9 @@ public Builder mergeFrom( * `mutation_count` value can help you maximize the number of mutations * in a transaction and minimize the number of API round trips. You can * also monitor this value to prevent transactions from exceeding the system - * [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). * * * int64 mutation_count = 1; @@ -621,9 +621,9 @@ public long getMutationCount() { * `mutation_count` value can help you maximize the number of mutations * in a transaction and minimize the number of API round trips. You can * also monitor this value to prevent transactions from exceeding the system - * [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). * * * int64 mutation_count = 1; @@ -645,9 +645,9 @@ public Builder setMutationCount(long value) { * `mutation_count` value can help you maximize the number of mutations * in a transaction and minimize the number of API round trips. You can * also monitor this value to prevent transactions from exceeding the system - * [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + * [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). * If the number of mutations exceeds the limit, the server returns - * [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + * [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). * * * int64 mutation_count = 1; diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java index bf45b642047..e093354a31b 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java @@ -45,9 +45,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\'google/spanner/v1/commit_response.prot" - + "o\022\021google.spanner.v1\032\036google/protobuf/du" - + "ration.proto\032\037google/protobuf/timestamp." - + "proto\032\034google/api/annotations.proto\"\262\001\n\016" + + "o\022\021google.spanner.v1\032\034google/api/annotat" + + "ions.proto\032\036google/protobuf/duration.pro" + + "to\032\037google/protobuf/timestamp.proto\"\262\001\n\016" + "CommitResponse\0224\n\020commit_timestamp\030\001 \001(\013" + "2\032.google.protobuf.Timestamp\022C\n\014commit_s" + "tats\030\002 \001(\0132-.google.spanner.v1.CommitRes" @@ -63,9 +63,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_spanner_v1_CommitResponse_descriptor = getDescriptor().getMessageTypes().get(0); @@ -83,9 +83,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "MutationCount", }); + com.google.api.AnnotationsProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeysProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeysProto.java index 9c9b6318d17..6c95c92573d 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeysProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeysProto.java @@ -45,8 +45,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\034google/spanner/v1/keys.proto\022\021google.s" - + "panner.v1\032\034google/protobuf/struct.proto\032" - + "\034google/api/annotations.proto\"\364\001\n\010KeyRan" + + "panner.v1\032\034google/api/annotations.proto\032" + + "\034google/protobuf/struct.proto\"\364\001\n\010KeyRan" + "ge\0222\n\014start_closed\030\001 \001(\0132\032.google.protob" + "uf.ListValueH\000\0220\n\nstart_open\030\002 \001(\0132\032.goo" + "gle.protobuf.ListValueH\000\0220\n\nend_closed\030\003" @@ -66,8 +66,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.protobuf.StructProto.getDescriptor(), com.google.api.AnnotationsProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), }); internal_static_google_spanner_v1_KeyRange_descriptor = getDescriptor().getMessageTypes().get(0); @@ -84,8 +84,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Keys", "Ranges", "All", }); - com.google.protobuf.StructProto.getDescriptor(); com.google.api.AnnotationsProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MutationProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MutationProto.java index 27ce2b4f3ae..f7e439f86f0 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MutationProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MutationProto.java @@ -49,9 +49,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n google/spanner/v1/mutation.proto\022\021goog" - + "le.spanner.v1\032\034google/protobuf/struct.pr" - + "oto\032\034google/spanner/v1/keys.proto\032\034googl" - + "e/api/annotations.proto\"\306\003\n\010Mutation\0223\n\006" + + "le.spanner.v1\032\034google/api/annotations.pr" + + "oto\032\034google/protobuf/struct.proto\032\034googl" + + "e/spanner/v1/keys.proto\"\306\003\n\010Mutation\0223\n\006" + "insert\030\001 \001(\0132!.google.spanner.v1.Mutatio" + "n.WriteH\000\0223\n\006update\030\002 \001(\0132!.google.spann" + "er.v1.Mutation.WriteH\000\022=\n\020insert_or_upda" @@ -73,9 +73,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), com.google.spanner.v1.KeysProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_spanner_v1_Mutation_descriptor = getDescriptor().getMessageTypes().get(0); @@ -101,9 +101,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Table", "KeySet", }); + com.google.api.AnnotationsProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); com.google.spanner.v1.KeysProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlanProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlanProto.java index 03c05431d05..0a9d2b3583d 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlanProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlanProto.java @@ -57,8 +57,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\"google/spanner/v1/query_plan.proto\022\021go" - + "ogle.spanner.v1\032\034google/protobuf/struct." - + "proto\032\034google/api/annotations.proto\"\370\004\n\010" + + "ogle.spanner.v1\032\034google/api/annotations." + + "proto\032\034google/protobuf/struct.proto\"\370\004\n\010" + "PlanNode\022\r\n\005index\030\001 \001(\005\022.\n\004kind\030\002 \001(\0162 ." + "google.spanner.v1.PlanNode.Kind\022\024\n\014displ" + "ay_name\030\003 \001(\t\022:\n\013child_links\030\004 \003(\0132%.goo" @@ -87,8 +87,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.protobuf.StructProto.getDescriptor(), com.google.api.AnnotationsProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), }); internal_static_google_spanner_v1_PlanNode_descriptor = getDescriptor().getMessageTypes().get(0); @@ -138,8 +138,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "PlanNodes", }); - com.google.protobuf.StructProto.getDescriptor(); com.google.api.AnnotationsProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptions.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptions.java index c291d2b0176..f915ca2d64d 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptions.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptions.java @@ -370,6 +370,7 @@ public com.google.spanner.v1.RequestOptions.Priority getPriority() { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -401,6 +402,7 @@ public java.lang.String getRequestTag() { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -431,11 +433,12 @@ public com.google.protobuf.ByteString getRequestTagBytes() { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -463,11 +466,12 @@ public java.lang.String getTransactionTag() { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -938,6 +942,7 @@ public Builder clearPriority() { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -968,6 +973,7 @@ public java.lang.String getRequestTag() { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -998,6 +1004,7 @@ public com.google.protobuf.ByteString getRequestTagBytes() { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -1027,6 +1034,7 @@ public Builder setRequestTag(java.lang.String value) { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -1052,6 +1060,7 @@ public Builder clearRequestTag() { * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -1080,11 +1089,12 @@ public Builder setRequestTagBytes(com.google.protobuf.ByteString value) { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -1111,11 +1121,12 @@ public java.lang.String getTransactionTag() { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -1142,11 +1153,12 @@ public com.google.protobuf.ByteString getTransactionTagBytes() { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -1172,11 +1184,12 @@ public Builder setTransactionTag(java.lang.String value) { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -1198,11 +1211,12 @@ public Builder clearTransactionTag() { * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptionsOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptionsOrBuilder.java index a0805252ac5..c2c12f4a0b1 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptionsOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RequestOptionsOrBuilder.java @@ -61,6 +61,7 @@ public interface RequestOptionsOrBuilder * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -81,6 +82,7 @@ public interface RequestOptionsOrBuilder * Legal characters for `request_tag` values are all printable characters * (ASCII 32 - 126) and the length of a request_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string request_tag = 2; @@ -98,11 +100,12 @@ public interface RequestOptionsOrBuilder * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; @@ -119,11 +122,12 @@ public interface RequestOptionsOrBuilder * that belongs to a transaction. * The value of transaction_tag should be the same for all requests belonging * to the same transaction. - * If this request doesn’t belong to any transaction, transaction_tag will be + * If this request doesn't belong to any transaction, transaction_tag will be * ignored. * Legal characters for `transaction_tag` values are all printable characters * (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 * characters. Values that exceed this limit are truncated. + * Any leading underscore (_) characters will be removed from the string. * * * string transaction_tag = 3; diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java index 48157af205c..e6b22d02d80 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java @@ -53,43 +53,45 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\"google/spanner/v1/result_set.proto\022\021go" - + "ogle.spanner.v1\032\034google/protobuf/struct." - + "proto\032\"google/spanner/v1/query_plan.prot" - + "o\032#google/spanner/v1/transaction.proto\032\034" - + "google/spanner/v1/type.proto\032\034google/api" - + "/annotations.proto\"\237\001\n\tResultSet\0226\n\010meta" - + "data\030\001 \001(\0132$.google.spanner.v1.ResultSet" - + "Metadata\022(\n\004rows\030\002 \003(\0132\032.google.protobuf" - + ".ListValue\0220\n\005stats\030\003 \001(\0132!.google.spann" - + "er.v1.ResultSetStats\"\321\001\n\020PartialResultSe" - + "t\0226\n\010metadata\030\001 \001(\0132$.google.spanner.v1." - + "ResultSetMetadata\022&\n\006values\030\002 \003(\0132\026.goog" - + "le.protobuf.Value\022\025\n\rchunked_value\030\003 \001(\010" - + "\022\024\n\014resume_token\030\004 \001(\014\0220\n\005stats\030\005 \001(\0132!." - + "google.spanner.v1.ResultSetStats\"y\n\021Resu" - + "ltSetMetadata\022/\n\010row_type\030\001 \001(\0132\035.google" - + ".spanner.v1.StructType\0223\n\013transaction\030\002 " - + "\001(\0132\036.google.spanner.v1.Transaction\"\271\001\n\016" - + "ResultSetStats\0220\n\nquery_plan\030\001 \001(\0132\034.goo" - + "gle.spanner.v1.QueryPlan\022,\n\013query_stats\030" - + "\002 \001(\0132\027.google.protobuf.Struct\022\031\n\017row_co" - + "unt_exact\030\003 \001(\003H\000\022\037\n\025row_count_lower_bou" - + "nd\030\004 \001(\003H\000B\013\n\trow_countB\267\001\n\025com.google.s" - + "panner.v1B\016ResultSetProtoP\001Z8google.gola" - + "ng.org/genproto/googleapis/spanner/v1;sp" - + "anner\370\001\001\252\002\027Google.Cloud.Spanner.V1\312\002\027Goo" - + "gle\\Cloud\\Spanner\\V1\352\002\032Google::Cloud::Sp" - + "anner::V1b\006proto3" + + "ogle.spanner.v1\032\034google/api/annotations." + + "proto\032\034google/protobuf/struct.proto\032\'goo" + + "gle/spanner/v1/commit_response.proto\032\"go" + + "ogle/spanner/v1/query_plan.proto\032#google" + + "/spanner/v1/transaction.proto\032\034google/sp" + + "anner/v1/type.proto\"\237\001\n\tResultSet\0226\n\010met" + + "adata\030\001 \001(\0132$.google.spanner.v1.ResultSe" + + "tMetadata\022(\n\004rows\030\002 \003(\0132\032.google.protobu" + + "f.ListValue\0220\n\005stats\030\003 \001(\0132!.google.span" + + "ner.v1.ResultSetStats\"\321\001\n\020PartialResultS" + + "et\0226\n\010metadata\030\001 \001(\0132$.google.spanner.v1" + + ".ResultSetMetadata\022&\n\006values\030\002 \003(\0132\026.goo" + + "gle.protobuf.Value\022\025\n\rchunked_value\030\003 \001(" + + "\010\022\024\n\014resume_token\030\004 \001(\014\0220\n\005stats\030\005 \001(\0132!" + + ".google.spanner.v1.ResultSetStats\"y\n\021Res" + + "ultSetMetadata\022/\n\010row_type\030\001 \001(\0132\035.googl" + + "e.spanner.v1.StructType\0223\n\013transaction\030\002" + + " \001(\0132\036.google.spanner.v1.Transaction\"\271\001\n" + + "\016ResultSetStats\0220\n\nquery_plan\030\001 \001(\0132\034.go" + + "ogle.spanner.v1.QueryPlan\022,\n\013query_stats" + + "\030\002 \001(\0132\027.google.protobuf.Struct\022\031\n\017row_c" + + "ount_exact\030\003 \001(\003H\000\022\037\n\025row_count_lower_bo" + + "und\030\004 \001(\003H\000B\013\n\trow_countB\267\001\n\025com.google." + + "spanner.v1B\016ResultSetProtoP\001Z8google.gol" + + "ang.org/genproto/googleapis/spanner/v1;s" + + "panner\370\001\001\252\002\027Google.Cloud.Spanner.V1\312\002\027Go" + + "ogle\\Cloud\\Spanner\\V1\352\002\032Google::Cloud::S" + + "panner::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), + com.google.spanner.v1.CommitResponseProto.getDescriptor(), com.google.spanner.v1.QueryPlanProto.getDescriptor(), com.google.spanner.v1.TransactionProto.getDescriptor(), com.google.spanner.v1.TypeProto.getDescriptor(), - com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_spanner_v1_ResultSet_descriptor = getDescriptor().getMessageTypes().get(0); @@ -123,11 +125,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "QueryPlan", "QueryStats", "RowCountExact", "RowCountLowerBound", "RowCount", }); + com.google.api.AnnotationsProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); + com.google.spanner.v1.CommitResponseProto.getDescriptor(); com.google.spanner.v1.QueryPlanProto.getDescriptor(); com.google.spanner.v1.TransactionProto.getDescriptor(); com.google.spanner.v1.TypeProto.getDescriptor(); - com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java index 6db08efbb3a..3fbfef6ea9a 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java @@ -145,13 +145,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\037google/spanner/v1/spanner.proto\022\021googl" - + "e.spanner.v1\032\'google/spanner/v1/commit_r" - + "esponse.proto\032\034google/api/annotations.pr" - + "oto\032\027google/api/client.proto\032\037google/api" - + "/field_behavior.proto\032\031google/api/resour" - + "ce.proto\032\033google/protobuf/empty.proto\032\034g" - + "oogle/protobuf/struct.proto\032\037google/prot" - + "obuf/timestamp.proto\032\027google/rpc/status." + + "e.spanner.v1\032\034google/api/annotations.pro" + + "to\032\027google/api/client.proto\032\037google/api/" + + "field_behavior.proto\032\031google/api/resourc" + + "e.proto\032\033google/protobuf/empty.proto\032\034go" + + "ogle/protobuf/struct.proto\032\037google/proto" + + "buf/timestamp.proto\032\027google/rpc/status.p" + + "roto\032\'google/spanner/v1/commit_response." + "proto\032\034google/spanner/v1/keys.proto\032 goo" + "gle/spanner/v1/mutation.proto\032\"google/sp" + "anner/v1/result_set.proto\032#google/spanne" @@ -353,13 +353,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "Spanner\\V1\352\002\032Google::Cloud::Spanner::V1\352" + "A_\n\037spanner.googleapis.com/Database\022 - * # Transactions + * Transactions: * Each session can have at most one active transaction at a time (note that * standalone reads and queries use a transaction internally and do count * towards the one transaction limit). After the active transaction is * completed, the session can immediately be re-used for the next transaction. * It is not necessary to create a new session for each transaction. - * # Transaction Modes + * Transaction Modes: * Cloud Spanner supports three transaction modes: * 1. Locking read-write. This type of transaction is the only way * to write data into Cloud Spanner. These transactions rely on @@ -54,7 +54,7 @@ * Transactions may only read/write data in a single database. They * may, however, read/write data in different tables within that * database. - * ## Locking Read-Write Transactions + * Locking Read-Write Transactions: * Locking transactions may be used to atomically read-modify-write * data anywhere in a database. This type of transaction is externally * consistent. @@ -73,7 +73,7 @@ * [Commit][google.spanner.v1.Spanner.Commit], the client can send a * [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the * transaction. - * ## Semantics + * Semantics: * Cloud Spanner can commit the transaction if all read locks it acquired * are still valid at commit time, and it is able to acquire write * locks for all writes. Cloud Spanner can abort the transaction for any @@ -83,29 +83,29 @@ * how long the transaction's locks were held for. It is an error to * use Cloud Spanner locks for any sort of mutual exclusion other than * between Cloud Spanner transactions themselves. - * ## Retrying Aborted Transactions + * Retrying Aborted Transactions: * When a transaction aborts, the application can choose to retry the * whole transaction again. To maximize the chances of successfully * committing the retry, the client should execute the retry in the * same session as the original attempt. The original session's lock * priority increases with each consecutive abort, meaning that each * attempt has a slightly better chance of success than the previous. - * Under some circumstances (e.g., many transactions attempting to + * Under some circumstances (for example, many transactions attempting to * modify the same row(s)), a transaction can abort many times in a * short period before successfully committing. Thus, it is not a good * idea to cap the number of retries a transaction can attempt; - * instead, it is better to limit the total amount of wall time spent + * instead, it is better to limit the total amount of time spent * retrying. - * ## Idle Transactions + * Idle Transactions: * A transaction is considered idle if it has no outstanding reads or * SQL queries and has not started a read or SQL query within the last 10 * seconds. Idle transactions can be aborted by Cloud Spanner so that they - * don't hold on to locks indefinitely. In that case, the commit will - * fail with error `ABORTED`. + * don't hold on to locks indefinitely. If an idle transaction is aborted, the + * commit will fail with error `ABORTED`. * If this behavior is undesirable, periodically executing a simple - * SQL query in the transaction (e.g., `SELECT 1`) prevents the + * SQL query in the transaction (for example, `SELECT 1`) prevents the * transaction from becoming idle. - * ## Snapshot Read-Only Transactions + * Snapshot Read-Only Transactions: * Snapshot read-only transactions provides a simpler method than * locking read-write transactions for doing several consistent * reads. However, this type of transaction does not support writes. @@ -133,7 +133,7 @@ * or read-write transaction, because they are able to execute far * from the leader replica. * Each type of timestamp bound is discussed in detail below. - * ## Strong + * Strong: * Strong reads are guaranteed to see the effects of all transactions * that have committed before the start of the read. Furthermore, all * rows yielded by a single read are consistent with each other -- if @@ -145,12 +145,12 @@ * reads should be executed within a transaction or at an exact read * timestamp. * See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. - * ## Exact Staleness + * Exact Staleness: * These timestamp bounds execute reads at a user-specified * timestamp. Reads at a timestamp are guaranteed to see a consistent * prefix of the global transaction history: they observe - * modifications done by all transactions with a commit timestamp <= - * the read timestamp, and observe none of the modifications done by + * modifications done by all transactions with a commit timestamp less than or + * equal to the read timestamp, and observe none of the modifications done by * transactions with a larger commit timestamp. They will block until * all conflicting transactions that may be assigned commit timestamps * <= the read timestamp have finished. @@ -162,7 +162,7 @@ * boundedly stale reads usually return fresher results. * See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and * [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness]. - * ## Bounded Staleness + * Bounded Staleness: * Bounded staleness modes allow Cloud Spanner to pick the read timestamp, * subject to a user-provided staleness bound. Cloud Spanner chooses the * newest timestamp within the staleness bound that allows execution @@ -185,7 +185,7 @@ * read-only transactions. * See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and * [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp]. - * ## Old Read Timestamps and Garbage Collection + * Old Read Timestamps and Garbage Collection: * Cloud Spanner continuously garbage collects deleted and overwritten data * in the background to reclaim storage space. This process is known * as "version GC". By default, version GC reclaims versions after they @@ -194,7 +194,7 @@ * restriction also applies to in-progress reads and/or SQL queries whose * timestamp become too old while executing. Reads and SQL queries with * too-old read timestamps fail with the error `FAILED_PRECONDITION`. - * ## Partitioned DML Transactions + * Partitioned DML Transactions: * Partitioned DML transactions are used to execute DML statements with a * different execution strategy that provides different, and often better, * scalability properties for large, table-wide operations than DML in a @@ -4356,13 +4356,13 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build * * *
-   * # Transactions
+   * Transactions:
    * Each session can have at most one active transaction at a time (note that
    * standalone reads and queries use a transaction internally and do count
    * towards the one transaction limit). After the active transaction is
    * completed, the session can immediately be re-used for the next transaction.
    * It is not necessary to create a new session for each transaction.
-   * # Transaction Modes
+   * Transaction Modes:
    * Cloud Spanner supports three transaction modes:
    *   1. Locking read-write. This type of transaction is the only way
    *      to write data into Cloud Spanner. These transactions rely on
@@ -4388,7 +4388,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * Transactions may only read/write data in a single database. They
    * may, however, read/write data in different tables within that
    * database.
-   * ## Locking Read-Write Transactions
+   * Locking Read-Write Transactions:
    * Locking transactions may be used to atomically read-modify-write
    * data anywhere in a database. This type of transaction is externally
    * consistent.
@@ -4407,7 +4407,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * [Commit][google.spanner.v1.Spanner.Commit], the client can send a
    * [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the
    * transaction.
-   * ## Semantics
+   * Semantics:
    * Cloud Spanner can commit the transaction if all read locks it acquired
    * are still valid at commit time, and it is able to acquire write
    * locks for all writes. Cloud Spanner can abort the transaction for any
@@ -4417,29 +4417,29 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * how long the transaction's locks were held for. It is an error to
    * use Cloud Spanner locks for any sort of mutual exclusion other than
    * between Cloud Spanner transactions themselves.
-   * ## Retrying Aborted Transactions
+   * Retrying Aborted Transactions:
    * When a transaction aborts, the application can choose to retry the
    * whole transaction again. To maximize the chances of successfully
    * committing the retry, the client should execute the retry in the
    * same session as the original attempt. The original session's lock
    * priority increases with each consecutive abort, meaning that each
    * attempt has a slightly better chance of success than the previous.
-   * Under some circumstances (e.g., many transactions attempting to
+   * Under some circumstances (for example, many transactions attempting to
    * modify the same row(s)), a transaction can abort many times in a
    * short period before successfully committing. Thus, it is not a good
    * idea to cap the number of retries a transaction can attempt;
-   * instead, it is better to limit the total amount of wall time spent
+   * instead, it is better to limit the total amount of time spent
    * retrying.
-   * ## Idle Transactions
+   * Idle Transactions:
    * A transaction is considered idle if it has no outstanding reads or
    * SQL queries and has not started a read or SQL query within the last 10
    * seconds. Idle transactions can be aborted by Cloud Spanner so that they
-   * don't hold on to locks indefinitely. In that case, the commit will
-   * fail with error `ABORTED`.
+   * don't hold on to locks indefinitely. If an idle transaction is aborted, the
+   * commit will fail with error `ABORTED`.
    * If this behavior is undesirable, periodically executing a simple
-   * SQL query in the transaction (e.g., `SELECT 1`) prevents the
+   * SQL query in the transaction (for example, `SELECT 1`) prevents the
    * transaction from becoming idle.
-   * ## Snapshot Read-Only Transactions
+   * Snapshot Read-Only Transactions:
    * Snapshot read-only transactions provides a simpler method than
    * locking read-write transactions for doing several consistent
    * reads. However, this type of transaction does not support writes.
@@ -4467,7 +4467,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * or read-write transaction, because they are able to execute far
    * from the leader replica.
    * Each type of timestamp bound is discussed in detail below.
-   * ## Strong
+   * Strong:
    * Strong reads are guaranteed to see the effects of all transactions
    * that have committed before the start of the read. Furthermore, all
    * rows yielded by a single read are consistent with each other -- if
@@ -4479,12 +4479,12 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * reads should be executed within a transaction or at an exact read
    * timestamp.
    * See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong].
-   * ## Exact Staleness
+   * Exact Staleness:
    * These timestamp bounds execute reads at a user-specified
    * timestamp. Reads at a timestamp are guaranteed to see a consistent
    * prefix of the global transaction history: they observe
-   * modifications done by all transactions with a commit timestamp <=
-   * the read timestamp, and observe none of the modifications done by
+   * modifications done by all transactions with a commit timestamp less than or
+   * equal to the read timestamp, and observe none of the modifications done by
    * transactions with a larger commit timestamp. They will block until
    * all conflicting transactions that may be assigned commit timestamps
    * <= the read timestamp have finished.
@@ -4496,7 +4496,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * boundedly stale reads usually return fresher results.
    * See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and
    * [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness].
-   * ## Bounded Staleness
+   * Bounded Staleness:
    * Bounded staleness modes allow Cloud Spanner to pick the read timestamp,
    * subject to a user-provided staleness bound. Cloud Spanner chooses the
    * newest timestamp within the staleness bound that allows execution
@@ -4519,7 +4519,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * read-only transactions.
    * See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and
    * [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp].
-   * ## Old Read Timestamps and Garbage Collection
+   * Old Read Timestamps and Garbage Collection:
    * Cloud Spanner continuously garbage collects deleted and overwritten data
    * in the background to reclaim storage space. This process is known
    * as "version GC". By default, version GC reclaims versions after they
@@ -4528,7 +4528,7 @@ protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.Build
    * restriction also applies to in-progress reads and/or SQL queries whose
    * timestamp become too old while executing. Reads and SQL queries with
    * too-old read timestamps fail with the error `FAILED_PRECONDITION`.
-   * ## Partitioned DML Transactions
+   * Partitioned DML Transactions:
    * Partitioned DML transactions are used to execute DML statements with a
    * different execution strategy that provides different, and often better,
    * scalability properties for large, table-wide operations than DML in a
diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java
index b3330eeacb1..2655d8e0fb4 100644
--- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java
+++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java
@@ -61,9 +61,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
   static {
     java.lang.String[] descriptorData = {
       "\n#google/spanner/v1/transaction.proto\022\021g"
-          + "oogle.spanner.v1\032\036google/protobuf/durati"
-          + "on.proto\032\037google/protobuf/timestamp.prot"
-          + "o\032\034google/api/annotations.proto\"\303\004\n\022Tran"
+          + "oogle.spanner.v1\032\034google/api/annotations"
+          + ".proto\032\036google/protobuf/duration.proto\032\037"
+          + "google/protobuf/timestamp.proto\"\303\004\n\022Tran"
           + "sactionOptions\022E\n\nread_write\030\001 \001(\0132/.goo"
           + "gle.spanner.v1.TransactionOptions.ReadWr"
           + "iteH\000\022O\n\017partitioned_dml\030\003 \001(\01324.google."
@@ -95,9 +95,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
         com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
             descriptorData,
             new com.google.protobuf.Descriptors.FileDescriptor[] {
+              com.google.api.AnnotationsProto.getDescriptor(),
               com.google.protobuf.DurationProto.getDescriptor(),
               com.google.protobuf.TimestampProto.getDescriptor(),
-              com.google.api.AnnotationsProto.getDescriptor(),
             });
     internal_static_google_spanner_v1_TransactionOptions_descriptor =
         getDescriptor().getMessageTypes().get(0);
@@ -149,9 +149,9 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
             new java.lang.String[] {
               "SingleUse", "Id", "Begin", "Selector",
             });
+    com.google.api.AnnotationsProto.getDescriptor();
     com.google.protobuf.DurationProto.getDescriptor();
     com.google.protobuf.TimestampProto.getDescriptor();
-    com.google.api.AnnotationsProto.getDescriptor();
   }
 
   // @@protoc_insertion_point(outer_class_scope)
diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Type.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Type.java
index f02ccb4e134..be8ca8f5e9f 100644
--- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Type.java
+++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Type.java
@@ -40,6 +40,7 @@ private Type(com.google.protobuf.GeneratedMessageV3.Builder builder) {
 
   private Type() {
     code_ = 0;
+    typeAnnotation_ = 0;
   }
 
   @java.lang.Override
@@ -106,6 +107,13 @@ private Type(
                 structType_ = subBuilder.buildPartial();
               }
 
+              break;
+            }
+          case 32:
+            {
+              int rawValue = input.readEnum();
+
+              typeAnnotation_ = rawValue;
               break;
             }
           default:
@@ -276,6 +284,52 @@ public com.google.spanner.v1.StructTypeOrBuilder getStructTypeOrBuilder() {
     return getStructType();
   }
 
+  public static final int TYPE_ANNOTATION_FIELD_NUMBER = 4;
+  private int typeAnnotation_;
+  /**
+   *
+   *
+   * 
+   * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+   * use to represent values of this type during query processing. This is
+   * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+   * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+   * typically is not needed to process the content of a value (it doesn't
+   * affect serialization) and clients can ignore it on the read path.
+   * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return The enum numeric value on the wire for typeAnnotation. + */ + @java.lang.Override + public int getTypeAnnotationValue() { + return typeAnnotation_; + } + /** + * + * + *
+   * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+   * use to represent values of this type during query processing. This is
+   * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+   * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+   * typically is not needed to process the content of a value (it doesn't
+   * affect serialization) and clients can ignore it on the read path.
+   * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return The typeAnnotation. + */ + @java.lang.Override + public com.google.spanner.v1.TypeAnnotationCode getTypeAnnotation() { + @SuppressWarnings("deprecation") + com.google.spanner.v1.TypeAnnotationCode result = + com.google.spanner.v1.TypeAnnotationCode.valueOf(typeAnnotation_); + return result == null ? com.google.spanner.v1.TypeAnnotationCode.UNRECOGNIZED : result; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -299,6 +353,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (structType_ != null) { output.writeMessage(3, getStructType()); } + if (typeAnnotation_ + != com.google.spanner.v1.TypeAnnotationCode.TYPE_ANNOTATION_CODE_UNSPECIFIED.getNumber()) { + output.writeEnum(4, typeAnnotation_); + } unknownFields.writeTo(output); } @@ -317,6 +375,10 @@ public int getSerializedSize() { if (structType_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getStructType()); } + if (typeAnnotation_ + != com.google.spanner.v1.TypeAnnotationCode.TYPE_ANNOTATION_CODE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, typeAnnotation_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -341,6 +403,7 @@ public boolean equals(final java.lang.Object obj) { if (hasStructType()) { if (!getStructType().equals(other.getStructType())) return false; } + if (typeAnnotation_ != other.typeAnnotation_) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -362,6 +425,8 @@ public int hashCode() { hash = (37 * hash) + STRUCT_TYPE_FIELD_NUMBER; hash = (53 * hash) + getStructType().hashCode(); } + hash = (37 * hash) + TYPE_ANNOTATION_FIELD_NUMBER; + hash = (53 * hash) + typeAnnotation_; hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -519,6 +584,8 @@ public Builder clear() { structType_ = null; structTypeBuilder_ = null; } + typeAnnotation_ = 0; + return this; } @@ -555,6 +622,7 @@ public com.google.spanner.v1.Type buildPartial() { } else { result.structType_ = structTypeBuilder_.build(); } + result.typeAnnotation_ = typeAnnotation_; onBuilt(); return result; } @@ -613,6 +681,9 @@ public Builder mergeFrom(com.google.spanner.v1.Type other) { if (other.hasStructType()) { mergeStructType(other.getStructType()); } + if (other.typeAnnotation_ != 0) { + setTypeAnnotationValue(other.getTypeAnnotationValue()); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1120,6 +1191,122 @@ public com.google.spanner.v1.StructTypeOrBuilder getStructTypeOrBuilder() { return structTypeBuilder_; } + private int typeAnnotation_ = 0; + /** + * + * + *
+     * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+     * use to represent values of this type during query processing. This is
+     * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+     * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+     * typically is not needed to process the content of a value (it doesn't
+     * affect serialization) and clients can ignore it on the read path.
+     * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return The enum numeric value on the wire for typeAnnotation. + */ + @java.lang.Override + public int getTypeAnnotationValue() { + return typeAnnotation_; + } + /** + * + * + *
+     * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+     * use to represent values of this type during query processing. This is
+     * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+     * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+     * typically is not needed to process the content of a value (it doesn't
+     * affect serialization) and clients can ignore it on the read path.
+     * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @param value The enum numeric value on the wire for typeAnnotation to set. + * @return This builder for chaining. + */ + public Builder setTypeAnnotationValue(int value) { + + typeAnnotation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+     * use to represent values of this type during query processing. This is
+     * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+     * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+     * typically is not needed to process the content of a value (it doesn't
+     * affect serialization) and clients can ignore it on the read path.
+     * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return The typeAnnotation. + */ + @java.lang.Override + public com.google.spanner.v1.TypeAnnotationCode getTypeAnnotation() { + @SuppressWarnings("deprecation") + com.google.spanner.v1.TypeAnnotationCode result = + com.google.spanner.v1.TypeAnnotationCode.valueOf(typeAnnotation_); + return result == null ? com.google.spanner.v1.TypeAnnotationCode.UNRECOGNIZED : result; + } + /** + * + * + *
+     * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+     * use to represent values of this type during query processing. This is
+     * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+     * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+     * typically is not needed to process the content of a value (it doesn't
+     * affect serialization) and clients can ignore it on the read path.
+     * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @param value The typeAnnotation to set. + * @return This builder for chaining. + */ + public Builder setTypeAnnotation(com.google.spanner.v1.TypeAnnotationCode value) { + if (value == null) { + throw new NullPointerException(); + } + + typeAnnotation_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+     * use to represent values of this type during query processing. This is
+     * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+     * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+     * typically is not needed to process the content of a value (it doesn't
+     * affect serialization) and clients can ignore it on the read path.
+     * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return This builder for chaining. + */ + public Builder clearTypeAnnotation() { + + typeAnnotation_ = 0; + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeAnnotationCode.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeAnnotationCode.java new file mode 100644 index 00000000000..944ab742a17 --- /dev/null +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeAnnotationCode.java @@ -0,0 +1,170 @@ +/* + * 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/type.proto + +package com.google.spanner.v1; + +/** + * + * + *
+ * `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to
+ * disambiguate SQL types that should be used for a given Cloud Spanner value.
+ * Disambiguation is needed because the same Cloud Spanner type can be mapped to
+ * different SQL types depending on SQL dialect. TypeAnnotationCode doesn't
+ * affect the way value is serialized.
+ * 
+ * + * Protobuf enum {@code google.spanner.v1.TypeAnnotationCode} + */ +public enum TypeAnnotationCode implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Not specified.
+   * 
+ * + * TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; + */ + TYPE_ANNOTATION_CODE_UNSPECIFIED(0), + /** + * + * + *
+   * PostgreSQL compatible NUMERIC type. This annotation needs to be applied to
+   * [Type][google.spanner.v1.Type] instances having [NUMERIC][google.spanner.v1.TypeCode.NUMERIC]
+   * type code to specify that values of this type should be treated as
+   * PostgreSQL NUMERIC values. Currently this annotation is always needed for
+   * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with PostgreSQL-enabled
+   * Spanner databases.
+   * 
+ * + * PG_NUMERIC = 2; + */ + PG_NUMERIC(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Not specified.
+   * 
+ * + * TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; + */ + public static final int TYPE_ANNOTATION_CODE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * PostgreSQL compatible NUMERIC type. This annotation needs to be applied to
+   * [Type][google.spanner.v1.Type] instances having [NUMERIC][google.spanner.v1.TypeCode.NUMERIC]
+   * type code to specify that values of this type should be treated as
+   * PostgreSQL NUMERIC values. Currently this annotation is always needed for
+   * [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with PostgreSQL-enabled
+   * Spanner databases.
+   * 
+ * + * PG_NUMERIC = 2; + */ + public static final int PG_NUMERIC_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TypeAnnotationCode valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static TypeAnnotationCode forNumber(int value) { + switch (value) { + case 0: + return TYPE_ANNOTATION_CODE_UNSPECIFIED; + case 2: + return PG_NUMERIC; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public TypeAnnotationCode findValueByNumber(int number) { + return TypeAnnotationCode.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.spanner.v1.TypeProto.getDescriptor().getEnumTypes().get(1); + } + + private static final TypeAnnotationCode[] VALUES = values(); + + public static TypeAnnotationCode valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private TypeAnnotationCode(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.spanner.v1.TypeAnnotationCode) +} diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java index 1fc2b42ef8e..4b6561e9def 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java @@ -165,13 +165,13 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum { * * *
-   * Encoded as a JSON-formatted 'string' as described in RFC 7159. The
-   * following rules will be applied when parsing JSON input:
-   * - Whitespace will be stripped from the document.
-   * - If a JSON object has duplicate keys, only the first key will be
-   *   preserved.
+   * Encoded as a JSON-formatted `string` as described in RFC 7159. The
+   * following rules are applied when parsing JSON input:
+   * - Whitespace characters are not preserved.
+   * - If a JSON object has duplicate keys, only the first key is preserved.
    * - Members of a JSON object are not guaranteed to have their order
-   *   preserved. JSON array elements will have their order preserved.
+   *   preserved.
+   * - JSON array elements will have their order preserved.
    * 
* * JSON = 11; @@ -312,13 +312,13 @@ public enum TypeCode implements com.google.protobuf.ProtocolMessageEnum { * * *
-   * Encoded as a JSON-formatted 'string' as described in RFC 7159. The
-   * following rules will be applied when parsing JSON input:
-   * - Whitespace will be stripped from the document.
-   * - If a JSON object has duplicate keys, only the first key will be
-   *   preserved.
+   * Encoded as a JSON-formatted `string` as described in RFC 7159. The
+   * following rules are applied when parsing JSON input:
+   * - Whitespace characters are not preserved.
+   * - If a JSON object has duplicate keys, only the first key is preserved.
    * - Members of a JSON object are not guaranteed to have their order
-   *   preserved. JSON array elements will have their order preserved.
+   *   preserved.
+   * - JSON array elements will have their order preserved.
    * 
* * JSON = 11; diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeOrBuilder.java index bd37d1e7d23..4c78a470d6d 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeOrBuilder.java @@ -123,4 +123,39 @@ public interface TypeOrBuilder * .google.spanner.v1.StructType struct_type = 3; */ com.google.spanner.v1.StructTypeOrBuilder getStructTypeOrBuilder(); + + /** + * + * + *
+   * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+   * use to represent values of this type during query processing. This is
+   * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+   * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+   * typically is not needed to process the content of a value (it doesn't
+   * affect serialization) and clients can ignore it on the read path.
+   * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return The enum numeric value on the wire for typeAnnotation. + */ + int getTypeAnnotationValue(); + /** + * + * + *
+   * The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will
+   * use to represent values of this type during query processing. This is
+   * necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped
+   * to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation]
+   * typically is not needed to process the content of a value (it doesn't
+   * affect serialization) and clients can ignore it on the read path.
+   * 
+ * + * .google.spanner.v1.TypeAnnotationCode type_annotation = 4; + * + * @return The typeAnnotation. + */ + com.google.spanner.v1.TypeAnnotationCode getTypeAnnotation(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java index e781dc621a0..d0e7dd0f0cc 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java @@ -49,38 +49,42 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { java.lang.String[] descriptorData = { "\n\034google/spanner/v1/type.proto\022\021google.s" - + "panner.v1\032\037google/api/field_behavior.pro" - + "to\032\034google/api/annotations.proto\"\237\001\n\004Typ" + + "panner.v1\032\034google/api/annotations.proto\032" + + "\037google/api/field_behavior.proto\"\337\001\n\004Typ" + "e\022.\n\004code\030\001 \001(\0162\033.google.spanner.v1.Type" + "CodeB\003\340A\002\0223\n\022array_element_type\030\002 \001(\0132\027." + "google.spanner.v1.Type\0222\n\013struct_type\030\003 " - + "\001(\0132\035.google.spanner.v1.StructType\"\177\n\nSt" - + "ructType\0223\n\006fields\030\001 \003(\0132#.google.spanne" - + "r.v1.StructType.Field\032<\n\005Field\022\014\n\004name\030\001" - + " \001(\t\022%\n\004type\030\002 \001(\0132\027.google.spanner.v1.T" - + "ype*\245\001\n\010TypeCode\022\031\n\025TYPE_CODE_UNSPECIFIE" - + "D\020\000\022\010\n\004BOOL\020\001\022\t\n\005INT64\020\002\022\013\n\007FLOAT64\020\003\022\r\n" - + "\tTIMESTAMP\020\004\022\010\n\004DATE\020\005\022\n\n\006STRING\020\006\022\t\n\005BY" - + "TES\020\007\022\t\n\005ARRAY\020\010\022\n\n\006STRUCT\020\t\022\013\n\007NUMERIC\020" - + "\n\022\010\n\004JSON\020\013B\257\001\n\025com.google.spanner.v1B\tT" - + "ypeProtoP\001Z8google.golang.org/genproto/g" - + "oogleapis/spanner/v1;spanner\252\002\027Google.Cl" - + "oud.Spanner.V1\312\002\027Google\\Cloud\\Spanner\\V1" - + "\352\002\032Google::Cloud::Spanner::V1b\006proto3" + + "\001(\0132\035.google.spanner.v1.StructType\022>\n\017ty" + + "pe_annotation\030\004 \001(\0162%.google.spanner.v1." + + "TypeAnnotationCode\"\177\n\nStructType\0223\n\006fiel" + + "ds\030\001 \003(\0132#.google.spanner.v1.StructType." + + "Field\032<\n\005Field\022\014\n\004name\030\001 \001(\t\022%\n\004type\030\002 \001" + + "(\0132\027.google.spanner.v1.Type*\245\001\n\010TypeCode" + + "\022\031\n\025TYPE_CODE_UNSPECIFIED\020\000\022\010\n\004BOOL\020\001\022\t\n" + + "\005INT64\020\002\022\013\n\007FLOAT64\020\003\022\r\n\tTIMESTAMP\020\004\022\010\n\004" + + "DATE\020\005\022\n\n\006STRING\020\006\022\t\n\005BYTES\020\007\022\t\n\005ARRAY\020\010" + + "\022\n\n\006STRUCT\020\t\022\013\n\007NUMERIC\020\n\022\010\n\004JSON\020\013*J\n\022T" + + "ypeAnnotationCode\022$\n TYPE_ANNOTATION_COD" + + "E_UNSPECIFIED\020\000\022\016\n\nPG_NUMERIC\020\002B\257\001\n\025com." + + "google.spanner.v1B\tTypeProtoP\001Z8google.g" + + "olang.org/genproto/googleapis/spanner/v1" + + ";spanner\252\002\027Google.Cloud.Spanner.V1\312\002\027Goo" + + "gle\\Cloud\\Spanner\\V1\352\002\032Google::Cloud::Sp" + + "anner::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), }); internal_static_google_spanner_v1_Type_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_spanner_v1_Type_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_Type_descriptor, new java.lang.String[] { - "Code", "ArrayElementType", "StructType", + "Code", "ArrayElementType", "StructType", "TypeAnnotation", }); internal_static_google_spanner_v1_StructType_descriptor = getDescriptor().getMessageTypes().get(1); @@ -103,8 +107,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( descriptor, registry); - com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto index 1c2df7260be..4850600f0ef 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto @@ -16,9 +16,9 @@ syntax = "proto3"; package google.spanner.v1; +import "google/api/annotations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; @@ -36,9 +36,9 @@ message CommitResponse { // `mutation_count` value can help you maximize the number of mutations // in a transaction and minimize the number of API round trips. You can // also monitor this value to prevent transactions from exceeding the system - // [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). + // [limit](https://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data). // If the number of mutations exceeds the limit, the server returns - // [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). + // [INVALID_ARGUMENT](https://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT). int64 mutation_count = 1; } diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/keys.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/keys.proto index d8ce0d6774f..ddcd181266e 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/keys.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/keys.proto @@ -16,8 +16,8 @@ syntax = "proto3"; package google.spanner.v1; -import "google/protobuf/struct.proto"; import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/mutation.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/mutation.proto index 8ba51fc9ae1..ccadb2f8fcb 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/mutation.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/mutation.proto @@ -1,4 +1,4 @@ -// 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,9 +16,9 @@ syntax = "proto3"; package google.spanner.v1; +import "google/api/annotations.proto"; import "google/protobuf/struct.proto"; import "google/spanner/v1/keys.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/query_plan.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/query_plan.proto index 35f8fe21c55..690c36ea92b 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/query_plan.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/query_plan.proto @@ -16,8 +16,8 @@ syntax = "proto3"; package google.spanner.v1; -import "google/protobuf/struct.proto"; import "google/api/annotations.proto"; +import "google/protobuf/struct.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; @@ -29,6 +29,24 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // Node information for nodes appearing in a [QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes]. message PlanNode { + // The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of + // nodes that can appear in a query plan. + enum Kind { + // Not specified. + KIND_UNSPECIFIED = 0; + + // Denotes a Relational operator node in the expression tree. Relational + // operators represent iterative processing of rows during query execution. + // For example, a `TableScan` operation that reads rows from a table. + RELATIONAL = 1; + + // Denotes a Scalar node in the expression tree. Scalar nodes represent + // non-iterable entities in the query plan. For example, constants or + // arithmetic operators appearing inside predicate expressions or references + // to column names. + SCALAR = 2; + } + // Metadata associated with a parent-child relationship appearing in a // [PlanNode][google.spanner.v1.PlanNode]. message ChildLink { @@ -66,24 +84,6 @@ message PlanNode { map subqueries = 2; } - // The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of - // nodes that can appear in a query plan. - enum Kind { - // Not specified. - KIND_UNSPECIFIED = 0; - - // Denotes a Relational operator node in the expression tree. Relational - // operators represent iterative processing of rows during query execution. - // For example, a `TableScan` operation that reads rows from a table. - RELATIONAL = 1; - - // Denotes a Scalar node in the expression tree. Scalar nodes represent - // non-iterable entities in the query plan. For example, constants or - // arithmetic operators appearing inside predicate expressions or references - // to column names. - SCALAR = 2; - } - // The `PlanNode`'s index in [node list][google.spanner.v1.QueryPlan.plan_nodes]. int32 index = 1; diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto index d6bb9a2831f..d6ba978de2b 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto @@ -16,11 +16,12 @@ syntax = "proto3"; package google.spanner.v1; +import "google/api/annotations.proto"; import "google/protobuf/struct.proto"; +import "google/spanner/v1/commit_response.proto"; import "google/spanner/v1/query_plan.proto"; import "google/spanner/v1/transaction.proto"; import "google/spanner/v1/type.proto"; -import "google/api/annotations.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Spanner.V1"; diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto index 176123f8d49..04cc007f556 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto @@ -16,7 +16,6 @@ syntax = "proto3"; package google.spanner.v1; -import public "google/spanner/v1/commit_response.proto"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; @@ -25,6 +24,7 @@ import "google/protobuf/empty.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "google/rpc/status.proto"; +import public "google/spanner/v1/commit_response.proto"; import "google/spanner/v1/keys.proto"; import "google/spanner/v1/mutation.proto"; import "google/spanner/v1/result_set.proto"; @@ -469,6 +469,7 @@ message RequestOptions { // Legal characters for `request_tag` values are all printable characters // (ASCII 32 - 126) and the length of a request_tag is limited to 50 // characters. Values that exceed this limit are truncated. + // Any leading underscore (_) characters will be removed from the string. string request_tag = 2; // A tag used for statistics collection about this transaction. @@ -476,17 +477,32 @@ message RequestOptions { // that belongs to a transaction. // The value of transaction_tag should be the same for all requests belonging // to the same transaction. - // If this request doesn’t belong to any transaction, transaction_tag will be + // If this request doesn't belong to any transaction, transaction_tag will be // ignored. // Legal characters for `transaction_tag` values are all printable characters // (ASCII 32 - 126) and the length of a transaction_tag is limited to 50 // characters. Values that exceed this limit are truncated. + // Any leading underscore (_) characters will be removed from the string. string transaction_tag = 3; } // The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and // [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql]. message ExecuteSqlRequest { + // Mode in which the statement must be processed. + enum QueryMode { + // The default mode. Only the statement results are returned. + NORMAL = 0; + + // This mode returns only the query plan, without any results or + // execution statistics information. + PLAN = 1; + + // This mode returns both the query plan and the execution statistics along + // with the results. + PROFILE = 2; + } + // Query optimizer configuration. message QueryOptions { // An option to control the selection of optimizer version. @@ -540,20 +556,6 @@ message ExecuteSqlRequest { string optimizer_statistics_package = 2; } - // Mode in which the statement must be processed. - enum QueryMode { - // The default mode. Only the statement results are returned. - NORMAL = 0; - - // This mode returns only the query plan, without any results or - // execution statistics information. - PLAN = 1; - - // This mode returns both the query plan and the execution statistics along - // with the results. - PROFILE = 2; - } - // Required. The session in which the SQL query should be performed. string session = 1 [ (google.api.field_behavior) = REQUIRED, diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto index 30ef9dc84aa..debc226e32b 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto @@ -16,9 +16,9 @@ syntax = "proto3"; package google.spanner.v1; +import "google/api/annotations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; @@ -28,8 +28,7 @@ option java_package = "com.google.spanner.v1"; option php_namespace = "Google\\Cloud\\Spanner\\V1"; option ruby_package = "Google::Cloud::Spanner::V1"; -// # Transactions -// +// Transactions: // // Each session can have at most one active transaction at a time (note that // standalone reads and queries use a transaction internally and do count @@ -37,8 +36,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // completed, the session can immediately be re-used for the next transaction. // It is not necessary to create a new session for each transaction. // -// # Transaction Modes -// +// Transaction Modes: // Cloud Spanner supports three transaction modes: // // 1. Locking read-write. This type of transaction is the only way @@ -70,8 +68,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // may, however, read/write data in different tables within that // database. // -// ## Locking Read-Write Transactions -// +// Locking Read-Write Transactions: // Locking transactions may be used to atomically read-modify-write // data anywhere in a database. This type of transaction is externally // consistent. @@ -93,8 +90,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the // transaction. // -// ## Semantics -// +// Semantics: // Cloud Spanner can commit the transaction if all read locks it acquired // are still valid at commit time, and it is able to acquire write // locks for all writes. Cloud Spanner can abort the transaction for any @@ -106,8 +102,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // use Cloud Spanner locks for any sort of mutual exclusion other than // between Cloud Spanner transactions themselves. // -// ## Retrying Aborted Transactions -// +// Retrying Aborted Transactions: // When a transaction aborts, the application can choose to retry the // whole transaction again. To maximize the chances of successfully // committing the retry, the client should execute the retry in the @@ -115,27 +110,25 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // priority increases with each consecutive abort, meaning that each // attempt has a slightly better chance of success than the previous. // -// Under some circumstances (e.g., many transactions attempting to +// Under some circumstances (for example, many transactions attempting to // modify the same row(s)), a transaction can abort many times in a // short period before successfully committing. Thus, it is not a good // idea to cap the number of retries a transaction can attempt; -// instead, it is better to limit the total amount of wall time spent +// instead, it is better to limit the total amount of time spent // retrying. // -// ## Idle Transactions -// +// Idle Transactions: // A transaction is considered idle if it has no outstanding reads or // SQL queries and has not started a read or SQL query within the last 10 // seconds. Idle transactions can be aborted by Cloud Spanner so that they -// don't hold on to locks indefinitely. In that case, the commit will -// fail with error `ABORTED`. +// don't hold on to locks indefinitely. If an idle transaction is aborted, the +// commit will fail with error `ABORTED`. // // If this behavior is undesirable, periodically executing a simple -// SQL query in the transaction (e.g., `SELECT 1`) prevents the +// SQL query in the transaction (for example, `SELECT 1`) prevents the // transaction from becoming idle. // -// ## Snapshot Read-Only Transactions -// +// Snapshot Read-Only Transactions: // Snapshot read-only transactions provides a simpler method than // locking read-write transactions for doing several consistent // reads. However, this type of transaction does not support writes. @@ -172,8 +165,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // // Each type of timestamp bound is discussed in detail below. // -// ## Strong -// +// Strong: // Strong reads are guaranteed to see the effects of all transactions // that have committed before the start of the read. Furthermore, all // rows yielded by a single read are consistent with each other -- if @@ -188,13 +180,12 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // // See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. // -// ## Exact Staleness -// +// Exact Staleness: // These timestamp bounds execute reads at a user-specified // timestamp. Reads at a timestamp are guaranteed to see a consistent // prefix of the global transaction history: they observe -// modifications done by all transactions with a commit timestamp <= -// the read timestamp, and observe none of the modifications done by +// modifications done by all transactions with a commit timestamp less than or +// equal to the read timestamp, and observe none of the modifications done by // transactions with a larger commit timestamp. They will block until // all conflicting transactions that may be assigned commit timestamps // <= the read timestamp have finished. @@ -210,8 +201,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and // [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness]. // -// ## Bounded Staleness -// +// Bounded Staleness: // Bounded staleness modes allow Cloud Spanner to pick the read timestamp, // subject to a user-provided staleness bound. Cloud Spanner chooses the // newest timestamp within the staleness bound that allows execution @@ -240,8 +230,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and // [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp]. // -// ## Old Read Timestamps and Garbage Collection -// +// Old Read Timestamps and Garbage Collection: // Cloud Spanner continuously garbage collects deleted and overwritten data // in the background to reclaim storage space. This process is known // as "version GC". By default, version GC reclaims versions after they @@ -251,8 +240,7 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // timestamp become too old while executing. Reads and SQL queries with // too-old read timestamps fail with the error `FAILED_PRECONDITION`. // -// ## Partitioned DML Transactions -// +// Partitioned DML Transactions: // Partitioned DML transactions are used to execute DML statements with a // different execution strategy that provides different, and often better, // scalability properties for large, table-wide operations than DML in a diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto index c1f30f51230..f88e7b251df 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/type.proto @@ -16,8 +16,8 @@ syntax = "proto3"; package google.spanner.v1; -import "google/api/field_behavior.proto"; import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "google.golang.org/genproto/googleapis/spanner/v1;spanner"; @@ -40,6 +40,14 @@ message Type { // If [code][google.spanner.v1.Type.code] == [STRUCT][google.spanner.v1.TypeCode.STRUCT], then `struct_type` // provides type information for the struct's fields. StructType struct_type = 3; + + // The [TypeAnnotationCode][google.spanner.v1.TypeAnnotationCode] that disambiguates SQL type that Spanner will + // use to represent values of this type during query processing. This is + // necessary for some type codes because a single [TypeCode][google.spanner.v1.TypeCode] can be mapped + // to different SQL types depending on the SQL dialect. [type_annotation][google.spanner.v1.Type.type_annotation] + // typically is not needed to process the content of a value (it doesn't + // affect serialization) and clients can ignore it on the read path. + TypeAnnotationCode type_annotation = 4; } // `StructType` defines the fields of a [STRUCT][google.spanner.v1.TypeCode.STRUCT] type. @@ -129,12 +137,31 @@ enum TypeCode { //
(ExponentIndicator is `"e"` or `"E"`) NUMERIC = 10; - // Encoded as a JSON-formatted 'string' as described in RFC 7159. The - // following rules will be applied when parsing JSON input: - // - Whitespace will be stripped from the document. - // - If a JSON object has duplicate keys, only the first key will be - // preserved. + // Encoded as a JSON-formatted `string` as described in RFC 7159. The + // following rules are applied when parsing JSON input: + // + // - Whitespace characters are not preserved. + // - If a JSON object has duplicate keys, only the first key is preserved. // - Members of a JSON object are not guaranteed to have their order - // preserved. JSON array elements will have their order preserved. + // preserved. + // - JSON array elements will have their order preserved. JSON = 11; } + +// `TypeAnnotationCode` is used as a part of [Type][google.spanner.v1.Type] to +// disambiguate SQL types that should be used for a given Cloud Spanner value. +// Disambiguation is needed because the same Cloud Spanner type can be mapped to +// different SQL types depending on SQL dialect. TypeAnnotationCode doesn't +// affect the way value is serialized. +enum TypeAnnotationCode { + // Not specified. + TYPE_ANNOTATION_CODE_UNSPECIFIED = 0; + + // PostgreSQL compatible NUMERIC type. This annotation needs to be applied to + // [Type][google.spanner.v1.Type] instances having [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] + // type code to specify that values of this type should be treated as + // PostgreSQL NUMERIC values. Currently this annotation is always needed for + // [NUMERIC][google.spanner.v1.TypeCode.NUMERIC] when a client interacts with PostgreSQL-enabled + // Spanner databases. + PG_NUMERIC = 2; +} diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 86838d3bff0..5cad27a5839 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -21,9 +21,9 @@ 1.8 1.8 UTF-8 - 0.30.0 + 0.31.0 2.1.1 - 3.2.0 + 3.2.1 @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.17.3 + 6.17.4 @@ -110,7 +110,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add-snippets-source diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index d49d48b5ed0..f5f1481c143 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -21,9 +21,9 @@ 1.8 1.8 UTF-8 - 0.30.0 + 0.31.0 2.1.1 - 3.2.0 + 3.2.1 @@ -31,7 +31,7 @@ com.google.cloud google-cloud-spanner - 6.17.4 + 6.18.0 @@ -109,7 +109,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.2.0 + 3.3.0 add-snippets-source diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 940d6389e1d..a40c65a2a16 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -23,7 +23,7 @@ 1.8 1.8 UTF-8 - 0.30.0 + 0.31.0 @@ -33,7 +33,7 @@ com.google.cloud libraries-bom - 24.1.2 + 24.2.0 pom import diff --git a/versions.txt b/versions.txt index b672f05d0a9..122a4b35372 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.17.4:6.17.4 -proto-google-cloud-spanner-v1:6.17.4:6.17.4 -proto-google-cloud-spanner-admin-database-v1:6.17.4:6.17.4 -grpc-google-cloud-spanner-v1:6.17.4:6.17.4 -grpc-google-cloud-spanner-admin-instance-v1:6.17.4:6.17.4 -grpc-google-cloud-spanner-admin-database-v1:6.17.4:6.17.4 -google-cloud-spanner:6.17.4:6.17.4 +proto-google-cloud-spanner-admin-instance-v1:6.18.0:6.18.0 +proto-google-cloud-spanner-v1:6.18.0:6.18.0 +proto-google-cloud-spanner-admin-database-v1:6.18.0:6.18.0 +grpc-google-cloud-spanner-v1:6.18.0:6.18.0 +grpc-google-cloud-spanner-admin-instance-v1:6.18.0:6.18.0 +grpc-google-cloud-spanner-admin-database-v1:6.18.0:6.18.0 +google-cloud-spanner:6.18.0:6.18.0