From 39c23a9f2246fa696c12a83106a9d2f1004188e0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 21:30:50 +0200 Subject: [PATCH 01/10] chore(main): release 6.77.1-SNAPSHOT (#3374) * chore(main): release 6.77.1-SNAPSHOT * chore: generate libraries at Wed Oct 2 19:20:01 UTC 2024 --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: cloud-java-bot --- README.md | 2 +- benchmarks/pom.xml | 2 +- google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 16 files changed, 52 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 7a1251441ea..54f97657419 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-spanner - 6.75.0 + 6.76.0 ``` diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 67970f447ed..50c4ed1b270 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -24,7 +24,7 @@ com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index 633388fe2a1..b177613d13b 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.77.0 + 6.77.1-SNAPSHOT pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.77.0 + 6.77.1-SNAPSHOT com.google.cloud google-cloud-spanner test-jar - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 45da3f1eaf7..7c7000bc4c0 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.77.0 + 6.77.1-SNAPSHOT jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index 8a3cfda56cc..fc23777b5a6 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.77.0 + 6.77.1-SNAPSHOT jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 07aac5c78fd..89081db175e 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.77.0 + 6.77.1-SNAPSHOT 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.77.0 + 6.77.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index d584ee9b99e..3f3576a49e8 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.77.0 + 6.77.1-SNAPSHOT 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.77.0 + 6.77.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index 29f01e99b3c..b9175ffda1c 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.77.0 + 6.77.1-SNAPSHOT grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index b2c01526786..b4f16518fe2 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.77.0 + 6.77.1-SNAPSHOT grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/pom.xml b/pom.xml index e97b6bc7913..4cc325c9d3b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.77.0 + 6.77.1-SNAPSHOT Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.77.0 + 6.77.1-SNAPSHOT com.google.cloud google-cloud-spanner - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index b4b1da0eb43..64b28a1948b 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.77.0 + 6.77.1-SNAPSHOT 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.77.0 + 6.77.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index befb5023442..3f30ef21953 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.77.0 + 6.77.1-SNAPSHOT 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.77.0 + 6.77.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 34d3c324862..83e9fdf29af 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.77.0 + 6.77.1-SNAPSHOT proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index ca891107c9e..e10b388ef3d 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.77.0 + 6.77.1-SNAPSHOT proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 9a0ad159689..62fc8b9c715 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.77.0 + 6.77.1-SNAPSHOT diff --git a/versions.txt b/versions.txt index a62c699832a..95ac3133128 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.77.0:6.77.0 -proto-google-cloud-spanner-v1:6.77.0:6.77.0 -proto-google-cloud-spanner-admin-database-v1:6.77.0:6.77.0 -grpc-google-cloud-spanner-v1:6.77.0:6.77.0 -grpc-google-cloud-spanner-admin-instance-v1:6.77.0:6.77.0 -grpc-google-cloud-spanner-admin-database-v1:6.77.0:6.77.0 -google-cloud-spanner:6.77.0:6.77.0 -google-cloud-spanner-executor:6.77.0:6.77.0 -proto-google-cloud-spanner-executor-v1:6.77.0:6.77.0 -grpc-google-cloud-spanner-executor-v1:6.77.0:6.77.0 +proto-google-cloud-spanner-admin-instance-v1:6.77.0:6.77.1-SNAPSHOT +proto-google-cloud-spanner-v1:6.77.0:6.77.1-SNAPSHOT +proto-google-cloud-spanner-admin-database-v1:6.77.0:6.77.1-SNAPSHOT +grpc-google-cloud-spanner-v1:6.77.0:6.77.1-SNAPSHOT +grpc-google-cloud-spanner-admin-instance-v1:6.77.0:6.77.1-SNAPSHOT +grpc-google-cloud-spanner-admin-database-v1:6.77.0:6.77.1-SNAPSHOT +google-cloud-spanner:6.77.0:6.77.1-SNAPSHOT +google-cloud-spanner-executor:6.77.0:6.77.1-SNAPSHOT +proto-google-cloud-spanner-executor-v1:6.77.0:6.77.1-SNAPSHOT +grpc-google-cloud-spanner-executor-v1:6.77.0:6.77.1-SNAPSHOT From 5cebcb4592448f7e7e7907d05910444079f3b525 Mon Sep 17 00:00:00 2001 From: rahul2393 Date: Thu, 3 Oct 2024 15:18:44 +0530 Subject: [PATCH 02/10] test: fix tests failing because of Editions (#3377) * test: fix tests failing because of Editions * chore: generate libraries at Thu Oct 3 05:32:52 UTC 2024 --------- Co-authored-by: cloud-java-bot --- .../google/cloud/spanner/InstanceInfo.java | 26 ++++++++++ .../spanner/InstanceAdminClientImplTest.java | 7 ++- .../cloud/spanner/IntegrationTestEnv.java | 1 + .../cloud/spanner/it/ITInstanceAdminTest.java | 52 ++++++++----------- 4 files changed, 54 insertions(+), 32 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceInfo.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceInfo.java index ebe0514adf2..e0381952989 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceInfo.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceInfo.java @@ -24,6 +24,7 @@ import com.google.common.collect.ImmutableMap; import com.google.protobuf.FieldMask; import com.google.spanner.admin.instance.v1.AutoscalingConfig; +import com.google.spanner.admin.instance.v1.Instance.Edition; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -37,6 +38,7 @@ public enum InstanceField implements FieldSelector { NODE_COUNT("node_count"), PROCESSING_UNITS("processing_units"), AUTOSCALING_CONFIG("autoscaling_config"), + EDITION("edition"), LABELS("labels"); static InstanceField[] defaultFieldsToUpdate(InstanceInfo info) { @@ -116,6 +118,10 @@ public Builder setAutoscalingConfig(AutoscalingConfig autoscalingConfig) { throw new UnsupportedOperationException("Unimplemented"); } + public Builder setEdition(Edition edition) { + throw new UnsupportedOperationException("Unimplemented"); + } + public abstract Builder setState(State state); public abstract Builder addLabel(String key, String value); @@ -132,6 +138,7 @@ static class BuilderImpl extends Builder { private int nodeCount; private int processingUnits; private AutoscalingConfig autoscalingConfig; + private Edition edition; private State state; private Map labels; private Timestamp updateTime; @@ -153,6 +160,7 @@ static class BuilderImpl extends Builder { this.labels = new HashMap<>(instance.labels); this.updateTime = instance.updateTime; this.createTime = instance.createTime; + this.edition = instance.edition; } @Override @@ -197,6 +205,12 @@ public BuilderImpl setAutoscalingConfig(AutoscalingConfig autoscalingConfig) { return this; } + @Override + public BuilderImpl setEdition(Edition edition) { + this.edition = edition; + return this; + } + @Override public BuilderImpl setState(State state) { this.state = state; @@ -227,6 +241,7 @@ public InstanceInfo build() { private final int nodeCount; private final int processingUnits; private final AutoscalingConfig autoscalingConfig; + private final Edition edition; private final State state; private final ImmutableMap labels; private final Timestamp updateTime; @@ -239,6 +254,7 @@ public InstanceInfo build() { this.nodeCount = builder.nodeCount; this.processingUnits = builder.processingUnits; this.autoscalingConfig = builder.autoscalingConfig; + this.edition = builder.edition; this.state = builder.state; this.labels = ImmutableMap.copyOf(builder.labels); this.updateTime = builder.updateTime; @@ -283,6 +299,10 @@ public AutoscalingConfig getAutoscalingConfig() { return autoscalingConfig; } + public Edition getEdition() { + return edition; + } + /** Returns the current state of the instance. */ public State getState() { return state; @@ -306,6 +326,7 @@ public String toString() { .add("nodeCount", nodeCount) .add("processingUnits", processingUnits) .add("autoscaling_config", autoscalingConfig) + .add("edition", edition) .add("state", state) .add("labels", labels) .add("createTime", createTime) @@ -328,6 +349,7 @@ public boolean equals(Object o) { && nodeCount == that.nodeCount && processingUnits == that.processingUnits && Objects.equals(autoscalingConfig, that.autoscalingConfig) + && edition == that.edition && state == that.state && Objects.equals(labels, that.labels) && Objects.equals(updateTime, that.updateTime) @@ -343,6 +365,7 @@ public int hashCode() { nodeCount, processingUnits, autoscalingConfig, + edition, state, labels, updateTime, @@ -365,6 +388,9 @@ com.google.spanner.admin.instance.v1.Instance toProto() { if (getAutoscalingConfig() != null) { builder.setAutoscalingConfig(getAutoscalingConfig()); } + if (getEdition() != null) { + builder.setEdition(getEdition()); + } return builder.build(); } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceAdminClientImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceAdminClientImplTest.java index 58373bcca0b..558efff7487 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceAdminClientImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceAdminClientImplTest.java @@ -280,12 +280,17 @@ public void createInstance() throws Exception { when(rpc.createInstance( "projects/" + PROJECT_ID, INSTANCE_ID, - getInstanceProto().toBuilder().setProcessingUnits(0).build())) + getInstanceProto() + .toBuilder() + .setProcessingUnits(0) + .setEdition(com.google.spanner.admin.instance.v1.Instance.Edition.ENTERPRISE_PLUS) + .build())) .thenReturn(rawOperationFuture); OperationFuture op = client.createInstance( InstanceInfo.newBuilder(InstanceId.of(PROJECT_ID, INSTANCE_ID)) .setInstanceConfigId(InstanceConfigId.of(PROJECT_ID, CONFIG_ID)) + .setEdition(com.google.spanner.admin.instance.v1.Instance.Edition.ENTERPRISE_PLUS) .setNodeCount(1) .build()); assertThat(op.isDone()).isTrue(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestEnv.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestEnv.java index 2c6f886522e..4593c04cc18 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestEnv.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestEnv.java @@ -160,6 +160,7 @@ private void initializeInstance(InstanceId instanceId) throws Exception { InstanceInfo.newBuilder(instanceId) .setNodeCount(1) .setDisplayName("Test instance") + .setEdition(com.google.spanner.admin.instance.v1.Instance.Edition.ENTERPRISE_PLUS) .setInstanceConfigId(configId) .build(); OperationFuture op = diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java index e6f502abbb2..f21441f30a8 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java @@ -145,37 +145,27 @@ public void updateInstanceWithAutoscalingConfig() throws Exception { .setNodeCount(0) .setAutoscalingConfig(autoscalingConfig) .build(); - try { - OperationFuture op = - instanceClient.updateInstance(toUpdate, InstanceInfo.InstanceField.AUTOSCALING_CONFIG); - Instance newInstance = op.get(); - assertThat(newInstance.getAutoscalingConfig()).isEqualTo(autoscalingConfig); - - Instance newInstanceFromGet = - instanceClient.getInstance(env.getTestHelper().getInstanceId().getInstance()); - assertThat(newInstanceFromGet).isEqualTo(newInstance); - - // Revert back to the instance original state. - toUpdate = - InstanceInfo.newBuilder(instance.getId()) - .setAutoscalingConfig(null) - .setNodeCount(instance.getNodeCount()) - .build(); - instanceClient - .updateInstance( - toUpdate, - InstanceInfo.InstanceField.AUTOSCALING_CONFIG, - InstanceInfo.InstanceField.NODE_COUNT) - .get(); - } catch (Exception exception) { - // TODO: Remove once the client lib supports creating instances with an Edition. - if (!exception - .getMessage() - .contains("The minimum required Edition for this feature is ENTERPRISE.")) { - throw exception; - } - // ignore this error for now. - } + OperationFuture op = + instanceClient.updateInstance(toUpdate, InstanceInfo.InstanceField.AUTOSCALING_CONFIG); + Instance newInstance = op.get(); + assertThat(newInstance.getAutoscalingConfig()).isEqualTo(autoscalingConfig); + + Instance newInstanceFromGet = + instanceClient.getInstance(env.getTestHelper().getInstanceId().getInstance()); + assertThat(newInstanceFromGet).isEqualTo(newInstance); + + // Revert back to the instance original state. + toUpdate = + InstanceInfo.newBuilder(instance.getId()) + .setAutoscalingConfig(null) + .setNodeCount(instance.getNodeCount()) + .build(); + instanceClient + .updateInstance( + toUpdate, + InstanceInfo.InstanceField.AUTOSCALING_CONFIG, + InstanceInfo.InstanceField.NODE_COUNT) + .get(); } @Test From fc187759f97b4be37776201907b392f8a65ffe6f Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Thu, 3 Oct 2024 16:04:23 +0530 Subject: [PATCH 03/10] chore: location for gke (#3359) --- .../cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java index ad177c1f36d..42eb76711b0 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java @@ -94,7 +94,7 @@ static String detectClientLocation() { // All platform except GKE uses "cloud_region" for region attribute. String region = detectedPlatform.getAttributes().get("cloud_region"); if (detectedPlatform.getSupportedPlatform() == GOOGLE_KUBERNETES_ENGINE) { - region = detectedPlatform.getAttributes().get(AttributeKeys.GKE_LOCATION_TYPE_REGION); + region = detectedPlatform.getAttributes().get(AttributeKeys.GKE_CLUSTER_LOCATION); } return region == null ? "global" : region; } From f46a6b34383fe45d63b2db912389b26067f3a853 Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Fri, 4 Oct 2024 02:23:11 -0400 Subject: [PATCH 04/10] chore: Update generation configuration at Fri Oct 4 02:24:45 UTC 2024 (#3376) * chore: Update generation configuration at Thu Oct 3 02:24:40 UTC 2024 * chore: generate libraries at Thu Oct 3 02:28:26 UTC 2024 * chore: Update generation configuration at Fri Oct 4 02:24:45 UTC 2024 * chore: generate libraries at Fri Oct 4 02:25:13 UTC 2024 --- README.md | 2 +- generation_config.yaml | 4 +- .../reflect-config.json | 72 + .../reflect-config.json | 72 + .../v1/InstanceAdminClientHttpJsonTest.java | 8 + .../instance/v1/InstanceAdminClientTest.java | 6 + .../admin/instance/v1/AutoscalingConfig.java | 3424 ++++++++++++++++- .../v1/AutoscalingConfigOrBuilder.java | 108 + .../admin/instance/v1/CommonProto.java | 50 +- .../spanner/admin/instance/v1/Instance.java | 914 ++++- .../admin/instance/v1/InstanceOrBuilder.java | 122 +- .../instance/v1/ReplicaComputeCapacity.java | 1154 ++++++ .../v1/ReplicaComputeCapacityOrBuilder.java | 135 + .../admin/instance/v1/ReplicaSelection.java | 626 +++ .../v1/ReplicaSelectionOrBuilder.java | 51 + .../v1/SpannerInstanceAdminProto.java | 768 ++-- .../spanner/admin/instance/v1/common.proto | 7 + .../instance/v1/spanner_instance_admin.proto | 125 +- 18 files changed, 6944 insertions(+), 704 deletions(-) create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacity.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacityOrBuilder.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelection.java create mode 100644 proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelectionOrBuilder.java diff --git a/README.md b/README.md index 54f97657419..d7455f36eb2 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ If you are using Maven without the 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:26.47.0') +implementation platform('com.google.cloud:libraries-bom:26.48.0') implementation 'com.google.cloud:google-cloud-spanner' ``` diff --git a/generation_config.yaml b/generation_config.yaml index 22e3d873bcf..0da6abef7b8 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,6 +1,6 @@ gapic_generator_version: 2.46.1 -googleapis_commitish: 16a1580c06b3b32e8ab33c39d846bba7e21bfae3 -libraries_bom_version: 26.47.0 +googleapis_commitish: b6a27d13a2f0223051ef720e4e9d0d52323560e6 +libraries_bom_version: 26.48.0 libraries: - api_shortname: spanner name_pretty: Cloud Spanner diff --git a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json index 856cb45506f..2b261bc156b 100644 --- a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json +++ b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json @@ -2717,6 +2717,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption$AutoscalingConfigOverrides", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption$AutoscalingConfigOverrides$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AutoscalingLimits", "queryAllDeclaredConstructors": true, @@ -3338,6 +3374,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaComputeCapacity", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaComputeCapacity$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.ReplicaInfo", "queryAllDeclaredConstructors": true, @@ -3365,6 +3419,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaSelection", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaSelection$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json index 92c9b748465..cfe0908272e 100644 --- a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json +++ b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.admin.instance.v1/reflect-config.json @@ -1628,6 +1628,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption$AutoscalingConfigOverrides", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption$AutoscalingConfigOverrides$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AsymmetricAutoscalingOption$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.AutoscalingConfig$AutoscalingLimits", "queryAllDeclaredConstructors": true, @@ -2249,6 +2285,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaComputeCapacity", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaComputeCapacity$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.ReplicaInfo", "queryAllDeclaredConstructors": true, @@ -2276,6 +2330,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaSelection", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.admin.instance.v1.ReplicaSelection$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java index 84bd2b8e78c..50532826e53 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientHttpJsonTest.java @@ -59,6 +59,7 @@ import com.google.spanner.admin.instance.v1.MoveInstanceRequest; import com.google.spanner.admin.instance.v1.MoveInstanceResponse; import com.google.spanner.admin.instance.v1.ProjectName; +import com.google.spanner.admin.instance.v1.ReplicaComputeCapacity; import com.google.spanner.admin.instance.v1.ReplicaInfo; import java.io.IOException; import java.util.ArrayList; @@ -910,6 +911,7 @@ public void getInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -963,6 +965,7 @@ public void getInstanceTest2() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1016,6 +1019,7 @@ public void createInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1078,6 +1082,7 @@ public void createInstanceTest2() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1140,6 +1145,7 @@ public void updateInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1161,6 +1167,7 @@ public void updateInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1202,6 +1209,7 @@ public void updateInstanceExceptionTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java index d3ea4156e08..73c6de9b2ca 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/admin/instance/v1/InstanceAdminClientTest.java @@ -75,6 +75,7 @@ import com.google.spanner.admin.instance.v1.MoveInstanceRequest; import com.google.spanner.admin.instance.v1.MoveInstanceResponse; import com.google.spanner.admin.instance.v1.ProjectName; +import com.google.spanner.admin.instance.v1.ReplicaComputeCapacity; import com.google.spanner.admin.instance.v1.ReplicaInfo; import com.google.spanner.admin.instance.v1.UpdateInstanceConfigRequest; import com.google.spanner.admin.instance.v1.UpdateInstancePartitionRequest; @@ -845,6 +846,7 @@ public void getInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -892,6 +894,7 @@ public void getInstanceTest2() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -939,6 +942,7 @@ public void createInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1000,6 +1004,7 @@ public void createInstanceTest2() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) @@ -1061,6 +1066,7 @@ public void updateInstanceTest() throws Exception { .setDisplayName("displayName1714148973") .setNodeCount(1539922066) .setProcessingUnits(-329117885) + .addAllReplicaComputeCapacity(new ArrayList()) .setAutoscalingConfig(AutoscalingConfig.newBuilder().build()) .putAllLabels(new HashMap()) .addAllEndpointUris(new ArrayList()) diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfig.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfig.java index 0b0bae8f4d6..eeb39bfd3d2 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfig.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfig.java @@ -38,7 +38,9 @@ private AutoscalingConfig(com.google.protobuf.GeneratedMessageV3.Builder buil super(builder); } - private AutoscalingConfig() {} + private AutoscalingConfig() { + asymmetricAutoscalingOptions_ = java.util.Collections.emptyList(); + } @java.lang.Override @SuppressWarnings({"unused"}) @@ -2081,207 +2083,2615 @@ public com.google.protobuf.Parser getParserForType() { } } - private int bitField0_; - public static final int AUTOSCALING_LIMITS_FIELD_NUMBER = 1; - private com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits - autoscalingLimits_; - /** - * - * - *
-   * Required. Autoscaling limits for an instance.
-   * 
- * - * - * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the autoscalingLimits field is set. - */ - @java.lang.Override - public boolean hasAutoscalingLimits() { - return ((bitField0_ & 0x00000001) != 0); - } - /** - * - * - *
-   * Required. Autoscaling limits for an instance.
-   * 
- * - * - * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The autoscalingLimits. - */ - @java.lang.Override - public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits - getAutoscalingLimits() { - return autoscalingLimits_ == null - ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits - .getDefaultInstance() - : autoscalingLimits_; - } - /** - * - * - *
-   * Required. Autoscaling limits for an instance.
-   * 
- * - * - * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder - getAutoscalingLimitsOrBuilder() { - return autoscalingLimits_ == null - ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits - .getDefaultInstance() - : autoscalingLimits_; - } + public interface AsymmetricAutoscalingOptionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) + com.google.protobuf.MessageOrBuilder { - public static final int AUTOSCALING_TARGETS_FIELD_NUMBER = 2; - private com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets - autoscalingTargets_; - /** - * - * - *
-   * Required. The autoscaling targets for an instance.
-   * 
- * - * - * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the autoscalingTargets field is set. - */ - @java.lang.Override - public boolean hasAutoscalingTargets() { - return ((bitField0_ & 0x00000002) != 0); - } - /** - * - * - *
-   * Required. The autoscaling targets for an instance.
-   * 
- * - * - * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The autoscalingTargets. - */ - @java.lang.Override - public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets - getAutoscalingTargets() { - return autoscalingTargets_ == null - ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets - .getDefaultInstance() - : autoscalingTargets_; + /** + * + * + *
+     * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+     * applies. Only read-only replicas are supported.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replicaSelection field is set. + */ + boolean hasReplicaSelection(); + /** + * + * + *
+     * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+     * applies. Only read-only replicas are supported.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replicaSelection. + */ + com.google.spanner.admin.instance.v1.ReplicaSelection getReplicaSelection(); + /** + * + * + *
+     * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+     * applies. Only read-only replicas are supported.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder getReplicaSelectionOrBuilder(); + + /** + * + * + *
+     * Optional. Overrides applied to the top-level autoscaling configuration
+     * for the selected replicas.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the overrides field is set. + */ + boolean hasOverrides(); + /** + * + * + *
+     * Optional. Overrides applied to the top-level autoscaling configuration
+     * for the selected replicas.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The overrides. + */ + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + getOverrides(); + /** + * + * + *
+     * Optional. Overrides applied to the top-level autoscaling configuration
+     * for the selected replicas.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder + getOverridesOrBuilder(); } /** * * *
-   * Required. The autoscaling targets for an instance.
+   * AsymmetricAutoscalingOption specifies the scaling of replicas identified by
+   * the given selection.
    * 
* - * - * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; - * + * Protobuf type {@code + * google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption} */ - @java.lang.Override - public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargetsOrBuilder - getAutoscalingTargetsOrBuilder() { - return autoscalingTargets_ == null - ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets - .getDefaultInstance() - : autoscalingTargets_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) != 0)) { - output.writeMessage(1, getAutoscalingLimits()); - } - if (((bitField0_ & 0x00000002) != 0)) { - output.writeMessage(2, getAutoscalingTargets()); + public static final class AsymmetricAutoscalingOption + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) + AsymmetricAutoscalingOptionOrBuilder { + private static final long serialVersionUID = 0L; + // Use AsymmetricAutoscalingOption.newBuilder() to construct. + private AsymmetricAutoscalingOption(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); } - getUnknownFields().writeTo(output); - } - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; + private AsymmetricAutoscalingOption() {} - size = 0; - if (((bitField0_ & 0x00000001) != 0)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getAutoscalingLimits()); - } - if (((bitField0_ & 0x00000002) != 0)) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getAutoscalingTargets()); + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AsymmetricAutoscalingOption(); } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.spanner.admin.instance.v1.AutoscalingConfig)) { - return super.equals(obj); + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor; } - com.google.spanner.admin.instance.v1.AutoscalingConfig other = - (com.google.spanner.admin.instance.v1.AutoscalingConfig) obj; - if (hasAutoscalingLimits() != other.hasAutoscalingLimits()) return false; - if (hasAutoscalingLimits()) { - if (!getAutoscalingLimits().equals(other.getAutoscalingLimits())) return false; - } - if (hasAutoscalingTargets() != other.hasAutoscalingTargets()) return false; - if (hasAutoscalingTargets()) { - if (!getAutoscalingTargets().equals(other.getAutoscalingTargets())) return false; + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .class, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder.class); } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasAutoscalingLimits()) { - hash = (37 * hash) + AUTOSCALING_LIMITS_FIELD_NUMBER; - hash = (53 * hash) + getAutoscalingLimits().hashCode(); - } - if (hasAutoscalingTargets()) { - hash = (37 * hash) + AUTOSCALING_TARGETS_FIELD_NUMBER; + public interface AutoscalingConfigOverridesOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+       * Optional. If specified, overrides the min/max limit in the top-level
+       * autoscaling configuration for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the autoscalingLimits field is set. + */ + boolean hasAutoscalingLimits(); + /** + * + * + *
+       * Optional. If specified, overrides the min/max limit in the top-level
+       * autoscaling configuration for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The autoscalingLimits. + */ + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + getAutoscalingLimits(); + /** + * + * + *
+       * Optional. If specified, overrides the min/max limit in the top-level
+       * autoscaling configuration for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder + getAutoscalingLimitsOrBuilder(); + + /** + * + * + *
+       * Optional. If specified, overrides the autoscaling target
+       * high_priority_cpu_utilization_percent in the top-level autoscaling
+       * configuration for the selected replicas.
+       * 
+ * + * + * int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The autoscalingTargetHighPriorityCpuUtilizationPercent. + */ + int getAutoscalingTargetHighPriorityCpuUtilizationPercent(); + } + /** + * + * + *
+     * Overrides the top-level autoscaling configuration for the replicas
+     * identified by `replica_selection`. All fields in this message are
+     * optional. Any unspecified fields will use the corresponding values from
+     * the top-level autoscaling configuration.
+     * 
+ * + * Protobuf type {@code + * google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides} + */ + public static final class AutoscalingConfigOverrides + extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides) + AutoscalingConfigOverridesOrBuilder { + private static final long serialVersionUID = 0L; + // Use AutoscalingConfigOverrides.newBuilder() to construct. + private AutoscalingConfigOverrides( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AutoscalingConfigOverrides() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AutoscalingConfigOverrides(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.class, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder.class); + } + + private int bitField0_; + public static final int AUTOSCALING_LIMITS_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + autoscalingLimits_; + /** + * + * + *
+       * Optional. If specified, overrides the min/max limit in the top-level
+       * autoscaling configuration for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the autoscalingLimits field is set. + */ + @java.lang.Override + public boolean hasAutoscalingLimits() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+       * Optional. If specified, overrides the min/max limit in the top-level
+       * autoscaling configuration for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The autoscalingLimits. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + getAutoscalingLimits() { + return autoscalingLimits_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance() + : autoscalingLimits_; + } + /** + * + * + *
+       * Optional. If specified, overrides the min/max limit in the top-level
+       * autoscaling configuration for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder + getAutoscalingLimitsOrBuilder() { + return autoscalingLimits_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance() + : autoscalingLimits_; + } + + public static final int + AUTOSCALING_TARGET_HIGH_PRIORITY_CPU_UTILIZATION_PERCENT_FIELD_NUMBER = 2; + private int autoscalingTargetHighPriorityCpuUtilizationPercent_ = 0; + /** + * + * + *
+       * Optional. If specified, overrides the autoscaling target
+       * high_priority_cpu_utilization_percent in the top-level autoscaling
+       * configuration for the selected replicas.
+       * 
+ * + * + * int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The autoscalingTargetHighPriorityCpuUtilizationPercent. + */ + @java.lang.Override + public int getAutoscalingTargetHighPriorityCpuUtilizationPercent() { + return autoscalingTargetHighPriorityCpuUtilizationPercent_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getAutoscalingLimits()); + } + if (autoscalingTargetHighPriorityCpuUtilizationPercent_ != 0) { + output.writeInt32(2, autoscalingTargetHighPriorityCpuUtilizationPercent_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, getAutoscalingLimits()); + } + if (autoscalingTargetHighPriorityCpuUtilizationPercent_ != 0) { + size += + com.google.protobuf.CodedOutputStream.computeInt32Size( + 2, autoscalingTargetHighPriorityCpuUtilizationPercent_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + other = + (com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides) + obj; + + if (hasAutoscalingLimits() != other.hasAutoscalingLimits()) return false; + if (hasAutoscalingLimits()) { + if (!getAutoscalingLimits().equals(other.getAutoscalingLimits())) return false; + } + if (getAutoscalingTargetHighPriorityCpuUtilizationPercent() + != other.getAutoscalingTargetHighPriorityCpuUtilizationPercent()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasAutoscalingLimits()) { + hash = (37 * hash) + AUTOSCALING_LIMITS_FIELD_NUMBER; + hash = (53 * hash) + getAutoscalingLimits().hashCode(); + } + hash = (37 * hash) + AUTOSCALING_TARGET_HIGH_PRIORITY_CPU_UTILIZATION_PERCENT_FIELD_NUMBER; + hash = (53 * hash) + getAutoscalingTargetHighPriorityCpuUtilizationPercent(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+       * Overrides the top-level autoscaling configuration for the replicas
+       * identified by `replica_selection`. All fields in this message are
+       * optional. Any unspecified fields will use the corresponding values from
+       * the top-level autoscaling configuration.
+       * 
+ * + * Protobuf type {@code + * google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides) + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.class, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getAutoscalingLimitsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + autoscalingLimits_ = null; + if (autoscalingLimitsBuilder_ != null) { + autoscalingLimitsBuilder_.dispose(); + autoscalingLimitsBuilder_ = null; + } + autoscalingTargetHighPriorityCpuUtilizationPercent_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + build() { + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + buildPartial() { + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + result = + new com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.autoscalingLimits_ = + autoscalingLimitsBuilder_ == null + ? autoscalingLimits_ + : autoscalingLimitsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.autoscalingTargetHighPriorityCpuUtilizationPercent_ = + autoscalingTargetHighPriorityCpuUtilizationPercent_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + other) { + if (other + == com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.getDefaultInstance()) return this; + if (other.hasAutoscalingLimits()) { + mergeAutoscalingLimits(other.getAutoscalingLimits()); + } + if (other.getAutoscalingTargetHighPriorityCpuUtilizationPercent() != 0) { + setAutoscalingTargetHighPriorityCpuUtilizationPercent( + other.getAutoscalingTargetHighPriorityCpuUtilizationPercent()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getAutoscalingLimitsFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + autoscalingTargetHighPriorityCpuUtilizationPercent_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + autoscalingLimits_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder> + autoscalingLimitsBuilder_; + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the autoscalingLimits field is set. + */ + public boolean hasAutoscalingLimits() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The autoscalingLimits. + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + getAutoscalingLimits() { + if (autoscalingLimitsBuilder_ == null) { + return autoscalingLimits_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance() + : autoscalingLimits_; + } else { + return autoscalingLimitsBuilder_.getMessage(); + } + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAutoscalingLimits( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits value) { + if (autoscalingLimitsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + autoscalingLimits_ = value; + } else { + autoscalingLimitsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAutoscalingLimits( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.Builder + builderForValue) { + if (autoscalingLimitsBuilder_ == null) { + autoscalingLimits_ = builderForValue.build(); + } else { + autoscalingLimitsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAutoscalingLimits( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits value) { + if (autoscalingLimitsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && autoscalingLimits_ != null + && autoscalingLimits_ + != com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance()) { + getAutoscalingLimitsBuilder().mergeFrom(value); + } else { + autoscalingLimits_ = value; + } + } else { + autoscalingLimitsBuilder_.mergeFrom(value); + } + if (autoscalingLimits_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAutoscalingLimits() { + bitField0_ = (bitField0_ & ~0x00000001); + autoscalingLimits_ = null; + if (autoscalingLimitsBuilder_ != null) { + autoscalingLimitsBuilder_.dispose(); + autoscalingLimitsBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.Builder + getAutoscalingLimitsBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getAutoscalingLimitsFieldBuilder().getBuilder(); + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder + getAutoscalingLimitsOrBuilder() { + if (autoscalingLimitsBuilder_ != null) { + return autoscalingLimitsBuilder_.getMessageOrBuilder(); + } else { + return autoscalingLimits_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance() + : autoscalingLimits_; + } + } + /** + * + * + *
+         * Optional. If specified, overrides the min/max limit in the top-level
+         * autoscaling configuration for the selected replicas.
+         * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits.Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder> + getAutoscalingLimitsFieldBuilder() { + if (autoscalingLimitsBuilder_ == null) { + autoscalingLimitsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AutoscalingLimitsOrBuilder>( + getAutoscalingLimits(), getParentForChildren(), isClean()); + autoscalingLimits_ = null; + } + return autoscalingLimitsBuilder_; + } + + private int autoscalingTargetHighPriorityCpuUtilizationPercent_; + /** + * + * + *
+         * Optional. If specified, overrides the autoscaling target
+         * high_priority_cpu_utilization_percent in the top-level autoscaling
+         * configuration for the selected replicas.
+         * 
+ * + * + * int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The autoscalingTargetHighPriorityCpuUtilizationPercent. + */ + @java.lang.Override + public int getAutoscalingTargetHighPriorityCpuUtilizationPercent() { + return autoscalingTargetHighPriorityCpuUtilizationPercent_; + } + /** + * + * + *
+         * Optional. If specified, overrides the autoscaling target
+         * high_priority_cpu_utilization_percent in the top-level autoscaling
+         * configuration for the selected replicas.
+         * 
+ * + * + * int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The autoscalingTargetHighPriorityCpuUtilizationPercent to set. + * @return This builder for chaining. + */ + public Builder setAutoscalingTargetHighPriorityCpuUtilizationPercent(int value) { + + autoscalingTargetHighPriorityCpuUtilizationPercent_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+         * Optional. If specified, overrides the autoscaling target
+         * high_priority_cpu_utilization_percent in the top-level autoscaling
+         * configuration for the selected replicas.
+         * 
+ * + * + * int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearAutoscalingTargetHighPriorityCpuUtilizationPercent() { + bitField0_ = (bitField0_ & ~0x00000002); + autoscalingTargetHighPriorityCpuUtilizationPercent_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides) + private static final com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides(); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AutoscalingConfigOverrides parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + public static final int REPLICA_SELECTION_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.ReplicaSelection replicaSelection_; + /** + * + * + *
+     * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+     * applies. Only read-only replicas are supported.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replicaSelection field is set. + */ + @java.lang.Override + public boolean hasReplicaSelection() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+     * applies. Only read-only replicas are supported.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replicaSelection. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelection getReplicaSelection() { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } + /** + * + * + *
+     * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+     * applies. Only read-only replicas are supported.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder + getReplicaSelectionOrBuilder() { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } + + public static final int OVERRIDES_FIELD_NUMBER = 2; + private com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + overrides_; + /** + * + * + *
+     * Optional. Overrides applied to the top-level autoscaling configuration
+     * for the selected replicas.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the overrides field is set. + */ + @java.lang.Override + public boolean hasOverrides() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Optional. Overrides applied to the top-level autoscaling configuration
+     * for the selected replicas.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The overrides. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + getOverrides() { + return overrides_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.getDefaultInstance() + : overrides_; + } + /** + * + * + *
+     * Optional. Overrides applied to the top-level autoscaling configuration
+     * for the selected replicas.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder + getOverridesOrBuilder() { + return overrides_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.getDefaultInstance() + : overrides_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getReplicaSelection()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getOverrides()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getReplicaSelection()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getOverrides()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption other = + (com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) obj; + + if (hasReplicaSelection() != other.hasReplicaSelection()) return false; + if (hasReplicaSelection()) { + if (!getReplicaSelection().equals(other.getReplicaSelection())) return false; + } + if (hasOverrides() != other.hasOverrides()) return false; + if (hasOverrides()) { + if (!getOverrides().equals(other.getOverrides())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasReplicaSelection()) { + hash = (37 * hash) + REPLICA_SELECTION_FIELD_NUMBER; + hash = (53 * hash) + getReplicaSelection().hashCode(); + } + if (hasOverrides()) { + hash = (37 * hash) + OVERRIDES_FIELD_NUMBER; + hash = (53 * hash) + getOverrides().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * AsymmetricAutoscalingOption specifies the scaling of replicas identified by
+     * the given selection.
+     * 
+ * + * Protobuf type {@code + * google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .class, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder.class); + } + + // Construct using + // com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getReplicaSelectionFieldBuilder(); + getOverridesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + replicaSelection_ = null; + if (replicaSelectionBuilder_ != null) { + replicaSelectionBuilder_.dispose(); + replicaSelectionBuilder_ = null; + } + overrides_ = null; + if (overridesBuilder_ != null) { + overridesBuilder_.dispose(); + overridesBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + build() { + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + buildPartial() { + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption result = + new com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption( + this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.replicaSelection_ = + replicaSelectionBuilder_ == null + ? replicaSelection_ + : replicaSelectionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.overrides_ = overridesBuilder_ == null ? overrides_ : overridesBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) { + return mergeFrom( + (com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + other) { + if (other + == com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .getDefaultInstance()) return this; + if (other.hasReplicaSelection()) { + mergeReplicaSelection(other.getReplicaSelection()); + } + if (other.hasOverrides()) { + mergeOverrides(other.getOverrides()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getReplicaSelectionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getOverridesFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.spanner.admin.instance.v1.ReplicaSelection replicaSelection_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaSelection, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder, + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder> + replicaSelectionBuilder_; + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replicaSelection field is set. + */ + public boolean hasReplicaSelection() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replicaSelection. + */ + public com.google.spanner.admin.instance.v1.ReplicaSelection getReplicaSelection() { + if (replicaSelectionBuilder_ == null) { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } else { + return replicaSelectionBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setReplicaSelection( + com.google.spanner.admin.instance.v1.ReplicaSelection value) { + if (replicaSelectionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + replicaSelection_ = value; + } else { + replicaSelectionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setReplicaSelection( + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder builderForValue) { + if (replicaSelectionBuilder_ == null) { + replicaSelection_ = builderForValue.build(); + } else { + replicaSelectionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeReplicaSelection( + com.google.spanner.admin.instance.v1.ReplicaSelection value) { + if (replicaSelectionBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && replicaSelection_ != null + && replicaSelection_ + != com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance()) { + getReplicaSelectionBuilder().mergeFrom(value); + } else { + replicaSelection_ = value; + } + } else { + replicaSelectionBuilder_.mergeFrom(value); + } + if (replicaSelection_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearReplicaSelection() { + bitField0_ = (bitField0_ & ~0x00000001); + replicaSelection_ = null; + if (replicaSelectionBuilder_ != null) { + replicaSelectionBuilder_.dispose(); + replicaSelectionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaSelection.Builder + getReplicaSelectionBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getReplicaSelectionFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder + getReplicaSelectionOrBuilder() { + if (replicaSelectionBuilder_ != null) { + return replicaSelectionBuilder_.getMessageOrBuilder(); + } else { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } + } + /** + * + * + *
+       * Required. Selects the replicas to which this AsymmetricAutoscalingOption
+       * applies. Only read-only replicas are supported.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaSelection, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder, + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder> + getReplicaSelectionFieldBuilder() { + if (replicaSelectionBuilder_ == null) { + replicaSelectionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaSelection, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder, + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder>( + getReplicaSelection(), getParentForChildren(), isClean()); + replicaSelection_ = null; + } + return replicaSelectionBuilder_; + } + + private com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + overrides_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder> + overridesBuilder_; + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the overrides field is set. + */ + public boolean hasOverrides() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The overrides. + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + getOverrides() { + if (overridesBuilder_ == null) { + return overrides_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.getDefaultInstance() + : overrides_; + } else { + return overridesBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setOverrides( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + value) { + if (overridesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + overrides_ = value; + } else { + overridesBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setOverrides( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder + builderForValue) { + if (overridesBuilder_ == null) { + overrides_ = builderForValue.build(); + } else { + overridesBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeOverrides( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides + value) { + if (overridesBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && overrides_ != null + && overrides_ + != com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.AutoscalingConfigOverrides + .getDefaultInstance()) { + getOverridesBuilder().mergeFrom(value); + } else { + overrides_ = value; + } + } else { + overridesBuilder_.mergeFrom(value); + } + if (overrides_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearOverrides() { + bitField0_ = (bitField0_ & ~0x00000002); + overrides_ = null; + if (overridesBuilder_ != null) { + overridesBuilder_.dispose(); + overridesBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder + getOverridesBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getOverridesFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder + getOverridesOrBuilder() { + if (overridesBuilder_ != null) { + return overridesBuilder_.getMessageOrBuilder(); + } else { + return overrides_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.getDefaultInstance() + : overrides_; + } + } + /** + * + * + *
+       * Optional. Overrides applied to the top-level autoscaling configuration
+       * for the selected replicas.
+       * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides overrides = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder> + getOverridesFieldBuilder() { + if (overridesBuilder_ == null) { + overridesBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverrides.Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .AutoscalingConfigOverridesOrBuilder>( + getOverrides(), getParentForChildren(), isClean()); + overrides_ = null; + } + return overridesBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption) + private static final com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption(); + } + + public static com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AsymmetricAutoscalingOption parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + public static final int AUTOSCALING_LIMITS_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + autoscalingLimits_; + /** + * + * + *
+   * Required. Autoscaling limits for an instance.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the autoscalingLimits field is set. + */ + @java.lang.Override + public boolean hasAutoscalingLimits() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. Autoscaling limits for an instance.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The autoscalingLimits. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + getAutoscalingLimits() { + return autoscalingLimits_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance() + : autoscalingLimits_; + } + /** + * + * + *
+   * Required. Autoscaling limits for an instance.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits autoscaling_limits = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimitsOrBuilder + getAutoscalingLimitsOrBuilder() { + return autoscalingLimits_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingLimits + .getDefaultInstance() + : autoscalingLimits_; + } + + public static final int AUTOSCALING_TARGETS_FIELD_NUMBER = 2; + private com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + autoscalingTargets_; + /** + * + * + *
+   * Required. The autoscaling targets for an instance.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the autoscalingTargets field is set. + */ + @java.lang.Override + public boolean hasAutoscalingTargets() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Required. The autoscaling targets for an instance.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The autoscalingTargets. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + getAutoscalingTargets() { + return autoscalingTargets_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + .getDefaultInstance() + : autoscalingTargets_; + } + /** + * + * + *
+   * Required. The autoscaling targets for an instance.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets autoscaling_targets = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargetsOrBuilder + getAutoscalingTargetsOrBuilder() { + return autoscalingTargets_ == null + ? com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets + .getDefaultInstance() + : autoscalingTargets_; + } + + public static final int ASYMMETRIC_AUTOSCALING_OPTIONS_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private java.util.List< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption> + asymmetricAutoscalingOptions_; + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption> + getAsymmetricAutoscalingOptionsList() { + return asymmetricAutoscalingOptions_; + } + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List< + ? extends + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder> + getAsymmetricAutoscalingOptionsOrBuilderList() { + return asymmetricAutoscalingOptions_; + } + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getAsymmetricAutoscalingOptionsCount() { + return asymmetricAutoscalingOptions_.size(); + } + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + getAsymmetricAutoscalingOptions(int index) { + return asymmetricAutoscalingOptions_.get(index); + } + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOptionOrBuilder + getAsymmetricAutoscalingOptionsOrBuilder(int index) { + return asymmetricAutoscalingOptions_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getAutoscalingLimits()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getAutoscalingTargets()); + } + for (int i = 0; i < asymmetricAutoscalingOptions_.size(); i++) { + output.writeMessage(3, asymmetricAutoscalingOptions_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getAutoscalingLimits()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getAutoscalingTargets()); + } + for (int i = 0; i < asymmetricAutoscalingOptions_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, asymmetricAutoscalingOptions_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.AutoscalingConfig)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.AutoscalingConfig other = + (com.google.spanner.admin.instance.v1.AutoscalingConfig) obj; + + if (hasAutoscalingLimits() != other.hasAutoscalingLimits()) return false; + if (hasAutoscalingLimits()) { + if (!getAutoscalingLimits().equals(other.getAutoscalingLimits())) return false; + } + if (hasAutoscalingTargets() != other.hasAutoscalingTargets()) return false; + if (hasAutoscalingTargets()) { + if (!getAutoscalingTargets().equals(other.getAutoscalingTargets())) return false; + } + if (!getAsymmetricAutoscalingOptionsList().equals(other.getAsymmetricAutoscalingOptionsList())) + return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasAutoscalingLimits()) { + hash = (37 * hash) + AUTOSCALING_LIMITS_FIELD_NUMBER; + hash = (53 * hash) + getAutoscalingLimits().hashCode(); + } + if (hasAutoscalingTargets()) { + hash = (37 * hash) + AUTOSCALING_TARGETS_FIELD_NUMBER; hash = (53 * hash) + getAutoscalingTargets().hashCode(); } + if (getAsymmetricAutoscalingOptionsCount() > 0) { + hash = (37 * hash) + ASYMMETRIC_AUTOSCALING_OPTIONS_FIELD_NUMBER; + hash = (53 * hash) + getAsymmetricAutoscalingOptionsList().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -2425,6 +4835,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getAutoscalingLimitsFieldBuilder(); getAutoscalingTargetsFieldBuilder(); + getAsymmetricAutoscalingOptionsFieldBuilder(); } } @@ -2442,6 +4853,13 @@ public Builder clear() { autoscalingTargetsBuilder_.dispose(); autoscalingTargetsBuilder_ = null; } + if (asymmetricAutoscalingOptionsBuilder_ == null) { + asymmetricAutoscalingOptions_ = java.util.Collections.emptyList(); + } else { + asymmetricAutoscalingOptions_ = null; + asymmetricAutoscalingOptionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -2469,11 +4887,26 @@ public com.google.spanner.admin.instance.v1.AutoscalingConfig build() { public com.google.spanner.admin.instance.v1.AutoscalingConfig buildPartial() { com.google.spanner.admin.instance.v1.AutoscalingConfig result = new com.google.spanner.admin.instance.v1.AutoscalingConfig(this); + buildPartialRepeatedFields(result); if (bitField0_ != 0) { buildPartial0(result); } - onBuilt(); - return result; + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.spanner.admin.instance.v1.AutoscalingConfig result) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + asymmetricAutoscalingOptions_ = + java.util.Collections.unmodifiableList(asymmetricAutoscalingOptions_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.asymmetricAutoscalingOptions_ = asymmetricAutoscalingOptions_; + } else { + result.asymmetricAutoscalingOptions_ = asymmetricAutoscalingOptionsBuilder_.build(); + } } private void buildPartial0(com.google.spanner.admin.instance.v1.AutoscalingConfig result) { @@ -2548,6 +4981,34 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.AutoscalingConfig if (other.hasAutoscalingTargets()) { mergeAutoscalingTargets(other.getAutoscalingTargets()); } + if (asymmetricAutoscalingOptionsBuilder_ == null) { + if (!other.asymmetricAutoscalingOptions_.isEmpty()) { + if (asymmetricAutoscalingOptions_.isEmpty()) { + asymmetricAutoscalingOptions_ = other.asymmetricAutoscalingOptions_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.addAll(other.asymmetricAutoscalingOptions_); + } + onChanged(); + } + } else { + if (!other.asymmetricAutoscalingOptions_.isEmpty()) { + if (asymmetricAutoscalingOptionsBuilder_.isEmpty()) { + asymmetricAutoscalingOptionsBuilder_.dispose(); + asymmetricAutoscalingOptionsBuilder_ = null; + asymmetricAutoscalingOptions_ = other.asymmetricAutoscalingOptions_; + bitField0_ = (bitField0_ & ~0x00000004); + asymmetricAutoscalingOptionsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getAsymmetricAutoscalingOptionsFieldBuilder() + : null; + } else { + asymmetricAutoscalingOptionsBuilder_.addAllMessages( + other.asymmetricAutoscalingOptions_); + } + } + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -2588,6 +5049,22 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: + { + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + m = + input.readMessage( + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption.parser(), + extensionRegistry); + if (asymmetricAutoscalingOptionsBuilder_ == null) { + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.add(m); + } else { + asymmetricAutoscalingOptionsBuilder_.addMessage(m); + } + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -3037,6 +5514,585 @@ public Builder clearAutoscalingTargets() { return autoscalingTargetsBuilder_; } + private java.util.List< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption> + asymmetricAutoscalingOptions_ = java.util.Collections.emptyList(); + + private void ensureAsymmetricAutoscalingOptionsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + asymmetricAutoscalingOptions_ = + new java.util.ArrayList< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption>( + asymmetricAutoscalingOptions_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder> + asymmetricAutoscalingOptionsBuilder_; + + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption> + getAsymmetricAutoscalingOptionsList() { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(asymmetricAutoscalingOptions_); + } else { + return asymmetricAutoscalingOptionsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getAsymmetricAutoscalingOptionsCount() { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + return asymmetricAutoscalingOptions_.size(); + } else { + return asymmetricAutoscalingOptionsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + getAsymmetricAutoscalingOptions(int index) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + return asymmetricAutoscalingOptions_.get(index); + } else { + return asymmetricAutoscalingOptionsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAsymmetricAutoscalingOptions( + int index, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption value) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.set(index, value); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAsymmetricAutoscalingOptions( + int index, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.Builder + builderForValue) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.set(index, builderForValue.build()); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAsymmetricAutoscalingOptions( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption value) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.add(value); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAsymmetricAutoscalingOptions( + int index, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption value) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.add(index, value); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAsymmetricAutoscalingOptions( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.Builder + builderForValue) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.add(builderForValue.build()); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAsymmetricAutoscalingOptions( + int index, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.Builder + builderForValue) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.add(index, builderForValue.build()); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAllAsymmetricAutoscalingOptions( + java.lang.Iterable< + ? extends + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOption> + values) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + ensureAsymmetricAutoscalingOptionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, asymmetricAutoscalingOptions_); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAsymmetricAutoscalingOptions() { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + asymmetricAutoscalingOptions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeAsymmetricAutoscalingOptions(int index) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + ensureAsymmetricAutoscalingOptionsIsMutable(); + asymmetricAutoscalingOptions_.remove(index); + onChanged(); + } else { + asymmetricAutoscalingOptionsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder + getAsymmetricAutoscalingOptionsBuilder(int index) { + return getAsymmetricAutoscalingOptionsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder + getAsymmetricAutoscalingOptionsOrBuilder(int index) { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + return asymmetricAutoscalingOptions_.get(index); + } else { + return asymmetricAutoscalingOptionsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List< + ? extends + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder> + getAsymmetricAutoscalingOptionsOrBuilderList() { + if (asymmetricAutoscalingOptionsBuilder_ != null) { + return asymmetricAutoscalingOptionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(asymmetricAutoscalingOptions_); + } + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder + addAsymmetricAutoscalingOptionsBuilder() { + return getAsymmetricAutoscalingOptionsFieldBuilder() + .addBuilder( + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .getDefaultInstance()); + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder + addAsymmetricAutoscalingOptionsBuilder(int index) { + return getAsymmetricAutoscalingOptionsFieldBuilder() + .addBuilder( + index, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .getDefaultInstance()); + } + /** + * + * + *
+     * Optional. Optional asymmetric autoscaling options.
+     * Replicas matching the replica selection criteria will be autoscaled
+     * independently from other replicas. The autoscaler will scale the replicas
+     * based on the utilization of replicas identified by the replica selection.
+     * Replica selections should not overlap with each other.
+     *
+     * Other replicas (those do not match any replica selection) will be
+     * autoscaled together and will have the same compute capacity allocated to
+     * them.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder> + getAsymmetricAutoscalingOptionsBuilderList() { + return getAsymmetricAutoscalingOptionsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder> + getAsymmetricAutoscalingOptionsFieldBuilder() { + if (asymmetricAutoscalingOptionsBuilder_ == null) { + asymmetricAutoscalingOptionsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption, + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + .Builder, + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder>( + asymmetricAutoscalingOptions_, + ((bitField0_ & 0x00000004) != 0), + getParentForChildren(), + isClean()); + asymmetricAutoscalingOptions_ = null; + } + return asymmetricAutoscalingOptionsBuilder_; + } + @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-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfigOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfigOrBuilder.java index e8471ed717f..9e9a6222286 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfigOrBuilder.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/AutoscalingConfigOrBuilder.java @@ -107,4 +107,112 @@ public interface AutoscalingConfigOrBuilder */ com.google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargetsOrBuilder getAutoscalingTargetsOrBuilder(); + + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List + getAsymmetricAutoscalingOptionsList(); + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption + getAsymmetricAutoscalingOptions(int index); + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getAsymmetricAutoscalingOptionsCount(); + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List< + ? extends + com.google.spanner.admin.instance.v1.AutoscalingConfig + .AsymmetricAutoscalingOptionOrBuilder> + getAsymmetricAutoscalingOptionsOrBuilderList(); + /** + * + * + *
+   * Optional. Optional asymmetric autoscaling options.
+   * Replicas matching the replica selection criteria will be autoscaled
+   * independently from other replicas. The autoscaler will scale the replicas
+   * based on the utilization of replicas identified by the replica selection.
+   * Replica selections should not overlap with each other.
+   *
+   * Other replicas (those do not match any replica selection) will be
+   * autoscaled together and will have the same compute capacity allocated to
+   * them.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOptionOrBuilder + getAsymmetricAutoscalingOptionsOrBuilder(int index); } diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CommonProto.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CommonProto.java index 488b513ca0a..a589f16c104 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CommonProto.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CommonProto.java @@ -32,6 +32,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_admin_instance_v1_OperationProgress_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_admin_instance_v1_OperationProgress_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_ReplicaSelection_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_ReplicaSelection_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -43,26 +47,28 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n-google/spanner/admin/instance/v1/commo" + "n.proto\022 google.spanner.admin.instance.v" - + "1\032\037google/protobuf/timestamp.proto\"\213\001\n\021O" - + "perationProgress\022\030\n\020progress_percent\030\001 \001" - + "(\005\022.\n\nstart_time\030\002 \001(\0132\032.google.protobuf" - + ".Timestamp\022,\n\010end_time\030\003 \001(\0132\032.google.pr" - + "otobuf.Timestamp*w\n\021FulfillmentPeriod\022\"\n" - + "\036FULFILLMENT_PERIOD_UNSPECIFIED\020\000\022\035\n\031FUL" - + "FILLMENT_PERIOD_NORMAL\020\001\022\037\n\033FULFILLMENT_" - + "PERIOD_EXTENDED\020\002B\375\001\n$com.google.spanner" - + ".admin.instance.v1B\013CommonProtoP\001ZFcloud" - + ".google.com/go/spanner/admin/instance/ap" - + "iv1/instancepb;instancepb\252\002&Google.Cloud" - + ".Spanner.Admin.Instance.V1\312\002&Google\\Clou" - + "d\\Spanner\\Admin\\Instance\\V1\352\002+Google::Cl" - + "oud::Spanner::Admin::Instance::V1b\006proto" - + "3" + + "1\032\037google/api/field_behavior.proto\032\037goog" + + "le/protobuf/timestamp.proto\"\213\001\n\021Operatio" + + "nProgress\022\030\n\020progress_percent\030\001 \001(\005\022.\n\ns" + + "tart_time\030\002 \001(\0132\032.google.protobuf.Timest" + + "amp\022,\n\010end_time\030\003 \001(\0132\032.google.protobuf." + + "Timestamp\")\n\020ReplicaSelection\022\025\n\010locatio" + + "n\030\001 \001(\tB\003\340A\002*w\n\021FulfillmentPeriod\022\"\n\036FUL" + + "FILLMENT_PERIOD_UNSPECIFIED\020\000\022\035\n\031FULFILL" + + "MENT_PERIOD_NORMAL\020\001\022\037\n\033FULFILLMENT_PERI" + + "OD_EXTENDED\020\002B\375\001\n$com.google.spanner.adm" + + "in.instance.v1B\013CommonProtoP\001ZFcloud.goo" + + "gle.com/go/spanner/admin/instance/apiv1/" + + "instancepb;instancepb\252\002&Google.Cloud.Spa" + + "nner.Admin.Instance.V1\312\002&Google\\Cloud\\Sp" + + "anner\\Admin\\Instance\\V1\352\002+Google::Cloud:" + + ":Spanner::Admin::Instance::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), }); internal_static_google_spanner_admin_instance_v1_OperationProgress_descriptor = @@ -73,6 +79,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "ProgressPercent", "StartTime", "EndTime", }); + internal_static_google_spanner_admin_instance_v1_ReplicaSelection_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_spanner_admin_instance_v1_ReplicaSelection_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_ReplicaSelection_descriptor, + new java.lang.String[] { + "Location", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); } diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/Instance.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/Instance.java index 823b4e595b9..1caf9592536 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/Instance.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/Instance.java @@ -42,6 +42,7 @@ private Instance() { name_ = ""; config_ = ""; displayName_ = ""; + replicaComputeCapacity_ = java.util.Collections.emptyList(); state_ = 0; endpointUris_ = com.google.protobuf.LazyStringArrayList.emptyList(); edition_ = 0; @@ -601,18 +602,25 @@ public com.google.protobuf.ByteString getDisplayNameBytes() { * * *
-   * The number of nodes allocated to this instance. At most one of either
-   * node_count or processing_units should be present in the message.
+   * The number of nodes allocated to this instance. At most, one of either
+   * `node_count` or `processing_units` should be present in the message.
    *
-   * Users can set the node_count field to specify the target number of nodes
+   * Users can set the `node_count` field to specify the target number of nodes
    * allocated to the instance.
    *
-   * This may be zero in API responses for instances that are not yet in state
-   * `READY`.
+   * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
+   * field and reflects the current number of nodes allocated to the instance.
    *
-   * See [the
-   * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-   * for more information about nodes and processing units.
+   * This might be zero in API responses for instances that are not yet in the
+   * `READY` state.
+   *
+   * If the instance has varying node count across replicas (achieved by
+   * setting asymmetric_autoscaling_options in autoscaling config), the
+   * node_count here is the maximum node count across all replicas.
+   *
+   * For more information, see
+   * [Compute capacity, nodes, and processing
+   * units](https://cloud.google.com/spanner/docs/compute-capacity).
    * 
* * int32 node_count = 5; @@ -630,18 +638,27 @@ public int getNodeCount() { * * *
-   * The number of processing units allocated to this instance. At most one of
-   * processing_units or node_count should be present in the message.
+   * The number of processing units allocated to this instance. At most, one of
+   * either `processing_units` or `node_count` should be present in the message.
    *
-   * Users can set the processing_units field to specify the target number of
+   * Users can set the `processing_units` field to specify the target number of
    * processing units allocated to the instance.
    *
-   * This may be zero in API responses for instances that are not yet in state
-   * `READY`.
+   * If autoscaling is enabled, `processing_units` is treated as an
+   * `OUTPUT_ONLY` field and reflects the current number of processing units
+   * allocated to the instance.
+   *
+   * This might be zero in API responses for instances that are not yet in the
+   * `READY` state.
    *
-   * See [the
-   * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-   * for more information about nodes and processing units.
+   * If the instance has varying processing units per replica
+   * (achieved by setting asymmetric_autoscaling_options in autoscaling config),
+   * the processing_units here is the maximum processing units across all
+   * replicas.
+   *
+   * For more information, see
+   * [Compute capacity, nodes and processing
+   * units](https://cloud.google.com/spanner/docs/compute-capacity).
    * 
* * int32 processing_units = 9; @@ -653,6 +670,102 @@ public int getProcessingUnits() { return processingUnits_; } + public static final int REPLICA_COMPUTE_CAPACITY_FIELD_NUMBER = 19; + + @SuppressWarnings("serial") + private java.util.List + replicaComputeCapacity_; + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List + getReplicaComputeCapacityList() { + return replicaComputeCapacity_; + } + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.List< + ? extends com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder> + getReplicaComputeCapacityOrBuilderList() { + return replicaComputeCapacity_; + } + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public int getReplicaComputeCapacityCount() { + return replicaComputeCapacity_.size(); + } + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity getReplicaComputeCapacity( + int index) { + return replicaComputeCapacity_.get(index); + } + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder + getReplicaComputeCapacityOrBuilder(int index) { + return replicaComputeCapacity_.get(index); + } + public static final int AUTOSCALING_CONFIG_FIELD_NUMBER = 17; private com.google.spanner.admin.instance.v1.AutoscalingConfig autoscalingConfig_; /** @@ -1200,6 +1313,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(17, getAutoscalingConfig()); } + for (int i = 0; i < replicaComputeCapacity_.size(); i++) { + output.writeMessage(19, replicaComputeCapacity_.get(i)); + } if (edition_ != com.google.spanner.admin.instance.v1.Instance.Edition.EDITION_UNSPECIFIED.getNumber()) { output.writeEnum(20, edition_); @@ -1259,6 +1375,11 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(17, getAutoscalingConfig()); } + for (int i = 0; i < replicaComputeCapacity_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 19, replicaComputeCapacity_.get(i)); + } if (edition_ != com.google.spanner.admin.instance.v1.Instance.Edition.EDITION_UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(20, edition_); @@ -1284,6 +1405,8 @@ public boolean equals(final java.lang.Object obj) { if (!getDisplayName().equals(other.getDisplayName())) return false; if (getNodeCount() != other.getNodeCount()) return false; if (getProcessingUnits() != other.getProcessingUnits()) return false; + if (!getReplicaComputeCapacityList().equals(other.getReplicaComputeCapacityList())) + return false; if (hasAutoscalingConfig() != other.hasAutoscalingConfig()) return false; if (hasAutoscalingConfig()) { if (!getAutoscalingConfig().equals(other.getAutoscalingConfig())) return false; @@ -1321,6 +1444,10 @@ public int hashCode() { hash = (53 * hash) + getNodeCount(); hash = (37 * hash) + PROCESSING_UNITS_FIELD_NUMBER; hash = (53 * hash) + getProcessingUnits(); + if (getReplicaComputeCapacityCount() > 0) { + hash = (37 * hash) + REPLICA_COMPUTE_CAPACITY_FIELD_NUMBER; + hash = (53 * hash) + getReplicaComputeCapacityList().hashCode(); + } if (hasAutoscalingConfig()) { hash = (37 * hash) + AUTOSCALING_CONFIG_FIELD_NUMBER; hash = (53 * hash) + getAutoscalingConfig().hashCode(); @@ -1507,6 +1634,7 @@ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getReplicaComputeCapacityFieldBuilder(); getAutoscalingConfigFieldBuilder(); getCreateTimeFieldBuilder(); getUpdateTimeFieldBuilder(); @@ -1522,6 +1650,13 @@ public Builder clear() { displayName_ = ""; nodeCount_ = 0; processingUnits_ = 0; + if (replicaComputeCapacityBuilder_ == null) { + replicaComputeCapacity_ = java.util.Collections.emptyList(); + } else { + replicaComputeCapacity_ = null; + replicaComputeCapacityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000020); autoscalingConfig_ = null; if (autoscalingConfigBuilder_ != null) { autoscalingConfigBuilder_.dispose(); @@ -1568,6 +1703,7 @@ public com.google.spanner.admin.instance.v1.Instance build() { public com.google.spanner.admin.instance.v1.Instance buildPartial() { com.google.spanner.admin.instance.v1.Instance result = new com.google.spanner.admin.instance.v1.Instance(this); + buildPartialRepeatedFields(result); if (bitField0_ != 0) { buildPartial0(result); } @@ -1575,6 +1711,18 @@ public com.google.spanner.admin.instance.v1.Instance buildPartial() { return result; } + private void buildPartialRepeatedFields(com.google.spanner.admin.instance.v1.Instance result) { + if (replicaComputeCapacityBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0)) { + replicaComputeCapacity_ = java.util.Collections.unmodifiableList(replicaComputeCapacity_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.replicaComputeCapacity_ = replicaComputeCapacity_; + } else { + result.replicaComputeCapacity_ = replicaComputeCapacityBuilder_.build(); + } + } + private void buildPartial0(com.google.spanner.admin.instance.v1.Instance result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000001) != 0)) { @@ -1593,33 +1741,33 @@ private void buildPartial0(com.google.spanner.admin.instance.v1.Instance result) result.processingUnits_ = processingUnits_; } int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000020) != 0)) { + if (((from_bitField0_ & 0x00000040) != 0)) { result.autoscalingConfig_ = autoscalingConfigBuilder_ == null ? autoscalingConfig_ : autoscalingConfigBuilder_.build(); to_bitField0_ |= 0x00000001; } - if (((from_bitField0_ & 0x00000040) != 0)) { + if (((from_bitField0_ & 0x00000080) != 0)) { result.state_ = state_; } - if (((from_bitField0_ & 0x00000080) != 0)) { + if (((from_bitField0_ & 0x00000100) != 0)) { result.labels_ = internalGetLabels(); result.labels_.makeImmutable(); } - if (((from_bitField0_ & 0x00000100) != 0)) { + if (((from_bitField0_ & 0x00000200) != 0)) { endpointUris_.makeImmutable(); result.endpointUris_ = endpointUris_; } - if (((from_bitField0_ & 0x00000200) != 0)) { + if (((from_bitField0_ & 0x00000400) != 0)) { result.createTime_ = createTimeBuilder_ == null ? createTime_ : createTimeBuilder_.build(); to_bitField0_ |= 0x00000002; } - if (((from_bitField0_ & 0x00000400) != 0)) { + if (((from_bitField0_ & 0x00000800) != 0)) { result.updateTime_ = updateTimeBuilder_ == null ? updateTime_ : updateTimeBuilder_.build(); to_bitField0_ |= 0x00000004; } - if (((from_bitField0_ & 0x00000800) != 0)) { + if (((from_bitField0_ & 0x00001000) != 0)) { result.edition_ = edition_; } result.bitField0_ |= to_bitField0_; @@ -1691,6 +1839,33 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.Instance other) { if (other.getProcessingUnits() != 0) { setProcessingUnits(other.getProcessingUnits()); } + if (replicaComputeCapacityBuilder_ == null) { + if (!other.replicaComputeCapacity_.isEmpty()) { + if (replicaComputeCapacity_.isEmpty()) { + replicaComputeCapacity_ = other.replicaComputeCapacity_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.addAll(other.replicaComputeCapacity_); + } + onChanged(); + } + } else { + if (!other.replicaComputeCapacity_.isEmpty()) { + if (replicaComputeCapacityBuilder_.isEmpty()) { + replicaComputeCapacityBuilder_.dispose(); + replicaComputeCapacityBuilder_ = null; + replicaComputeCapacity_ = other.replicaComputeCapacity_; + bitField0_ = (bitField0_ & ~0x00000020); + replicaComputeCapacityBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getReplicaComputeCapacityFieldBuilder() + : null; + } else { + replicaComputeCapacityBuilder_.addAllMessages(other.replicaComputeCapacity_); + } + } + } if (other.hasAutoscalingConfig()) { mergeAutoscalingConfig(other.getAutoscalingConfig()); } @@ -1698,11 +1873,11 @@ public Builder mergeFrom(com.google.spanner.admin.instance.v1.Instance other) { setStateValue(other.getStateValue()); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; if (!other.endpointUris_.isEmpty()) { if (endpointUris_.isEmpty()) { endpointUris_ = other.endpointUris_; - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; } else { ensureEndpointUrisIsMutable(); endpointUris_.addAll(other.endpointUris_); @@ -1771,7 +1946,7 @@ public Builder mergeFrom( case 48: { state_ = input.readEnum(); - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000080; break; } // case 48 case 58: @@ -1783,7 +1958,7 @@ public Builder mergeFrom( internalGetMutableLabels() .getMutableMap() .put(labels__.getKey(), labels__.getValue()); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; break; } // case 58 case 66: @@ -1802,26 +1977,40 @@ public Builder mergeFrom( case 90: { input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; break; } // case 90 case 98: { input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; break; } // case 98 case 138: { input.readMessage( getAutoscalingConfigFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; break; } // case 138 + case 154: + { + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity m = + input.readMessage( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.parser(), + extensionRegistry); + if (replicaComputeCapacityBuilder_ == null) { + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.add(m); + } else { + replicaComputeCapacityBuilder_.addMessage(m); + } + break; + } // case 154 case 160: { edition_ = input.readEnum(); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; break; } // case 160 default: @@ -2211,18 +2400,25 @@ public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { * * *
-     * The number of nodes allocated to this instance. At most one of either
-     * node_count or processing_units should be present in the message.
+     * The number of nodes allocated to this instance. At most, one of either
+     * `node_count` or `processing_units` should be present in the message.
      *
-     * Users can set the node_count field to specify the target number of nodes
+     * Users can set the `node_count` field to specify the target number of nodes
      * allocated to the instance.
      *
-     * This may be zero in API responses for instances that are not yet in state
-     * `READY`.
+     * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
+     * field and reflects the current number of nodes allocated to the instance.
+     *
+     * This might be zero in API responses for instances that are not yet in the
+     * `READY` state.
      *
-     * See [the
-     * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-     * for more information about nodes and processing units.
+     * If the instance has varying node count across replicas (achieved by
+     * setting asymmetric_autoscaling_options in autoscaling config), the
+     * node_count here is the maximum node count across all replicas.
+     *
+     * For more information, see
+     * [Compute capacity, nodes, and processing
+     * units](https://cloud.google.com/spanner/docs/compute-capacity).
      * 
* * int32 node_count = 5; @@ -2237,18 +2433,25 @@ public int getNodeCount() { * * *
-     * The number of nodes allocated to this instance. At most one of either
-     * node_count or processing_units should be present in the message.
+     * The number of nodes allocated to this instance. At most, one of either
+     * `node_count` or `processing_units` should be present in the message.
      *
-     * Users can set the node_count field to specify the target number of nodes
+     * Users can set the `node_count` field to specify the target number of nodes
      * allocated to the instance.
      *
-     * This may be zero in API responses for instances that are not yet in state
-     * `READY`.
+     * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
+     * field and reflects the current number of nodes allocated to the instance.
+     *
+     * This might be zero in API responses for instances that are not yet in the
+     * `READY` state.
      *
-     * See [the
-     * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-     * for more information about nodes and processing units.
+     * If the instance has varying node count across replicas (achieved by
+     * setting asymmetric_autoscaling_options in autoscaling config), the
+     * node_count here is the maximum node count across all replicas.
+     *
+     * For more information, see
+     * [Compute capacity, nodes, and processing
+     * units](https://cloud.google.com/spanner/docs/compute-capacity).
      * 
* * int32 node_count = 5; @@ -2267,18 +2470,25 @@ public Builder setNodeCount(int value) { * * *
-     * The number of nodes allocated to this instance. At most one of either
-     * node_count or processing_units should be present in the message.
+     * The number of nodes allocated to this instance. At most, one of either
+     * `node_count` or `processing_units` should be present in the message.
      *
-     * Users can set the node_count field to specify the target number of nodes
+     * Users can set the `node_count` field to specify the target number of nodes
      * allocated to the instance.
      *
-     * This may be zero in API responses for instances that are not yet in state
-     * `READY`.
+     * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
+     * field and reflects the current number of nodes allocated to the instance.
+     *
+     * This might be zero in API responses for instances that are not yet in the
+     * `READY` state.
+     *
+     * If the instance has varying node count across replicas (achieved by
+     * setting asymmetric_autoscaling_options in autoscaling config), the
+     * node_count here is the maximum node count across all replicas.
      *
-     * See [the
-     * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-     * for more information about nodes and processing units.
+     * For more information, see
+     * [Compute capacity, nodes, and processing
+     * units](https://cloud.google.com/spanner/docs/compute-capacity).
      * 
* * int32 node_count = 5; @@ -2297,18 +2507,27 @@ public Builder clearNodeCount() { * * *
-     * The number of processing units allocated to this instance. At most one of
-     * processing_units or node_count should be present in the message.
+     * The number of processing units allocated to this instance. At most, one of
+     * either `processing_units` or `node_count` should be present in the message.
      *
-     * Users can set the processing_units field to specify the target number of
+     * Users can set the `processing_units` field to specify the target number of
      * processing units allocated to the instance.
      *
-     * This may be zero in API responses for instances that are not yet in state
-     * `READY`.
+     * If autoscaling is enabled, `processing_units` is treated as an
+     * `OUTPUT_ONLY` field and reflects the current number of processing units
+     * allocated to the instance.
+     *
+     * This might be zero in API responses for instances that are not yet in the
+     * `READY` state.
      *
-     * See [the
-     * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-     * for more information about nodes and processing units.
+     * If the instance has varying processing units per replica
+     * (achieved by setting asymmetric_autoscaling_options in autoscaling config),
+     * the processing_units here is the maximum processing units across all
+     * replicas.
+     *
+     * For more information, see
+     * [Compute capacity, nodes and processing
+     * units](https://cloud.google.com/spanner/docs/compute-capacity).
      * 
* * int32 processing_units = 9; @@ -2323,18 +2542,27 @@ public int getProcessingUnits() { * * *
-     * The number of processing units allocated to this instance. At most one of
-     * processing_units or node_count should be present in the message.
+     * The number of processing units allocated to this instance. At most, one of
+     * either `processing_units` or `node_count` should be present in the message.
      *
-     * Users can set the processing_units field to specify the target number of
+     * Users can set the `processing_units` field to specify the target number of
      * processing units allocated to the instance.
      *
-     * This may be zero in API responses for instances that are not yet in state
-     * `READY`.
+     * If autoscaling is enabled, `processing_units` is treated as an
+     * `OUTPUT_ONLY` field and reflects the current number of processing units
+     * allocated to the instance.
      *
-     * See [the
-     * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-     * for more information about nodes and processing units.
+     * This might be zero in API responses for instances that are not yet in the
+     * `READY` state.
+     *
+     * If the instance has varying processing units per replica
+     * (achieved by setting asymmetric_autoscaling_options in autoscaling config),
+     * the processing_units here is the maximum processing units across all
+     * replicas.
+     *
+     * For more information, see
+     * [Compute capacity, nodes and processing
+     * units](https://cloud.google.com/spanner/docs/compute-capacity).
      * 
* * int32 processing_units = 9; @@ -2353,18 +2581,27 @@ public Builder setProcessingUnits(int value) { * * *
-     * The number of processing units allocated to this instance. At most one of
-     * processing_units or node_count should be present in the message.
+     * The number of processing units allocated to this instance. At most, one of
+     * either `processing_units` or `node_count` should be present in the message.
      *
-     * Users can set the processing_units field to specify the target number of
+     * Users can set the `processing_units` field to specify the target number of
      * processing units allocated to the instance.
      *
-     * This may be zero in API responses for instances that are not yet in state
-     * `READY`.
+     * If autoscaling is enabled, `processing_units` is treated as an
+     * `OUTPUT_ONLY` field and reflects the current number of processing units
+     * allocated to the instance.
      *
-     * See [the
-     * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-     * for more information about nodes and processing units.
+     * This might be zero in API responses for instances that are not yet in the
+     * `READY` state.
+     *
+     * If the instance has varying processing units per replica
+     * (achieved by setting asymmetric_autoscaling_options in autoscaling config),
+     * the processing_units here is the maximum processing units across all
+     * replicas.
+     *
+     * For more information, see
+     * [Compute capacity, nodes and processing
+     * units](https://cloud.google.com/spanner/docs/compute-capacity).
      * 
* * int32 processing_units = 9; @@ -2378,6 +2615,449 @@ public Builder clearProcessingUnits() { return this; } + private java.util.List + replicaComputeCapacity_ = java.util.Collections.emptyList(); + + private void ensureReplicaComputeCapacityIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + replicaComputeCapacity_ = + new java.util.ArrayList( + replicaComputeCapacity_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder> + replicaComputeCapacityBuilder_; + + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getReplicaComputeCapacityList() { + if (replicaComputeCapacityBuilder_ == null) { + return java.util.Collections.unmodifiableList(replicaComputeCapacity_); + } else { + return replicaComputeCapacityBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public int getReplicaComputeCapacityCount() { + if (replicaComputeCapacityBuilder_ == null) { + return replicaComputeCapacity_.size(); + } else { + return replicaComputeCapacityBuilder_.getCount(); + } + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity getReplicaComputeCapacity( + int index) { + if (replicaComputeCapacityBuilder_ == null) { + return replicaComputeCapacity_.get(index); + } else { + return replicaComputeCapacityBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setReplicaComputeCapacity( + int index, com.google.spanner.admin.instance.v1.ReplicaComputeCapacity value) { + if (replicaComputeCapacityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.set(index, value); + onChanged(); + } else { + replicaComputeCapacityBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setReplicaComputeCapacity( + int index, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder builderForValue) { + if (replicaComputeCapacityBuilder_ == null) { + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.set(index, builderForValue.build()); + onChanged(); + } else { + replicaComputeCapacityBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addReplicaComputeCapacity( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity value) { + if (replicaComputeCapacityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.add(value); + onChanged(); + } else { + replicaComputeCapacityBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addReplicaComputeCapacity( + int index, com.google.spanner.admin.instance.v1.ReplicaComputeCapacity value) { + if (replicaComputeCapacityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.add(index, value); + onChanged(); + } else { + replicaComputeCapacityBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addReplicaComputeCapacity( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder builderForValue) { + if (replicaComputeCapacityBuilder_ == null) { + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.add(builderForValue.build()); + onChanged(); + } else { + replicaComputeCapacityBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addReplicaComputeCapacity( + int index, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder builderForValue) { + if (replicaComputeCapacityBuilder_ == null) { + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.add(index, builderForValue.build()); + onChanged(); + } else { + replicaComputeCapacityBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder addAllReplicaComputeCapacity( + java.lang.Iterable + values) { + if (replicaComputeCapacityBuilder_ == null) { + ensureReplicaComputeCapacityIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, replicaComputeCapacity_); + onChanged(); + } else { + replicaComputeCapacityBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearReplicaComputeCapacity() { + if (replicaComputeCapacityBuilder_ == null) { + replicaComputeCapacity_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + replicaComputeCapacityBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeReplicaComputeCapacity(int index) { + if (replicaComputeCapacityBuilder_ == null) { + ensureReplicaComputeCapacityIsMutable(); + replicaComputeCapacity_.remove(index); + onChanged(); + } else { + replicaComputeCapacityBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder + getReplicaComputeCapacityBuilder(int index) { + return getReplicaComputeCapacityFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder + getReplicaComputeCapacityOrBuilder(int index) { + if (replicaComputeCapacityBuilder_ == null) { + return replicaComputeCapacity_.get(index); + } else { + return replicaComputeCapacityBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List< + ? extends com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder> + getReplicaComputeCapacityOrBuilderList() { + if (replicaComputeCapacityBuilder_ != null) { + return replicaComputeCapacityBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(replicaComputeCapacity_); + } + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder + addReplicaComputeCapacityBuilder() { + return getReplicaComputeCapacityFieldBuilder() + .addBuilder( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder + addReplicaComputeCapacityBuilder(int index) { + return getReplicaComputeCapacityFieldBuilder() + .addBuilder( + index, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.getDefaultInstance()); + } + /** + * + * + *
+     * Output only. Lists the compute capacity per ReplicaSelection. A replica
+     * selection identifies a set of replicas with common properties. Replicas
+     * identified by a ReplicaSelection are scaled with the same compute capacity.
+     * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public java.util.List + getReplicaComputeCapacityBuilderList() { + return getReplicaComputeCapacityFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder> + getReplicaComputeCapacityFieldBuilder() { + if (replicaComputeCapacityBuilder_ == null) { + replicaComputeCapacityBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder>( + replicaComputeCapacity_, + ((bitField0_ & 0x00000020) != 0), + getParentForChildren(), + isClean()); + replicaComputeCapacity_ = null; + } + return replicaComputeCapacityBuilder_; + } + private com.google.spanner.admin.instance.v1.AutoscalingConfig autoscalingConfig_; private com.google.protobuf.SingleFieldBuilderV3< com.google.spanner.admin.instance.v1.AutoscalingConfig, @@ -2401,7 +3081,7 @@ public Builder clearProcessingUnits() { * @return Whether the autoscalingConfig field is set. */ public boolean hasAutoscalingConfig() { - return ((bitField0_ & 0x00000020) != 0); + return ((bitField0_ & 0x00000040) != 0); } /** * @@ -2452,7 +3132,7 @@ public Builder setAutoscalingConfig( } else { autoscalingConfigBuilder_.setMessage(value); } - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; onChanged(); return this; } @@ -2477,7 +3157,7 @@ public Builder setAutoscalingConfig( } else { autoscalingConfigBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; onChanged(); return this; } @@ -2498,7 +3178,7 @@ public Builder setAutoscalingConfig( public Builder mergeAutoscalingConfig( com.google.spanner.admin.instance.v1.AutoscalingConfig value) { if (autoscalingConfigBuilder_ == null) { - if (((bitField0_ & 0x00000020) != 0) + if (((bitField0_ & 0x00000040) != 0) && autoscalingConfig_ != null && autoscalingConfig_ != com.google.spanner.admin.instance.v1.AutoscalingConfig.getDefaultInstance()) { @@ -2510,7 +3190,7 @@ public Builder mergeAutoscalingConfig( autoscalingConfigBuilder_.mergeFrom(value); } if (autoscalingConfig_ != null) { - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; onChanged(); } return this; @@ -2530,7 +3210,7 @@ public Builder mergeAutoscalingConfig( * */ public Builder clearAutoscalingConfig() { - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); autoscalingConfig_ = null; if (autoscalingConfigBuilder_ != null) { autoscalingConfigBuilder_.dispose(); @@ -2555,7 +3235,7 @@ public Builder clearAutoscalingConfig() { */ public com.google.spanner.admin.instance.v1.AutoscalingConfig.Builder getAutoscalingConfigBuilder() { - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; onChanged(); return getAutoscalingConfigFieldBuilder().getBuilder(); } @@ -2656,7 +3336,7 @@ public int getStateValue() { */ public Builder setStateValue(int value) { state_ = value; - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000080; onChanged(); return this; } @@ -2707,7 +3387,7 @@ public Builder setState(com.google.spanner.admin.instance.v1.Instance.State valu if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000080; state_ = value.getNumber(); onChanged(); return this; @@ -2730,7 +3410,7 @@ public Builder setState(com.google.spanner.admin.instance.v1.Instance.State valu * @return This builder for chaining. */ public Builder clearState() { - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000080); state_ = 0; onChanged(); return this; @@ -2753,7 +3433,7 @@ private com.google.protobuf.MapField interna if (!labels_.isMutable()) { labels_ = labels_.copy(); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return labels_; } @@ -2918,7 +3598,7 @@ public java.lang.String getLabelsOrThrow(java.lang.String key) { } public Builder clearLabels() { - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000100); internalGetMutableLabels().getMutableMap().clear(); return this; } @@ -2961,7 +3641,7 @@ public Builder removeLabels(java.lang.String key) { /** Use alternate mutation accessors instead. */ @java.lang.Deprecated public java.util.Map getMutableLabels() { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; return internalGetMutableLabels().getMutableMap(); } /** @@ -3001,7 +3681,7 @@ public Builder putLabels(java.lang.String key, java.lang.String value) { throw new NullPointerException("map value"); } internalGetMutableLabels().getMutableMap().put(key, value); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; return this; } /** @@ -3035,7 +3715,7 @@ public Builder putLabels(java.lang.String key, java.lang.String value) { */ public Builder putAllLabels(java.util.Map values) { internalGetMutableLabels().getMutableMap().putAll(values); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; return this; } @@ -3046,7 +3726,7 @@ private void ensureEndpointUrisIsMutable() { if (!endpointUris_.isModifiable()) { endpointUris_ = new com.google.protobuf.LazyStringArrayList(endpointUris_); } - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; } /** * @@ -3126,7 +3806,7 @@ public Builder setEndpointUris(int index, java.lang.String value) { } ensureEndpointUrisIsMutable(); endpointUris_.set(index, value); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; onChanged(); return this; } @@ -3148,7 +3828,7 @@ public Builder addEndpointUris(java.lang.String value) { } ensureEndpointUrisIsMutable(); endpointUris_.add(value); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; onChanged(); return this; } @@ -3167,7 +3847,7 @@ public Builder addEndpointUris(java.lang.String value) { public Builder addAllEndpointUris(java.lang.Iterable values) { ensureEndpointUrisIsMutable(); com.google.protobuf.AbstractMessageLite.Builder.addAll(values, endpointUris_); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; onChanged(); return this; } @@ -3184,7 +3864,7 @@ public Builder addAllEndpointUris(java.lang.Iterable values) { */ public Builder clearEndpointUris() { endpointUris_ = com.google.protobuf.LazyStringArrayList.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000200); ; onChanged(); return this; @@ -3208,7 +3888,7 @@ public Builder addEndpointUrisBytes(com.google.protobuf.ByteString value) { checkByteStringIsUtf8(value); ensureEndpointUrisIsMutable(); endpointUris_.add(value); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; onChanged(); return this; } @@ -3233,7 +3913,7 @@ public Builder addEndpointUrisBytes(com.google.protobuf.ByteString value) { * @return Whether the createTime field is set. */ public boolean hasCreateTime() { - return ((bitField0_ & 0x00000200) != 0); + return ((bitField0_ & 0x00000400) != 0); } /** * @@ -3277,7 +3957,7 @@ public Builder setCreateTime(com.google.protobuf.Timestamp value) { } else { createTimeBuilder_.setMessage(value); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -3298,7 +3978,7 @@ public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForVal } else { createTimeBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -3315,7 +3995,7 @@ public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForVal */ public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { if (createTimeBuilder_ == null) { - if (((bitField0_ & 0x00000200) != 0) + if (((bitField0_ & 0x00000400) != 0) && createTime_ != null && createTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { getCreateTimeBuilder().mergeFrom(value); @@ -3326,7 +4006,7 @@ public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { createTimeBuilder_.mergeFrom(value); } if (createTime_ != null) { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); } return this; @@ -3343,7 +4023,7 @@ public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { * */ public Builder clearCreateTime() { - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000400); createTime_ = null; if (createTimeBuilder_ != null) { createTimeBuilder_.dispose(); @@ -3364,7 +4044,7 @@ public Builder clearCreateTime() { * */ public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return getCreateTimeFieldBuilder().getBuilder(); } @@ -3436,7 +4116,7 @@ public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { * @return Whether the updateTime field is set. */ public boolean hasUpdateTime() { - return ((bitField0_ & 0x00000400) != 0); + return ((bitField0_ & 0x00000800) != 0); } /** * @@ -3480,7 +4160,7 @@ public Builder setUpdateTime(com.google.protobuf.Timestamp value) { } else { updateTimeBuilder_.setMessage(value); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -3501,7 +4181,7 @@ public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForVal } else { updateTimeBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -3518,7 +4198,7 @@ public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForVal */ public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { if (updateTimeBuilder_ == null) { - if (((bitField0_ & 0x00000400) != 0) + if (((bitField0_ & 0x00000800) != 0) && updateTime_ != null && updateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { getUpdateTimeBuilder().mergeFrom(value); @@ -3529,7 +4209,7 @@ public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { updateTimeBuilder_.mergeFrom(value); } if (updateTime_ != null) { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); } return this; @@ -3546,7 +4226,7 @@ public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { * */ public Builder clearUpdateTime() { - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000800); updateTime_ = null; if (updateTimeBuilder_ != null) { updateTimeBuilder_.dispose(); @@ -3567,7 +4247,7 @@ public Builder clearUpdateTime() { * */ public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return getUpdateTimeFieldBuilder().getBuilder(); } @@ -3653,7 +4333,7 @@ public int getEditionValue() { */ public Builder setEditionValue(int value) { edition_ = value; - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; onChanged(); return this; } @@ -3696,7 +4376,7 @@ public Builder setEdition(com.google.spanner.admin.instance.v1.Instance.Edition if (value == null) { throw new NullPointerException(); } - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; edition_ = value.getNumber(); onChanged(); return this; @@ -3715,7 +4395,7 @@ public Builder setEdition(com.google.spanner.admin.instance.v1.Instance.Edition * @return This builder for chaining. */ public Builder clearEdition() { - bitField0_ = (bitField0_ & ~0x00000800); + bitField0_ = (bitField0_ & ~0x00001000); edition_ = 0; onChanged(); return this; diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceOrBuilder.java index 17425ffd0a4..db7d23f94e0 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceOrBuilder.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceOrBuilder.java @@ -121,18 +121,25 @@ public interface InstanceOrBuilder * * *
-   * The number of nodes allocated to this instance. At most one of either
-   * node_count or processing_units should be present in the message.
+   * The number of nodes allocated to this instance. At most, one of either
+   * `node_count` or `processing_units` should be present in the message.
    *
-   * Users can set the node_count field to specify the target number of nodes
+   * Users can set the `node_count` field to specify the target number of nodes
    * allocated to the instance.
    *
-   * This may be zero in API responses for instances that are not yet in state
-   * `READY`.
+   * If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
+   * field and reflects the current number of nodes allocated to the instance.
    *
-   * See [the
-   * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-   * for more information about nodes and processing units.
+   * This might be zero in API responses for instances that are not yet in the
+   * `READY` state.
+   *
+   * If the instance has varying node count across replicas (achieved by
+   * setting asymmetric_autoscaling_options in autoscaling config), the
+   * node_count here is the maximum node count across all replicas.
+   *
+   * For more information, see
+   * [Compute capacity, nodes, and processing
+   * units](https://cloud.google.com/spanner/docs/compute-capacity).
    * 
* * int32 node_count = 5; @@ -145,18 +152,27 @@ public interface InstanceOrBuilder * * *
-   * The number of processing units allocated to this instance. At most one of
-   * processing_units or node_count should be present in the message.
+   * The number of processing units allocated to this instance. At most, one of
+   * either `processing_units` or `node_count` should be present in the message.
    *
-   * Users can set the processing_units field to specify the target number of
+   * Users can set the `processing_units` field to specify the target number of
    * processing units allocated to the instance.
    *
-   * This may be zero in API responses for instances that are not yet in state
-   * `READY`.
+   * If autoscaling is enabled, `processing_units` is treated as an
+   * `OUTPUT_ONLY` field and reflects the current number of processing units
+   * allocated to the instance.
+   *
+   * This might be zero in API responses for instances that are not yet in the
+   * `READY` state.
    *
-   * See [the
-   * documentation](https://cloud.google.com/spanner/docs/compute-capacity)
-   * for more information about nodes and processing units.
+   * If the instance has varying processing units per replica
+   * (achieved by setting asymmetric_autoscaling_options in autoscaling config),
+   * the processing_units here is the maximum processing units across all
+   * replicas.
+   *
+   * For more information, see
+   * [Compute capacity, nodes and processing
+   * units](https://cloud.google.com/spanner/docs/compute-capacity).
    * 
* * int32 processing_units = 9; @@ -165,6 +181,80 @@ public interface InstanceOrBuilder */ int getProcessingUnits(); + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List + getReplicaComputeCapacityList(); + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity getReplicaComputeCapacity(int index); + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getReplicaComputeCapacityCount(); + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.List + getReplicaComputeCapacityOrBuilderList(); + /** + * + * + *
+   * Output only. Lists the compute capacity per ReplicaSelection. A replica
+   * selection identifies a set of replicas with common properties. Replicas
+   * identified by a ReplicaSelection are scaled with the same compute capacity.
+   * 
+ * + * + * repeated .google.spanner.admin.instance.v1.ReplicaComputeCapacity replica_compute_capacity = 19 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder + getReplicaComputeCapacityOrBuilder(int index); + /** * * diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacity.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacity.java new file mode 100644 index 00000000000..1e64f6b80b9 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacity.java @@ -0,0 +1,1154 @@ +/* + * Copyright 2024 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/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.5 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * ReplicaComputeCapacity describes the amount of server resources that are
+ * allocated to each replica identified by the replica selection.
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ReplicaComputeCapacity} + */ +public final class ReplicaComputeCapacity extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.ReplicaComputeCapacity) + ReplicaComputeCapacityOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplicaComputeCapacity.newBuilder() to construct. + private ReplicaComputeCapacity(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplicaComputeCapacity() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplicaComputeCapacity(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.class, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder.class); + } + + private int bitField0_; + private int computeCapacityCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object computeCapacity_; + + public enum ComputeCapacityCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + NODE_COUNT(2), + PROCESSING_UNITS(3), + COMPUTECAPACITY_NOT_SET(0); + private final int value; + + private ComputeCapacityCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ComputeCapacityCase valueOf(int value) { + return forNumber(value); + } + + public static ComputeCapacityCase forNumber(int value) { + switch (value) { + case 2: + return NODE_COUNT; + case 3: + return PROCESSING_UNITS; + case 0: + return COMPUTECAPACITY_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ComputeCapacityCase getComputeCapacityCase() { + return ComputeCapacityCase.forNumber(computeCapacityCase_); + } + + public static final int REPLICA_SELECTION_FIELD_NUMBER = 1; + private com.google.spanner.admin.instance.v1.ReplicaSelection replicaSelection_; + /** + * + * + *
+   * Required. Identifies replicas by specified properties.
+   * All replicas in the selection have the same amount of compute capacity.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replicaSelection field is set. + */ + @java.lang.Override + public boolean hasReplicaSelection() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. Identifies replicas by specified properties.
+   * All replicas in the selection have the same amount of compute capacity.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replicaSelection. + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelection getReplicaSelection() { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } + /** + * + * + *
+   * Required. Identifies replicas by specified properties.
+   * All replicas in the selection have the same amount of compute capacity.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder + getReplicaSelectionOrBuilder() { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } + + public static final int NODE_COUNT_FIELD_NUMBER = 2; + /** + * + * + *
+   * The number of nodes allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 node_count = 2; + * + * @return Whether the nodeCount field is set. + */ + @java.lang.Override + public boolean hasNodeCount() { + return computeCapacityCase_ == 2; + } + /** + * + * + *
+   * The number of nodes allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 node_count = 2; + * + * @return The nodeCount. + */ + @java.lang.Override + public int getNodeCount() { + if (computeCapacityCase_ == 2) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + + public static final int PROCESSING_UNITS_FIELD_NUMBER = 3; + /** + * + * + *
+   * The number of processing units allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 processing_units = 3; + * + * @return Whether the processingUnits field is set. + */ + @java.lang.Override + public boolean hasProcessingUnits() { + return computeCapacityCase_ == 3; + } + /** + * + * + *
+   * The number of processing units allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 processing_units = 3; + * + * @return The processingUnits. + */ + @java.lang.Override + public int getProcessingUnits() { + if (computeCapacityCase_ == 3) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getReplicaSelection()); + } + if (computeCapacityCase_ == 2) { + output.writeInt32(2, (int) ((java.lang.Integer) computeCapacity_)); + } + if (computeCapacityCase_ == 3) { + output.writeInt32(3, (int) ((java.lang.Integer) computeCapacity_)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getReplicaSelection()); + } + if (computeCapacityCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeInt32Size( + 2, (int) ((java.lang.Integer) computeCapacity_)); + } + if (computeCapacityCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeInt32Size( + 3, (int) ((java.lang.Integer) computeCapacity_)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.ReplicaComputeCapacity)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity other = + (com.google.spanner.admin.instance.v1.ReplicaComputeCapacity) obj; + + if (hasReplicaSelection() != other.hasReplicaSelection()) return false; + if (hasReplicaSelection()) { + if (!getReplicaSelection().equals(other.getReplicaSelection())) return false; + } + if (!getComputeCapacityCase().equals(other.getComputeCapacityCase())) return false; + switch (computeCapacityCase_) { + case 2: + if (getNodeCount() != other.getNodeCount()) return false; + break; + case 3: + if (getProcessingUnits() != other.getProcessingUnits()) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasReplicaSelection()) { + hash = (37 * hash) + REPLICA_SELECTION_FIELD_NUMBER; + hash = (53 * hash) + getReplicaSelection().hashCode(); + } + switch (computeCapacityCase_) { + case 2: + hash = (37 * hash) + NODE_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getNodeCount(); + break; + case 3: + hash = (37 * hash) + PROCESSING_UNITS_FIELD_NUMBER; + hash = (53 * hash) + getProcessingUnits(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ReplicaComputeCapacity describes the amount of server resources that are
+   * allocated to each replica identified by the replica selection.
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ReplicaComputeCapacity} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.ReplicaComputeCapacity) + com.google.spanner.admin.instance.v1.ReplicaComputeCapacityOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.class, + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.Builder.class); + } + + // Construct using com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getReplicaSelectionFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + replicaSelection_ = null; + if (replicaSelectionBuilder_ != null) { + replicaSelectionBuilder_.dispose(); + replicaSelectionBuilder_ = null; + } + computeCapacityCase_ = 0; + computeCapacity_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.SpannerInstanceAdminProto + .internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity build() { + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity buildPartial() { + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity result = + new com.google.spanner.admin.instance.v1.ReplicaComputeCapacity(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.admin.instance.v1.ReplicaComputeCapacity result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.replicaSelection_ = + replicaSelectionBuilder_ == null ? replicaSelection_ : replicaSelectionBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs( + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity result) { + result.computeCapacityCase_ = computeCapacityCase_; + result.computeCapacity_ = this.computeCapacity_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.ReplicaComputeCapacity) { + return mergeFrom((com.google.spanner.admin.instance.v1.ReplicaComputeCapacity) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.admin.instance.v1.ReplicaComputeCapacity other) { + if (other == com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.getDefaultInstance()) + return this; + if (other.hasReplicaSelection()) { + mergeReplicaSelection(other.getReplicaSelection()); + } + switch (other.getComputeCapacityCase()) { + case NODE_COUNT: + { + setNodeCount(other.getNodeCount()); + break; + } + case PROCESSING_UNITS: + { + setProcessingUnits(other.getProcessingUnits()); + break; + } + case COMPUTECAPACITY_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getReplicaSelectionFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + computeCapacity_ = input.readInt32(); + computeCapacityCase_ = 2; + break; + } // case 16 + case 24: + { + computeCapacity_ = input.readInt32(); + computeCapacityCase_ = 3; + break; + } // case 24 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int computeCapacityCase_ = 0; + private java.lang.Object computeCapacity_; + + public ComputeCapacityCase getComputeCapacityCase() { + return ComputeCapacityCase.forNumber(computeCapacityCase_); + } + + public Builder clearComputeCapacity() { + computeCapacityCase_ = 0; + computeCapacity_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.spanner.admin.instance.v1.ReplicaSelection replicaSelection_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaSelection, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder, + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder> + replicaSelectionBuilder_; + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replicaSelection field is set. + */ + public boolean hasReplicaSelection() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replicaSelection. + */ + public com.google.spanner.admin.instance.v1.ReplicaSelection getReplicaSelection() { + if (replicaSelectionBuilder_ == null) { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } else { + return replicaSelectionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setReplicaSelection( + com.google.spanner.admin.instance.v1.ReplicaSelection value) { + if (replicaSelectionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + replicaSelection_ = value; + } else { + replicaSelectionBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setReplicaSelection( + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder builderForValue) { + if (replicaSelectionBuilder_ == null) { + replicaSelection_ = builderForValue.build(); + } else { + replicaSelectionBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeReplicaSelection( + com.google.spanner.admin.instance.v1.ReplicaSelection value) { + if (replicaSelectionBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && replicaSelection_ != null + && replicaSelection_ + != com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance()) { + getReplicaSelectionBuilder().mergeFrom(value); + } else { + replicaSelection_ = value; + } + } else { + replicaSelectionBuilder_.mergeFrom(value); + } + if (replicaSelection_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearReplicaSelection() { + bitField0_ = (bitField0_ & ~0x00000001); + replicaSelection_ = null; + if (replicaSelectionBuilder_ != null) { + replicaSelectionBuilder_.dispose(); + replicaSelectionBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaSelection.Builder + getReplicaSelectionBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getReplicaSelectionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder + getReplicaSelectionOrBuilder() { + if (replicaSelectionBuilder_ != null) { + return replicaSelectionBuilder_.getMessageOrBuilder(); + } else { + return replicaSelection_ == null + ? com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance() + : replicaSelection_; + } + } + /** + * + * + *
+     * Required. Identifies replicas by specified properties.
+     * All replicas in the selection have the same amount of compute capacity.
+     * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaSelection, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder, + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder> + getReplicaSelectionFieldBuilder() { + if (replicaSelectionBuilder_ == null) { + replicaSelectionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.admin.instance.v1.ReplicaSelection, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder, + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder>( + getReplicaSelection(), getParentForChildren(), isClean()); + replicaSelection_ = null; + } + return replicaSelectionBuilder_; + } + + /** + * + * + *
+     * The number of nodes allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 node_count = 2; + * + * @return Whether the nodeCount field is set. + */ + public boolean hasNodeCount() { + return computeCapacityCase_ == 2; + } + /** + * + * + *
+     * The number of nodes allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 node_count = 2; + * + * @return The nodeCount. + */ + public int getNodeCount() { + if (computeCapacityCase_ == 2) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + /** + * + * + *
+     * The number of nodes allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 node_count = 2; + * + * @param value The nodeCount to set. + * @return This builder for chaining. + */ + public Builder setNodeCount(int value) { + + computeCapacityCase_ = 2; + computeCapacity_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of nodes allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 node_count = 2; + * + * @return This builder for chaining. + */ + public Builder clearNodeCount() { + if (computeCapacityCase_ == 2) { + computeCapacityCase_ = 0; + computeCapacity_ = null; + onChanged(); + } + return this; + } + + /** + * + * + *
+     * The number of processing units allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 processing_units = 3; + * + * @return Whether the processingUnits field is set. + */ + public boolean hasProcessingUnits() { + return computeCapacityCase_ == 3; + } + /** + * + * + *
+     * The number of processing units allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 processing_units = 3; + * + * @return The processingUnits. + */ + public int getProcessingUnits() { + if (computeCapacityCase_ == 3) { + return (java.lang.Integer) computeCapacity_; + } + return 0; + } + /** + * + * + *
+     * The number of processing units allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 processing_units = 3; + * + * @param value The processingUnits to set. + * @return This builder for chaining. + */ + public Builder setProcessingUnits(int value) { + + computeCapacityCase_ = 3; + computeCapacity_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of processing units allocated to each replica.
+     *
+     * This may be zero in API responses for instances that are not yet in
+     * state `READY`.
+     * 
+ * + * int32 processing_units = 3; + * + * @return This builder for chaining. + */ + public Builder clearProcessingUnits() { + if (computeCapacityCase_ == 3) { + computeCapacityCase_ = 0; + computeCapacity_ = null; + onChanged(); + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.ReplicaComputeCapacity) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.ReplicaComputeCapacity) + private static final com.google.spanner.admin.instance.v1.ReplicaComputeCapacity DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.ReplicaComputeCapacity(); + } + + public static com.google.spanner.admin.instance.v1.ReplicaComputeCapacity getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplicaComputeCapacity parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaComputeCapacity getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacityOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacityOrBuilder.java new file mode 100644 index 00000000000..a8eeea2cdcb --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaComputeCapacityOrBuilder.java @@ -0,0 +1,135 @@ +/* + * Copyright 2024 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/instance/v1/spanner_instance_admin.proto + +// Protobuf Java Version: 3.25.5 +package com.google.spanner.admin.instance.v1; + +public interface ReplicaComputeCapacityOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.ReplicaComputeCapacity) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Identifies replicas by specified properties.
+   * All replicas in the selection have the same amount of compute capacity.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the replicaSelection field is set. + */ + boolean hasReplicaSelection(); + /** + * + * + *
+   * Required. Identifies replicas by specified properties.
+   * All replicas in the selection have the same amount of compute capacity.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The replicaSelection. + */ + com.google.spanner.admin.instance.v1.ReplicaSelection getReplicaSelection(); + /** + * + * + *
+   * Required. Identifies replicas by specified properties.
+   * All replicas in the selection have the same amount of compute capacity.
+   * 
+ * + * + * .google.spanner.admin.instance.v1.ReplicaSelection replica_selection = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder getReplicaSelectionOrBuilder(); + + /** + * + * + *
+   * The number of nodes allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 node_count = 2; + * + * @return Whether the nodeCount field is set. + */ + boolean hasNodeCount(); + /** + * + * + *
+   * The number of nodes allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 node_count = 2; + * + * @return The nodeCount. + */ + int getNodeCount(); + + /** + * + * + *
+   * The number of processing units allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 processing_units = 3; + * + * @return Whether the processingUnits field is set. + */ + boolean hasProcessingUnits(); + /** + * + * + *
+   * The number of processing units allocated to each replica.
+   *
+   * This may be zero in API responses for instances that are not yet in
+   * state `READY`.
+   * 
+ * + * int32 processing_units = 3; + * + * @return The processingUnits. + */ + int getProcessingUnits(); + + com.google.spanner.admin.instance.v1.ReplicaComputeCapacity.ComputeCapacityCase + getComputeCapacityCase(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelection.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelection.java new file mode 100644 index 00000000000..4ad522000a1 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelection.java @@ -0,0 +1,626 @@ +/* + * Copyright 2024 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/instance/v1/common.proto + +// Protobuf Java Version: 3.25.5 +package com.google.spanner.admin.instance.v1; + +/** + * + * + *
+ * ReplicaSelection identifies replicas with common properties.
+ * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ReplicaSelection} + */ +public final class ReplicaSelection extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.admin.instance.v1.ReplicaSelection) + ReplicaSelectionOrBuilder { + private static final long serialVersionUID = 0L; + // Use ReplicaSelection.newBuilder() to construct. + private ReplicaSelection(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ReplicaSelection() { + location_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ReplicaSelection(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.CommonProto + .internal_static_google_spanner_admin_instance_v1_ReplicaSelection_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.CommonProto + .internal_static_google_spanner_admin_instance_v1_ReplicaSelection_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ReplicaSelection.class, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder.class); + } + + public static final int LOCATION_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object location_ = ""; + /** + * + * + *
+   * Required. Name of the location of the replicas (e.g., "us-central1").
+   * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The location. + */ + @java.lang.Override + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of the location of the replicas (e.g., "us-central1").
+   * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for location. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, location_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, location_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.admin.instance.v1.ReplicaSelection)) { + return super.equals(obj); + } + com.google.spanner.admin.instance.v1.ReplicaSelection other = + (com.google.spanner.admin.instance.v1.ReplicaSelection) obj; + + if (!getLocation().equals(other.getLocation())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.admin.instance.v1.ReplicaSelection prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ReplicaSelection identifies replicas with common properties.
+   * 
+ * + * Protobuf type {@code google.spanner.admin.instance.v1.ReplicaSelection} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.admin.instance.v1.ReplicaSelection) + com.google.spanner.admin.instance.v1.ReplicaSelectionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.admin.instance.v1.CommonProto + .internal_static_google_spanner_admin_instance_v1_ReplicaSelection_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.admin.instance.v1.CommonProto + .internal_static_google_spanner_admin_instance_v1_ReplicaSelection_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.admin.instance.v1.ReplicaSelection.class, + com.google.spanner.admin.instance.v1.ReplicaSelection.Builder.class); + } + + // Construct using com.google.spanner.admin.instance.v1.ReplicaSelection.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + location_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.admin.instance.v1.CommonProto + .internal_static_google_spanner_admin_instance_v1_ReplicaSelection_descriptor; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelection getDefaultInstanceForType() { + return com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelection build() { + com.google.spanner.admin.instance.v1.ReplicaSelection result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelection buildPartial() { + com.google.spanner.admin.instance.v1.ReplicaSelection result = + new com.google.spanner.admin.instance.v1.ReplicaSelection(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.admin.instance.v1.ReplicaSelection result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.location_ = location_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.admin.instance.v1.ReplicaSelection) { + return mergeFrom((com.google.spanner.admin.instance.v1.ReplicaSelection) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.admin.instance.v1.ReplicaSelection other) { + if (other == com.google.spanner.admin.instance.v1.ReplicaSelection.getDefaultInstance()) + return this; + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + location_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object location_ = ""; + /** + * + * + *
+     * Required. Name of the location of the replicas (e.g., "us-central1").
+     * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of the location of the replicas (e.g., "us-central1").
+     * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for location. + */ + public com.google.protobuf.ByteString getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of the location of the replicas (e.g., "us-central1").
+     * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + location_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of the location of the replicas (e.g., "us-central1").
+     * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearLocation() { + location_ = getDefaultInstance().getLocation(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of the location of the replicas (e.g., "us-central1").
+     * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + location_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.admin.instance.v1.ReplicaSelection) + } + + // @@protoc_insertion_point(class_scope:google.spanner.admin.instance.v1.ReplicaSelection) + private static final com.google.spanner.admin.instance.v1.ReplicaSelection DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.admin.instance.v1.ReplicaSelection(); + } + + public static com.google.spanner.admin.instance.v1.ReplicaSelection getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ReplicaSelection parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.admin.instance.v1.ReplicaSelection getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelectionOrBuilder.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelectionOrBuilder.java new file mode 100644 index 00000000000..60c9b0edca0 --- /dev/null +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaSelectionOrBuilder.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024 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/instance/v1/common.proto + +// Protobuf Java Version: 3.25.5 +package com.google.spanner.admin.instance.v1; + +public interface ReplicaSelectionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.admin.instance.v1.ReplicaSelection) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of the location of the replicas (e.g., "us-central1").
+   * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The location. + */ + java.lang.String getLocation(); + /** + * + * + *
+   * Required. Name of the location of the replicas (e.g., "us-central1").
+   * 
+ * + * string location = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for location. + */ + com.google.protobuf.ByteString getLocationBytes(); +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java index 427a450fb01..2edfb759d12 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java @@ -40,6 +40,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_admin_instance_v1_InstanceConfig_LabelsEntry_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_admin_instance_v1_InstanceConfig_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -52,6 +56,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AutoscalingTargets_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AutoscalingTargets_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_spanner_admin_instance_v1_Instance_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -234,327 +246,348 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010CREATING\020\001\022\t\n" + "\005READY\020\002:`\352A]\n%spanner.googleapis.com/In" + "stanceConfig\0224projects/{project}/instanc" - + "eConfigs/{instance_config}\"\363\003\n\021Autoscali" - + "ngConfig\022f\n\022autoscaling_limits\030\001 \001(\0132E.g" - + "oogle.spanner.admin.instance.v1.Autoscal" - + "ingConfig.AutoscalingLimitsB\003\340A\002\022h\n\023auto" - + "scaling_targets\030\002 \001(\0132F.google.spanner.a" - + "dmin.instance.v1.AutoscalingConfig.Autos" - + "calingTargetsB\003\340A\002\032\227\001\n\021AutoscalingLimits" - + "\022\023\n\tmin_nodes\030\001 \001(\005H\000\022\036\n\024min_processing_" - + "units\030\002 \001(\005H\000\022\023\n\tmax_nodes\030\003 \001(\005H\001\022\036\n\024ma" - + "x_processing_units\030\004 \001(\005H\001B\013\n\tmin_limitB" - + "\013\n\tmax_limit\032r\n\022AutoscalingTargets\0222\n%hi" - + "gh_priority_cpu_utilization_percent\030\001 \001(" - + "\005B\003\340A\002\022(\n\033storage_utilization_percent\030\002 " - + "\001(\005B\003\340A\002\"\344\006\n\010Instance\022\021\n\004name\030\001 \001(\tB\003\340A\002" - + "\022=\n\006config\030\002 \001(\tB-\340A\002\372A\'\n%spanner.google" - + "apis.com/InstanceConfig\022\031\n\014display_name\030" - + "\003 \001(\tB\003\340A\002\022\022\n\nnode_count\030\005 \001(\005\022\030\n\020proces" - + "sing_units\030\t \001(\005\022T\n\022autoscaling_config\030\021" - + " \001(\01323.google.spanner.admin.instance.v1." - + "AutoscalingConfigB\003\340A\001\022D\n\005state\030\006 \001(\01620." - + "google.spanner.admin.instance.v1.Instanc" - + "e.StateB\003\340A\003\022F\n\006labels\030\007 \003(\01326.google.sp" - + "anner.admin.instance.v1.Instance.LabelsE" - + "ntry\022\025\n\rendpoint_uris\030\010 \003(\t\0224\n\013create_ti" - + "me\030\013 \001(\0132\032.google.protobuf.TimestampB\003\340A" - + "\003\0224\n\013update_time\030\014 \001(\0132\032.google.protobuf" - + ".TimestampB\003\340A\003\022H\n\007edition\030\024 \001(\01622.googl" - + "e.spanner.admin.instance.v1.Instance.Edi" - + "tionB\003\340A\001\032-\n\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n" - + "\005value\030\002 \001(\t:\0028\001\"7\n\005State\022\025\n\021STATE_UNSPE" - + "CIFIED\020\000\022\014\n\010CREATING\020\001\022\t\n\005READY\020\002\"U\n\007Edi" - + "tion\022\027\n\023EDITION_UNSPECIFIED\020\000\022\014\n\010STANDAR" - + "D\020\001\022\016\n\nENTERPRISE\020\002\022\023\n\017ENTERPRISE_PLUS\020\003" - + ":M\352AJ\n\037spanner.googleapis.com/Instance\022\'" - + "projects/{project}/instances/{instance}\"" - + "\210\001\n\032ListInstanceConfigsRequest\022C\n\006parent" - + "\030\001 \001(\tB3\340A\002\372A-\n+cloudresourcemanager.goo" - + "gleapis.com/Project\022\021\n\tpage_size\030\002 \001(\005\022\022" - + "\n\npage_token\030\003 \001(\t\"\202\001\n\033ListInstanceConfi" - + "gsResponse\022J\n\020instance_configs\030\001 \003(\01320.g" - + "oogle.spanner.admin.instance.v1.Instance" - + "Config\022\027\n\017next_page_token\030\002 \001(\t\"W\n\030GetIn" - + "stanceConfigRequest\022;\n\004name\030\001 \001(\tB-\340A\002\372A" - + "\'\n%spanner.googleapis.com/InstanceConfig" - + "\"\352\001\n\033CreateInstanceConfigRequest\022C\n\006pare" - + "nt\030\001 \001(\tB3\340A\002\372A-\n+cloudresourcemanager.g" - + "oogleapis.com/Project\022\037\n\022instance_config" - + "_id\030\002 \001(\tB\003\340A\002\022N\n\017instance_config\030\003 \001(\0132" - + "0.google.spanner.admin.instance.v1.Insta" - + "nceConfigB\003\340A\002\022\025\n\rvalidate_only\030\004 \001(\010\"\272\001" - + "\n\033UpdateInstanceConfigRequest\022N\n\017instanc" - + "e_config\030\001 \001(\01320.google.spanner.admin.in" - + "stance.v1.InstanceConfigB\003\340A\002\0224\n\013update_" - + "mask\030\002 \001(\0132\032.google.protobuf.FieldMaskB\003" - + "\340A\002\022\025\n\rvalidate_only\030\003 \001(\010\"\177\n\033DeleteInst" - + "anceConfigRequest\022;\n\004name\030\001 \001(\tB-\340A\002\372A\'\n" - + "%spanner.googleapis.com/InstanceConfig\022\014" - + "\n\004etag\030\002 \001(\t\022\025\n\rvalidate_only\030\003 \001(\010\"\241\001\n#" - + "ListInstanceConfigOperationsRequest\022C\n\006p" - + "arent\030\001 \001(\tB3\340A\002\372A-\n+cloudresourcemanage" - + "r.googleapis.com/Project\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\"" - + "r\n$ListInstanceConfigOperationsResponse\022" - + "1\n\noperations\030\001 \003(\0132\035.google.longrunning" - + ".Operation\022\027\n\017next_page_token\030\002 \001(\t\"{\n\022G" - + "etInstanceRequest\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!\n" - + "\037spanner.googleapis.com/Instance\022.\n\nfiel" - + "d_mask\030\002 \001(\0132\032.google.protobuf.FieldMask" - + "\"\271\001\n\025CreateInstanceRequest\022C\n\006parent\030\001 \001" - + "(\tB3\340A\002\372A-\n+cloudresourcemanager.googlea" - + "pis.com/Project\022\030\n\013instance_id\030\002 \001(\tB\003\340A" - + "\002\022A\n\010instance\030\003 \001(\0132*.google.spanner.adm" - + "in.instance.v1.InstanceB\003\340A\002\"\311\001\n\024ListIns" - + "tancesRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+c" - + "loudresourcemanager.googleapis.com/Proje" - + "ct\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(" - + "\t\022\016\n\006filter\030\004 \001(\t\0225\n\021instance_deadline\030\005" - + " \001(\0132\032.google.protobuf.Timestamp\"\204\001\n\025Lis" - + "tInstancesResponse\022=\n\tinstances\030\001 \003(\0132*." - + "google.spanner.admin.instance.v1.Instanc" - + "e\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unreachabl" - + "e\030\003 \003(\t\"\217\001\n\025UpdateInstanceRequest\022A\n\010ins" - + "tance\030\001 \001(\0132*.google.spanner.admin.insta" - + "nce.v1.InstanceB\003\340A\002\0223\n\nfield_mask\030\002 \001(\013" - + "2\032.google.protobuf.FieldMaskB\003\340A\002\"N\n\025Del" - + "eteInstanceRequest\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!" - + "\n\037spanner.googleapis.com/Instance\"\277\002\n\026Cr" - + "eateInstanceMetadata\022<\n\010instance\030\001 \001(\0132*" + + "eConfigs/{instance_config}\"\262\001\n\026ReplicaCo" + + "mputeCapacity\022R\n\021replica_selection\030\001 \001(\013" + + "22.google.spanner.admin.instance.v1.Repl" + + "icaSelectionB\003\340A\002\022\024\n\nnode_count\030\002 \001(\005H\000\022" + + "\032\n\020processing_units\030\003 \001(\005H\000B\022\n\020compute_c" + + "apacity\"\270\010\n\021AutoscalingConfig\022f\n\022autosca" + + "ling_limits\030\001 \001(\0132E.google.spanner.admin" + + ".instance.v1.AutoscalingConfig.Autoscali" + + "ngLimitsB\003\340A\002\022h\n\023autoscaling_targets\030\002 \001" + + "(\0132F.google.spanner.admin.instance.v1.Au" + + "toscalingConfig.AutoscalingTargetsB\003\340A\002\022" + + "|\n\036asymmetric_autoscaling_options\030\003 \003(\0132" + + "O.google.spanner.admin.instance.v1.Autos" + + "calingConfig.AsymmetricAutoscalingOption" + + "B\003\340A\001\032\227\001\n\021AutoscalingLimits\022\023\n\tmin_nodes" + + "\030\001 \001(\005H\000\022\036\n\024min_processing_units\030\002 \001(\005H\000" + + "\022\023\n\tmax_nodes\030\003 \001(\005H\001\022\036\n\024max_processing_" + + "units\030\004 \001(\005H\001B\013\n\tmin_limitB\013\n\tmax_limit\032" + + "r\n\022AutoscalingTargets\0222\n%high_priority_c" + + "pu_utilization_percent\030\001 \001(\005B\003\340A\002\022(\n\033sto" + + "rage_utilization_percent\030\002 \001(\005B\003\340A\002\032\304\003\n\033" + + "AsymmetricAutoscalingOption\022R\n\021replica_s" + + "election\030\001 \001(\01322.google.spanner.admin.in" + + "stance.v1.ReplicaSelectionB\003\340A\002\022\202\001\n\tover" + + "rides\030\002 \001(\0132j.google.spanner.admin.insta" + + "nce.v1.AutoscalingConfig.AsymmetricAutos" + + "calingOption.AutoscalingConfigOverridesB" + + "\003\340A\001\032\313\001\n\032AutoscalingConfigOverrides\022f\n\022a" + + "utoscaling_limits\030\001 \001(\0132E.google.spanner" + + ".admin.instance.v1.AutoscalingConfig.Aut" + + "oscalingLimitsB\003\340A\001\022E\n8autoscaling_targe" + + "t_high_priority_cpu_utilization_percent\030" + + "\002 \001(\005B\003\340A\001\"\305\007\n\010Instance\022\021\n\004name\030\001 \001(\tB\003\340" + + "A\002\022=\n\006config\030\002 \001(\tB-\340A\002\372A\'\n%spanner.goog" + + "leapis.com/InstanceConfig\022\031\n\014display_nam" + + "e\030\003 \001(\tB\003\340A\002\022\022\n\nnode_count\030\005 \001(\005\022\030\n\020proc" + + "essing_units\030\t \001(\005\022_\n\030replica_compute_ca" + + "pacity\030\023 \003(\01328.google.spanner.admin.inst" + + "ance.v1.ReplicaComputeCapacityB\003\340A\003\022T\n\022a" + + "utoscaling_config\030\021 \001(\01323.google.spanner" + + ".admin.instance.v1.AutoscalingConfigB\003\340A" + + "\001\022D\n\005state\030\006 \001(\01620.google.spanner.admin." + + "instance.v1.Instance.StateB\003\340A\003\022F\n\006label" + + "s\030\007 \003(\01326.google.spanner.admin.instance." + + "v1.Instance.LabelsEntry\022\025\n\rendpoint_uris" + + "\030\010 \003(\t\0224\n\013create_time\030\013 \001(\0132\032.google.pro" + + "tobuf.TimestampB\003\340A\003\0224\n\013update_time\030\014 \001(" + + "\0132\032.google.protobuf.TimestampB\003\340A\003\022H\n\007ed" + + "ition\030\024 \001(\01622.google.spanner.admin.insta" + + "nce.v1.Instance.EditionB\003\340A\001\032-\n\013LabelsEn" + + "try\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"7\n\005S" + + "tate\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010CREATING\020" + + "\001\022\t\n\005READY\020\002\"U\n\007Edition\022\027\n\023EDITION_UNSPE" + + "CIFIED\020\000\022\014\n\010STANDARD\020\001\022\016\n\nENTERPRISE\020\002\022\023" + + "\n\017ENTERPRISE_PLUS\020\003:M\352AJ\n\037spanner.google" + + "apis.com/Instance\022\'projects/{project}/in" + + "stances/{instance}\"\210\001\n\032ListInstanceConfi" + + "gsRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+cloud" + + "resourcemanager.googleapis.com/Project\022\021" + + "\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"\202\001" + + "\n\033ListInstanceConfigsResponse\022J\n\020instanc" + + "e_configs\030\001 \003(\01320.google.spanner.admin.i" + + "nstance.v1.InstanceConfig\022\027\n\017next_page_t" + + "oken\030\002 \001(\t\"W\n\030GetInstanceConfigRequest\022;" + + "\n\004name\030\001 \001(\tB-\340A\002\372A\'\n%spanner.googleapis" + + ".com/InstanceConfig\"\352\001\n\033CreateInstanceCo" + + "nfigRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+clo" + + "udresourcemanager.googleapis.com/Project" + + "\022\037\n\022instance_config_id\030\002 \001(\tB\003\340A\002\022N\n\017ins" + + "tance_config\030\003 \001(\01320.google.spanner.admi" + + "n.instance.v1.InstanceConfigB\003\340A\002\022\025\n\rval" + + "idate_only\030\004 \001(\010\"\272\001\n\033UpdateInstanceConfi" + + "gRequest\022N\n\017instance_config\030\001 \001(\01320.goog" + + "le.spanner.admin.instance.v1.InstanceCon" + + "figB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.google.p" + + "rotobuf.FieldMaskB\003\340A\002\022\025\n\rvalidate_only\030" + + "\003 \001(\010\"\177\n\033DeleteInstanceConfigRequest\022;\n\004" + + "name\030\001 \001(\tB-\340A\002\372A\'\n%spanner.googleapis.c" + + "om/InstanceConfig\022\014\n\004etag\030\002 \001(\t\022\025\n\rvalid" + + "ate_only\030\003 \001(\010\"\241\001\n#ListInstanceConfigOpe" + + "rationsRequest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+" + + "cloudresourcemanager.googleapis.com/Proj" + + "ect\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\"r\n$ListInstanceConfig" + + "OperationsResponse\0221\n\noperations\030\001 \003(\0132\035" + + ".google.longrunning.Operation\022\027\n\017next_pa" + + "ge_token\030\002 \001(\t\"{\n\022GetInstanceRequest\0225\n\004" + + "name\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis.c" + + "om/Instance\022.\n\nfield_mask\030\002 \001(\0132\032.google" + + ".protobuf.FieldMask\"\271\001\n\025CreateInstanceRe" + + "quest\022C\n\006parent\030\001 \001(\tB3\340A\002\372A-\n+cloudreso" + + "urcemanager.googleapis.com/Project\022\030\n\013in" + + "stance_id\030\002 \001(\tB\003\340A\002\022A\n\010instance\030\003 \001(\0132*" + ".google.spanner.admin.instance.v1.Instan" - + "ce\022.\n\nstart_time\030\002 \001(\0132\032.google.protobuf" - + ".Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.google" - + ".protobuf.Timestamp\022,\n\010end_time\030\004 \001(\0132\032." - + "google.protobuf.Timestamp\022X\n\033expected_fu" - + "lfillment_period\030\005 \001(\01623.google.spanner." - + "admin.instance.v1.FulfillmentPeriod\"\277\002\n\026" - + "UpdateInstanceMetadata\022<\n\010instance\030\001 \001(\013" - + "2*.google.spanner.admin.instance.v1.Inst" - + "ance\022.\n\nstart_time\030\002 \001(\0132\032.google.protob" - + "uf.Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.goog" - + "le.protobuf.Timestamp\022,\n\010end_time\030\004 \001(\0132" - + "\032.google.protobuf.Timestamp\022X\n\033expected_" - + "fulfillment_period\030\005 \001(\01623.google.spanne" - + "r.admin.instance.v1.FulfillmentPeriod\"\341\001" - + "\n\034CreateInstanceConfigMetadata\022I\n\017instan" - + "ce_config\030\001 \001(\01320.google.spanner.admin.i" - + "nstance.v1.InstanceConfig\022E\n\010progress\030\002 " - + "\001(\01323.google.spanner.admin.instance.v1.O" - + "perationProgress\022/\n\013cancel_time\030\003 \001(\0132\032." - + "google.protobuf.Timestamp\"\341\001\n\034UpdateInst" - + "anceConfigMetadata\022I\n\017instance_config\030\001 " - + "\001(\01320.google.spanner.admin.instance.v1.I" - + "nstanceConfig\022E\n\010progress\030\002 \001(\01323.google" - + ".spanner.admin.instance.v1.OperationProg" - + "ress\022/\n\013cancel_time\030\003 \001(\0132\032.google.proto" - + "buf.Timestamp\"\216\005\n\021InstancePartition\022\021\n\004n" - + "ame\030\001 \001(\tB\003\340A\002\022=\n\006config\030\002 \001(\tB-\340A\002\372A\'\n%" - + "spanner.googleapis.com/InstanceConfig\022\031\n" - + "\014display_name\030\003 \001(\tB\003\340A\002\022\024\n\nnode_count\030\005" - + " \001(\005H\000\022\032\n\020processing_units\030\006 \001(\005H\000\022M\n\005st" - + "ate\030\007 \001(\01629.google.spanner.admin.instanc" - + "e.v1.InstancePartition.StateB\003\340A\003\0224\n\013cre" - + "ate_time\030\010 \001(\0132\032.google.protobuf.Timesta" - + "mpB\003\340A\003\0224\n\013update_time\030\t \001(\0132\032.google.pr" - + "otobuf.TimestampB\003\340A\003\022\"\n\025referencing_dat" - + "abases\030\n \003(\tB\003\340A\003\022 \n\023referencing_backups" - + "\030\013 \003(\tB\003\340A\003\022\014\n\004etag\030\014 \001(\t\"7\n\005State\022\025\n\021ST" - + "ATE_UNSPECIFIED\020\000\022\014\n\010CREATING\020\001\022\t\n\005READY" - + "\020\002:~\352A{\n(spanner.googleapis.com/Instance" - + "Partition\022Oprojects/{project}/instances/" - + "{instance}/instancePartitions/{instance_" - + "partition}B\022\n\020compute_capacity\"\201\002\n\037Creat" - + "eInstancePartitionMetadata\022O\n\022instance_p" - + "artition\030\001 \001(\01323.google.spanner.admin.in" - + "stance.v1.InstancePartition\022.\n\nstart_tim" - + "e\030\002 \001(\0132\032.google.protobuf.Timestamp\022/\n\013c" + + "ceB\003\340A\002\"\311\001\n\024ListInstancesRequest\022C\n\006pare" + + "nt\030\001 \001(\tB3\340A\002\372A-\n+cloudresourcemanager.g" + + "oogleapis.com/Project\022\021\n\tpage_size\030\002 \001(\005" + + "\022\022\n\npage_token\030\003 \001(\t\022\016\n\006filter\030\004 \001(\t\0225\n\021" + + "instance_deadline\030\005 \001(\0132\032.google.protobu" + + "f.Timestamp\"\204\001\n\025ListInstancesResponse\022=\n" + + "\tinstances\030\001 \003(\0132*.google.spanner.admin." + + "instance.v1.Instance\022\027\n\017next_page_token\030" + + "\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"\217\001\n\025UpdateIns" + + "tanceRequest\022A\n\010instance\030\001 \001(\0132*.google." + + "spanner.admin.instance.v1.InstanceB\003\340A\002\022" + + "3\n\nfield_mask\030\002 \001(\0132\032.google.protobuf.Fi" + + "eldMaskB\003\340A\002\"N\n\025DeleteInstanceRequest\0225\n" + + "\004name\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis." + + "com/Instance\"\277\002\n\026CreateInstanceMetadata\022" + + "<\n\010instance\030\001 \001(\0132*.google.spanner.admin" + + ".instance.v1.Instance\022.\n\nstart_time\030\002 \001(" + + "\0132\032.google.protobuf.Timestamp\022/\n\013cancel_" + + "time\030\003 \001(\0132\032.google.protobuf.Timestamp\022," + + "\n\010end_time\030\004 \001(\0132\032.google.protobuf.Times" + + "tamp\022X\n\033expected_fulfillment_period\030\005 \001(" + + "\01623.google.spanner.admin.instance.v1.Ful" + + "fillmentPeriod\"\277\002\n\026UpdateInstanceMetadat" + + "a\022<\n\010instance\030\001 \001(\0132*.google.spanner.adm" + + "in.instance.v1.Instance\022.\n\nstart_time\030\002 " + + "\001(\0132\032.google.protobuf.Timestamp\022/\n\013cance" + + "l_time\030\003 \001(\0132\032.google.protobuf.Timestamp" + + "\022,\n\010end_time\030\004 \001(\0132\032.google.protobuf.Tim" + + "estamp\022X\n\033expected_fulfillment_period\030\005 " + + "\001(\01623.google.spanner.admin.instance.v1.F" + + "ulfillmentPeriod\"\341\001\n\034CreateInstanceConfi" + + "gMetadata\022I\n\017instance_config\030\001 \001(\01320.goo" + + "gle.spanner.admin.instance.v1.InstanceCo" + + "nfig\022E\n\010progress\030\002 \001(\01323.google.spanner." + + "admin.instance.v1.OperationProgress\022/\n\013c" + "ancel_time\030\003 \001(\0132\032.google.protobuf.Times" - + "tamp\022,\n\010end_time\030\004 \001(\0132\032.google.protobuf" - + ".Timestamp\"\323\001\n\036CreateInstancePartitionRe" - + "quest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.g" - + "oogleapis.com/Instance\022\"\n\025instance_parti" - + "tion_id\030\002 \001(\tB\003\340A\002\022T\n\022instance_partition" - + "\030\003 \001(\01323.google.spanner.admin.instance.v" - + "1.InstancePartitionB\003\340A\002\"n\n\036DeleteInstan" - + "cePartitionRequest\022>\n\004name\030\001 \001(\tB0\340A\002\372A*" - + "\n(spanner.googleapis.com/InstancePartiti" - + "on\022\014\n\004etag\030\002 \001(\t\"]\n\033GetInstancePartition" - + "Request\022>\n\004name\030\001 \001(\tB0\340A\002\372A*\n(spanner.g" - + "oogleapis.com/InstancePartition\"\253\001\n\036Upda" - + "teInstancePartitionRequest\022T\n\022instance_p" - + "artition\030\001 \001(\01323.google.spanner.admin.in" - + "stance.v1.InstancePartitionB\003\340A\002\0223\n\nfiel" - + "d_mask\030\002 \001(\0132\032.google.protobuf.FieldMask" - + "B\003\340A\002\"\201\002\n\037UpdateInstancePartitionMetadat" - + "a\022O\n\022instance_partition\030\001 \001(\01323.google.s" + + "tamp\"\341\001\n\034UpdateInstanceConfigMetadata\022I\n" + + "\017instance_config\030\001 \001(\01320.google.spanner." + + "admin.instance.v1.InstanceConfig\022E\n\010prog" + + "ress\030\002 \001(\01323.google.spanner.admin.instan" + + "ce.v1.OperationProgress\022/\n\013cancel_time\030\003" + + " \001(\0132\032.google.protobuf.Timestamp\"\216\005\n\021Ins" + + "tancePartition\022\021\n\004name\030\001 \001(\tB\003\340A\002\022=\n\006con" + + "fig\030\002 \001(\tB-\340A\002\372A\'\n%spanner.googleapis.co" + + "m/InstanceConfig\022\031\n\014display_name\030\003 \001(\tB\003" + + "\340A\002\022\024\n\nnode_count\030\005 \001(\005H\000\022\032\n\020processing_" + + "units\030\006 \001(\005H\000\022M\n\005state\030\007 \001(\01629.google.sp" + + "anner.admin.instance.v1.InstancePartitio" + + "n.StateB\003\340A\003\0224\n\013create_time\030\010 \001(\0132\032.goog" + + "le.protobuf.TimestampB\003\340A\003\0224\n\013update_tim" + + "e\030\t \001(\0132\032.google.protobuf.TimestampB\003\340A\003" + + "\022\"\n\025referencing_databases\030\n \003(\tB\003\340A\003\022 \n\023" + + "referencing_backups\030\013 \003(\tB\003\340A\003\022\014\n\004etag\030\014" + + " \001(\t\"7\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\014\n\010" + + "CREATING\020\001\022\t\n\005READY\020\002:~\352A{\n(spanner.goog" + + "leapis.com/InstancePartition\022Oprojects/{" + + "project}/instances/{instance}/instancePa" + + "rtitions/{instance_partition}B\022\n\020compute" + + "_capacity\"\201\002\n\037CreateInstancePartitionMet" + + "adata\022O\n\022instance_partition\030\001 \001(\01323.goog" + + "le.spanner.admin.instance.v1.InstancePar" + + "tition\022.\n\nstart_time\030\002 \001(\0132\032.google.prot" + + "obuf.Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.go" + + "ogle.protobuf.Timestamp\022,\n\010end_time\030\004 \001(" + + "\0132\032.google.protobuf.Timestamp\"\323\001\n\036Create" + + "InstancePartitionRequest\0227\n\006parent\030\001 \001(\t" + + "B\'\340A\002\372A!\n\037spanner.googleapis.com/Instanc" + + "e\022\"\n\025instance_partition_id\030\002 \001(\tB\003\340A\002\022T\n" + + "\022instance_partition\030\003 \001(\01323.google.spann" + + "er.admin.instance.v1.InstancePartitionB\003" + + "\340A\002\"n\n\036DeleteInstancePartitionRequest\022>\n" + + "\004name\030\001 \001(\tB0\340A\002\372A*\n(spanner.googleapis." + + "com/InstancePartition\022\014\n\004etag\030\002 \001(\t\"]\n\033G" + + "etInstancePartitionRequest\022>\n\004name\030\001 \001(\t" + + "B0\340A\002\372A*\n(spanner.googleapis.com/Instanc" + + "ePartition\"\253\001\n\036UpdateInstancePartitionRe" + + "quest\022T\n\022instance_partition\030\001 \001(\01323.goog" + + "le.spanner.admin.instance.v1.InstancePar" + + "titionB\003\340A\002\0223\n\nfield_mask\030\002 \001(\0132\032.google" + + ".protobuf.FieldMaskB\003\340A\002\"\201\002\n\037UpdateInsta" + + "ncePartitionMetadata\022O\n\022instance_partiti" + + "on\030\001 \001(\01323.google.spanner.admin.instance" + + ".v1.InstancePartition\022.\n\nstart_time\030\002 \001(" + + "\0132\032.google.protobuf.Timestamp\022/\n\013cancel_" + + "time\030\003 \001(\0132\032.google.protobuf.Timestamp\022," + + "\n\010end_time\030\004 \001(\0132\032.google.protobuf.Times" + + "tamp\"\305\001\n\035ListInstancePartitionsRequest\0227" + + "\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleap" + + "is.com/Instance\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npa" + + "ge_token\030\003 \001(\t\022D\n\033instance_partition_dea" + + "dline\030\004 \001(\0132\032.google.protobuf.TimestampB" + + "\003\340A\001\"\240\001\n\036ListInstancePartitionsResponse\022" + + "P\n\023instance_partitions\030\001 \003(\01323.google.sp" + + "anner.admin.instance.v1.InstancePartitio" + + "n\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unreachabl" + + "e\030\003 \003(\t\"\355\001\n&ListInstancePartitionOperati" + + "onsRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\n\037span" + + "ner.googleapis.com/Instance\022\023\n\006filter\030\002 " + + "\001(\tB\003\340A\001\022\026\n\tpage_size\030\003 \001(\005B\003\340A\001\022\027\n\npage" + + "_token\030\004 \001(\tB\003\340A\001\022D\n\033instance_partition_" + + "deadline\030\005 \001(\0132\032.google.protobuf.Timesta" + + "mpB\003\340A\001\"\236\001\n\'ListInstancePartitionOperati" + + "onsResponse\0221\n\noperations\030\001 \003(\0132\035.google" + + ".longrunning.Operation\022\027\n\017next_page_toke" + + "n\030\002 \001(\t\022\'\n\037unreachable_instance_partitio" + + "ns\030\003 \003(\t\"\222\001\n\023MoveInstanceRequest\0225\n\004name" + + "\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis.com/I" + + "nstance\022D\n\rtarget_config\030\002 \001(\tB-\340A\002\372A\'\n%" + + "spanner.googleapis.com/InstanceConfig\"\026\n" + + "\024MoveInstanceResponse\"\245\001\n\024MoveInstanceMe" + + "tadata\022\025\n\rtarget_config\030\001 \001(\t\022E\n\010progres" + + "s\030\002 \001(\01323.google.spanner.admin.instance." + + "v1.OperationProgress\022/\n\013cancel_time\030\003 \001(" + + "\0132\032.google.protobuf.Timestamp2\332\'\n\rInstan" + + "ceAdmin\022\314\001\n\023ListInstanceConfigs\022<.google" + + ".spanner.admin.instance.v1.ListInstanceC" + + "onfigsRequest\032=.google.spanner.admin.ins" + + "tance.v1.ListInstanceConfigsResponse\"8\332A" + + "\006parent\202\323\344\223\002)\022\'/v1/{parent=projects/*}/i" + + "nstanceConfigs\022\271\001\n\021GetInstanceConfig\022:.g" + + "oogle.spanner.admin.instance.v1.GetInsta" + + "nceConfigRequest\0320.google.spanner.admin." + + "instance.v1.InstanceConfig\"6\332A\004name\202\323\344\223\002" + + ")\022\'/v1/{name=projects/*/instanceConfigs/" + + "*}\022\310\002\n\024CreateInstanceConfig\022=.google.spa" + + "nner.admin.instance.v1.CreateInstanceCon" + + "figRequest\032\035.google.longrunning.Operatio" + + "n\"\321\001\312Ap\n/google.spanner.admin.instance.v" + + "1.InstanceConfig\022=google.spanner.admin.i" + + "nstance.v1.CreateInstanceConfigMetadata\332" + + "A)parent,instance_config,instance_config" + + "_id\202\323\344\223\002,\"\'/v1/{parent=projects/*}/insta" + + "nceConfigs:\001*\022\312\002\n\024UpdateInstanceConfig\022=" + + ".google.spanner.admin.instance.v1.Update" + + "InstanceConfigRequest\032\035.google.longrunni" + + "ng.Operation\"\323\001\312Ap\n/google.spanner.admin" + + ".instance.v1.InstanceConfig\022=google.span" + + "ner.admin.instance.v1.UpdateInstanceConf" + + "igMetadata\332A\033instance_config,update_mask" + + "\202\323\344\223\002<27/v1/{instance_config.name=projec" + + "ts/*/instanceConfigs/*}:\001*\022\245\001\n\024DeleteIns" + + "tanceConfig\022=.google.spanner.admin.insta" + + "nce.v1.DeleteInstanceConfigRequest\032\026.goo" + + "gle.protobuf.Empty\"6\332A\004name\202\323\344\223\002)*\'/v1/{" + + "name=projects/*/instanceConfigs/*}\022\360\001\n\034L" + + "istInstanceConfigOperations\022E.google.spa" + + "nner.admin.instance.v1.ListInstanceConfi" + + "gOperationsRequest\032F.google.spanner.admi" + + "n.instance.v1.ListInstanceConfigOperatio" + + "nsResponse\"A\332A\006parent\202\323\344\223\0022\0220/v1/{parent" + + "=projects/*}/instanceConfigOperations\022\264\001" + + "\n\rListInstances\0226.google.spanner.admin.i" + + "nstance.v1.ListInstancesRequest\0327.google" + + ".spanner.admin.instance.v1.ListInstances" + + "Response\"2\332A\006parent\202\323\344\223\002#\022!/v1/{parent=p" + + "rojects/*}/instances\022\344\001\n\026ListInstancePar" + + "titions\022?.google.spanner.admin.instance." + + "v1.ListInstancePartitionsRequest\032@.googl" + + "e.spanner.admin.instance.v1.ListInstance" + + "PartitionsResponse\"G\332A\006parent\202\323\344\223\0028\0226/v1" + + "/{parent=projects/*/instances/*}/instanc" + + "ePartitions\022\241\001\n\013GetInstance\0224.google.spa" + + "nner.admin.instance.v1.GetInstanceReques" + + "t\032*.google.spanner.admin.instance.v1.Ins" + + "tance\"0\332A\004name\202\323\344\223\002#\022!/v1/{name=projects" + + "/*/instances/*}\022\234\002\n\016CreateInstance\0227.goo" + + "gle.spanner.admin.instance.v1.CreateInst" + + "anceRequest\032\035.google.longrunning.Operati" + + "on\"\261\001\312Ad\n)google.spanner.admin.instance." + + "v1.Instance\0227google.spanner.admin.instan" + + "ce.v1.CreateInstanceMetadata\332A\033parent,in" + + "stance_id,instance\202\323\344\223\002&\"!/v1/{parent=pr" + + "ojects/*}/instances:\001*\022\235\002\n\016UpdateInstanc" + + "e\0227.google.spanner.admin.instance.v1.Upd" + + "ateInstanceRequest\032\035.google.longrunning." + + "Operation\"\262\001\312Ad\n)google.spanner.admin.in" + + "stance.v1.Instance\0227google.spanner.admin" + + ".instance.v1.UpdateInstanceMetadata\332A\023in" + + "stance,field_mask\202\323\344\223\002/2*/v1/{instance.n" + + "ame=projects/*/instances/*}:\001*\022\223\001\n\016Delet" + + "eInstance\0227.google.spanner.admin.instanc" + + "e.v1.DeleteInstanceRequest\032\026.google.prot" + + "obuf.Empty\"0\332A\004name\202\323\344\223\002#*!/v1/{name=pro" + + "jects/*/instances/*}\022\232\001\n\014SetIamPolicy\022\"." + + "google.iam.v1.SetIamPolicyRequest\032\025.goog" + + "le.iam.v1.Policy\"O\332A\017resource,policy\202\323\344\223" + + "\0027\"2/v1/{resource=projects/*/instances/*" + + "}:setIamPolicy:\001*\022\223\001\n\014GetIamPolicy\022\".goo" + + "gle.iam.v1.GetIamPolicyRequest\032\025.google." + + "iam.v1.Policy\"H\332A\010resource\202\323\344\223\0027\"2/v1/{r" + + "esource=projects/*/instances/*}:getIamPo" + + "licy:\001*\022\305\001\n\022TestIamPermissions\022(.google." + + "iam.v1.TestIamPermissionsRequest\032).googl" + + "e.iam.v1.TestIamPermissionsResponse\"Z\332A\024" + + "resource,permissions\202\323\344\223\002=\"8/v1/{resourc" + + "e=projects/*/instances/*}:testIamPermiss" + + "ions:\001*\022\321\001\n\024GetInstancePartition\022=.googl" + + "e.spanner.admin.instance.v1.GetInstanceP" + + "artitionRequest\0323.google.spanner.admin.i" + + "nstance.v1.InstancePartition\"E\332A\004name\202\323\344" + + "\223\0028\0226/v1/{name=projects/*/instances/*/in" + + "stancePartitions/*}\022\351\002\n\027CreateInstancePa" + + "rtition\022@.google.spanner.admin.instance." + + "v1.CreateInstancePartitionRequest\032\035.goog" + + "le.longrunning.Operation\"\354\001\312Av\n2google.s" + "panner.admin.instance.v1.InstancePartiti" - + "on\022.\n\nstart_time\030\002 \001(\0132\032.google.protobuf" - + ".Timestamp\022/\n\013cancel_time\030\003 \001(\0132\032.google" - + ".protobuf.Timestamp\022,\n\010end_time\030\004 \001(\0132\032." - + "google.protobuf.Timestamp\"\305\001\n\035ListInstan" - + "cePartitionsRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002" - + "\372A!\n\037spanner.googleapis.com/Instance\022\021\n\t" - + "page_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\022D\n\033i" - + "nstance_partition_deadline\030\004 \001(\0132\032.googl" - + "e.protobuf.TimestampB\003\340A\001\"\240\001\n\036ListInstan" - + "cePartitionsResponse\022P\n\023instance_partiti" - + "ons\030\001 \003(\01323.google.spanner.admin.instanc" - + "e.v1.InstancePartition\022\027\n\017next_page_toke" - + "n\030\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"\355\001\n&ListIns" - + "tancePartitionOperationsRequest\0227\n\006paren" - + "t\030\001 \001(\tB\'\340A\002\372A!\n\037spanner.googleapis.com/" - + "Instance\022\023\n\006filter\030\002 \001(\tB\003\340A\001\022\026\n\tpage_si" - + "ze\030\003 \001(\005B\003\340A\001\022\027\n\npage_token\030\004 \001(\tB\003\340A\001\022D" - + "\n\033instance_partition_deadline\030\005 \001(\0132\032.go" - + "ogle.protobuf.TimestampB\003\340A\001\"\236\001\n\'ListIns" - + "tancePartitionOperationsResponse\0221\n\noper" - + "ations\030\001 \003(\0132\035.google.longrunning.Operat" - + "ion\022\027\n\017next_page_token\030\002 \001(\t\022\'\n\037unreacha" - + "ble_instance_partitions\030\003 \003(\t\"\222\001\n\023MoveIn" - + "stanceRequest\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!\n\037spa" - + "nner.googleapis.com/Instance\022D\n\rtarget_c" - + "onfig\030\002 \001(\tB-\340A\002\372A\'\n%spanner.googleapis." - + "com/InstanceConfig\"\026\n\024MoveInstanceRespon" - + "se\"\245\001\n\024MoveInstanceMetadata\022\025\n\rtarget_co" - + "nfig\030\001 \001(\t\022E\n\010progress\030\002 \001(\01323.google.sp" - + "anner.admin.instance.v1.OperationProgres" - + "s\022/\n\013cancel_time\030\003 \001(\0132\032.google.protobuf" - + ".Timestamp2\332\'\n\rInstanceAdmin\022\314\001\n\023ListIns" - + "tanceConfigs\022<.google.spanner.admin.inst" - + "ance.v1.ListInstanceConfigsRequest\032=.goo" - + "gle.spanner.admin.instance.v1.ListInstan" - + "ceConfigsResponse\"8\332A\006parent\202\323\344\223\002)\022\'/v1/" - + "{parent=projects/*}/instanceConfigs\022\271\001\n\021" - + "GetInstanceConfig\022:.google.spanner.admin" - + ".instance.v1.GetInstanceConfigRequest\0320." - + "google.spanner.admin.instance.v1.Instanc" - + "eConfig\"6\332A\004name\202\323\344\223\002)\022\'/v1/{name=projec" - + "ts/*/instanceConfigs/*}\022\310\002\n\024CreateInstan" - + "ceConfig\022=.google.spanner.admin.instance" - + ".v1.CreateInstanceConfigRequest\032\035.google" - + ".longrunning.Operation\"\321\001\312Ap\n/google.spa" - + "nner.admin.instance.v1.InstanceConfig\022=g" - + "oogle.spanner.admin.instance.v1.CreateIn" - + "stanceConfigMetadata\332A)parent,instance_c" - + "onfig,instance_config_id\202\323\344\223\002,\"\'/v1/{par" - + "ent=projects/*}/instanceConfigs:\001*\022\312\002\n\024U" - + "pdateInstanceConfig\022=.google.spanner.adm" - + "in.instance.v1.UpdateInstanceConfigReque" - + "st\032\035.google.longrunning.Operation\"\323\001\312Ap\n" - + "/google.spanner.admin.instance.v1.Instan" - + "ceConfig\022=google.spanner.admin.instance." - + "v1.UpdateInstanceConfigMetadata\332A\033instan" - + "ce_config,update_mask\202\323\344\223\002<27/v1/{instan" - + "ce_config.name=projects/*/instanceConfig" - + "s/*}:\001*\022\245\001\n\024DeleteInstanceConfig\022=.googl" - + "e.spanner.admin.instance.v1.DeleteInstan" - + "ceConfigRequest\032\026.google.protobuf.Empty\"" - + "6\332A\004name\202\323\344\223\002)*\'/v1/{name=projects/*/ins" - + "tanceConfigs/*}\022\360\001\n\034ListInstanceConfigOp" - + "erations\022E.google.spanner.admin.instance" - + ".v1.ListInstanceConfigOperationsRequest\032" - + "F.google.spanner.admin.instance.v1.ListI" - + "nstanceConfigOperationsResponse\"A\332A\006pare" - + "nt\202\323\344\223\0022\0220/v1/{parent=projects/*}/instan" - + "ceConfigOperations\022\264\001\n\rListInstances\0226.g" - + "oogle.spanner.admin.instance.v1.ListInst" - + "ancesRequest\0327.google.spanner.admin.inst" - + "ance.v1.ListInstancesResponse\"2\332A\006parent" - + "\202\323\344\223\002#\022!/v1/{parent=projects/*}/instance" - + "s\022\344\001\n\026ListInstancePartitions\022?.google.sp" - + "anner.admin.instance.v1.ListInstancePart" - + "itionsRequest\032@.google.spanner.admin.ins" - + "tance.v1.ListInstancePartitionsResponse\"" - + "G\332A\006parent\202\323\344\223\0028\0226/v1/{parent=projects/*" - + "/instances/*}/instancePartitions\022\241\001\n\013Get" - + "Instance\0224.google.spanner.admin.instance" - + ".v1.GetInstanceRequest\032*.google.spanner." - + "admin.instance.v1.Instance\"0\332A\004name\202\323\344\223\002" - + "#\022!/v1/{name=projects/*/instances/*}\022\234\002\n" - + "\016CreateInstance\0227.google.spanner.admin.i" - + "nstance.v1.CreateInstanceRequest\032\035.googl" - + "e.longrunning.Operation\"\261\001\312Ad\n)google.sp" - + "anner.admin.instance.v1.Instance\0227google" - + ".spanner.admin.instance.v1.CreateInstanc" - + "eMetadata\332A\033parent,instance_id,instance\202" - + "\323\344\223\002&\"!/v1/{parent=projects/*}/instances" - + ":\001*\022\235\002\n\016UpdateInstance\0227.google.spanner." - + "admin.instance.v1.UpdateInstanceRequest\032" - + "\035.google.longrunning.Operation\"\262\001\312Ad\n)go" - + "ogle.spanner.admin.instance.v1.Instance\022" - + "7google.spanner.admin.instance.v1.Update" - + "InstanceMetadata\332A\023instance,field_mask\202\323" - + "\344\223\002/2*/v1/{instance.name=projects/*/inst" - + "ances/*}:\001*\022\223\001\n\016DeleteInstance\0227.google." - + "spanner.admin.instance.v1.DeleteInstance" - + "Request\032\026.google.protobuf.Empty\"0\332A\004name" - + "\202\323\344\223\002#*!/v1/{name=projects/*/instances/*" - + "}\022\232\001\n\014SetIamPolicy\022\".google.iam.v1.SetIa" - + "mPolicyRequest\032\025.google.iam.v1.Policy\"O\332" - + "A\017resource,policy\202\323\344\223\0027\"2/v1/{resource=p" - + "rojects/*/instances/*}:setIamPolicy:\001*\022\223" - + "\001\n\014GetIamPolicy\022\".google.iam.v1.GetIamPo" - + "licyRequest\032\025.google.iam.v1.Policy\"H\332A\010r" - + "esource\202\323\344\223\0027\"2/v1/{resource=projects/*/" - + "instances/*}:getIamPolicy:\001*\022\305\001\n\022TestIam" - + "Permissions\022(.google.iam.v1.TestIamPermi" - + "ssionsRequest\032).google.iam.v1.TestIamPer" - + "missionsResponse\"Z\332A\024resource,permission" - + "s\202\323\344\223\002=\"8/v1/{resource=projects/*/instan" - + "ces/*}:testIamPermissions:\001*\022\321\001\n\024GetInst" - + "ancePartition\022=.google.spanner.admin.ins" - + "tance.v1.GetInstancePartitionRequest\0323.g" - + "oogle.spanner.admin.instance.v1.Instance" - + "Partition\"E\332A\004name\202\323\344\223\0028\0226/v1/{name=proj" - + "ects/*/instances/*/instancePartitions/*}" - + "\022\351\002\n\027CreateInstancePartition\022@.google.sp" - + "anner.admin.instance.v1.CreateInstancePa" - + "rtitionRequest\032\035.google.longrunning.Oper" - + "ation\"\354\001\312Av\n2google.spanner.admin.instan" - + "ce.v1.InstancePartition\022@google.spanner." - + "admin.instance.v1.CreateInstancePartitio" - + "nMetadata\332A/parent,instance_partition,in" - + "stance_partition_id\202\323\344\223\002;\"6/v1/{parent=p" - + "rojects/*/instances/*}/instancePartition" - + "s:\001*\022\272\001\n\027DeleteInstancePartition\022@.googl" - + "e.spanner.admin.instance.v1.DeleteInstan" - + "cePartitionRequest\032\026.google.protobuf.Emp" - + "ty\"E\332A\004name\202\323\344\223\0028*6/v1/{name=projects/*/" - + "instances/*/instancePartitions/*}\022\352\002\n\027Up" - + "dateInstancePartition\022@.google.spanner.a" - + "dmin.instance.v1.UpdateInstancePartition" - + "Request\032\035.google.longrunning.Operation\"\355" - + "\001\312Av\n2google.spanner.admin.instance.v1.I" - + "nstancePartition\022@google.spanner.admin.i" - + "nstance.v1.UpdateInstancePartitionMetada" - + "ta\332A\035instance_partition,field_mask\202\323\344\223\002N" - + "2I/v1/{instance_partition.name=projects/" - + "*/instances/*/instancePartitions/*}:\001*\022\210" - + "\002\n\037ListInstancePartitionOperations\022H.goo" - + "gle.spanner.admin.instance.v1.ListInstan" - + "cePartitionOperationsRequest\032I.google.sp" - + "anner.admin.instance.v1.ListInstancePart" - + "itionOperationsResponse\"P\332A\006parent\202\323\344\223\002A" - + "\022?/v1/{parent=projects/*/instances/*}/in" - + "stancePartitionOperations\022\211\002\n\014MoveInstan" - + "ce\0225.google.spanner.admin.instance.v1.Mo" - + "veInstanceRequest\032\035.google.longrunning.O" - + "peration\"\242\001\312An\n5google.spanner.admin.ins" - + "tance.v1.MoveInstanceResponse\0225google.sp" - + "anner.admin.instance.v1.MoveInstanceMeta" - + "data\202\323\344\223\002+\"&/v1/{name=projects/*/instanc" - + "es/*}:move:\001*\032x\312A\026spanner.googleapis.com" - + "\322A\\https://www.googleapis.com/auth/cloud" - + "-platform,https://www.googleapis.com/aut" - + "h/spanner.adminB\213\002\n$com.google.spanner.a" - + "dmin.instance.v1B\031SpannerInstanceAdminPr" - + "otoP\001ZFcloud.google.com/go/spanner/admin" - + "/instance/apiv1/instancepb;instancepb\252\002&" - + "Google.Cloud.Spanner.Admin.Instance.V1\312\002" - + "&Google\\Cloud\\Spanner\\Admin\\Instance\\V1\352" - + "\002+Google::Cloud::Spanner::Admin::Instanc" - + "e::V1b\006proto3" + + "on\022@google.spanner.admin.instance.v1.Cre" + + "ateInstancePartitionMetadata\332A/parent,in" + + "stance_partition,instance_partition_id\202\323" + + "\344\223\002;\"6/v1/{parent=projects/*/instances/*" + + "}/instancePartitions:\001*\022\272\001\n\027DeleteInstan" + + "cePartition\022@.google.spanner.admin.insta" + + "nce.v1.DeleteInstancePartitionRequest\032\026." + + "google.protobuf.Empty\"E\332A\004name\202\323\344\223\0028*6/v" + + "1/{name=projects/*/instances/*/instanceP" + + "artitions/*}\022\352\002\n\027UpdateInstancePartition" + + "\022@.google.spanner.admin.instance.v1.Upda" + + "teInstancePartitionRequest\032\035.google.long" + + "running.Operation\"\355\001\312Av\n2google.spanner." + + "admin.instance.v1.InstancePartition\022@goo" + + "gle.spanner.admin.instance.v1.UpdateInst" + + "ancePartitionMetadata\332A\035instance_partiti" + + "on,field_mask\202\323\344\223\002N2I/v1/{instance_parti" + + "tion.name=projects/*/instances/*/instanc" + + "ePartitions/*}:\001*\022\210\002\n\037ListInstancePartit" + + "ionOperations\022H.google.spanner.admin.ins" + + "tance.v1.ListInstancePartitionOperations" + + "Request\032I.google.spanner.admin.instance." + + "v1.ListInstancePartitionOperationsRespon" + + "se\"P\332A\006parent\202\323\344\223\002A\022?/v1/{parent=project" + + "s/*/instances/*}/instancePartitionOperat" + + "ions\022\211\002\n\014MoveInstance\0225.google.spanner.a" + + "dmin.instance.v1.MoveInstanceRequest\032\035.g" + + "oogle.longrunning.Operation\"\242\001\312An\n5googl" + + "e.spanner.admin.instance.v1.MoveInstance" + + "Response\0225google.spanner.admin.instance." + + "v1.MoveInstanceMetadata\202\323\344\223\002+\"&/v1/{name" + + "=projects/*/instances/*}:move:\001*\032x\312A\026spa" + + "nner.googleapis.com\322A\\https://www.google" + + "apis.com/auth/cloud-platform,https://www" + + ".googleapis.com/auth/spanner.adminB\213\002\n$c" + + "om.google.spanner.admin.instance.v1B\031Spa" + + "nnerInstanceAdminProtoP\001ZFcloud.google.c" + + "om/go/spanner/admin/instance/apiv1/insta" + + "ncepb;instancepb\252\002&Google.Cloud.Spanner." + + "Admin.Instance.V1\312\002&Google\\Cloud\\Spanner" + + "\\Admin\\Instance\\V1\352\002+Google::Cloud::Span" + + "ner::Admin::Instance::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -608,13 +641,21 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Key", "Value", }); - internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_descriptor = + internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_descriptor = getDescriptor().getMessageTypes().get(2); + internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_ReplicaComputeCapacity_descriptor, + new java.lang.String[] { + "ReplicaSelection", "NodeCount", "ProcessingUnits", "ComputeCapacity", + }); + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_descriptor = + getDescriptor().getMessageTypes().get(3); internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_descriptor, new java.lang.String[] { - "AutoscalingLimits", "AutoscalingTargets", + "AutoscalingLimits", "AutoscalingTargets", "AsymmetricAutoscalingOptions", }); internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AutoscalingLimits_descriptor = internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_descriptor @@ -641,8 +682,28 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "HighPriorityCpuUtilizationPercent", "StorageUtilizationPercent", }); + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor = + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_descriptor + .getNestedTypes() + .get(2); + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor, + new java.lang.String[] { + "ReplicaSelection", "Overrides", + }); + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_descriptor = + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_descriptor + .getNestedTypes() + .get(0); + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_admin_instance_v1_AutoscalingConfig_AsymmetricAutoscalingOption_AutoscalingConfigOverrides_descriptor, + new java.lang.String[] { + "AutoscalingLimits", "AutoscalingTargetHighPriorityCpuUtilizationPercent", + }); internal_static_google_spanner_admin_instance_v1_Instance_descriptor = - getDescriptor().getMessageTypes().get(3); + getDescriptor().getMessageTypes().get(4); internal_static_google_spanner_admin_instance_v1_Instance_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_Instance_descriptor, @@ -652,6 +713,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "DisplayName", "NodeCount", "ProcessingUnits", + "ReplicaComputeCapacity", "AutoscalingConfig", "State", "Labels", @@ -671,7 +733,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigsRequest_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(5); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstanceConfigsRequest_descriptor, @@ -679,7 +741,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "PageSize", "PageToken", }); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigsResponse_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageTypes().get(6); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstanceConfigsResponse_descriptor, @@ -687,7 +749,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstanceConfigs", "NextPageToken", }); internal_static_google_spanner_admin_instance_v1_GetInstanceConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageTypes().get(7); internal_static_google_spanner_admin_instance_v1_GetInstanceConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_GetInstanceConfigRequest_descriptor, @@ -695,7 +757,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", }); internal_static_google_spanner_admin_instance_v1_CreateInstanceConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(7); + getDescriptor().getMessageTypes().get(8); internal_static_google_spanner_admin_instance_v1_CreateInstanceConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_CreateInstanceConfigRequest_descriptor, @@ -703,7 +765,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "InstanceConfigId", "InstanceConfig", "ValidateOnly", }); internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(9); internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigRequest_descriptor, @@ -711,7 +773,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstanceConfig", "UpdateMask", "ValidateOnly", }); internal_static_google_spanner_admin_instance_v1_DeleteInstanceConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(9); + getDescriptor().getMessageTypes().get(10); internal_static_google_spanner_admin_instance_v1_DeleteInstanceConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_DeleteInstanceConfigRequest_descriptor, @@ -719,7 +781,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", "Etag", "ValidateOnly", }); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigOperationsRequest_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageTypes().get(11); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigOperationsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstanceConfigOperationsRequest_descriptor, @@ -727,7 +789,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "Filter", "PageSize", "PageToken", }); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigOperationsResponse_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageTypes().get(12); internal_static_google_spanner_admin_instance_v1_ListInstanceConfigOperationsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstanceConfigOperationsResponse_descriptor, @@ -735,7 +797,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Operations", "NextPageToken", }); internal_static_google_spanner_admin_instance_v1_GetInstanceRequest_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageTypes().get(13); internal_static_google_spanner_admin_instance_v1_GetInstanceRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_GetInstanceRequest_descriptor, @@ -743,7 +805,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", "FieldMask", }); internal_static_google_spanner_admin_instance_v1_CreateInstanceRequest_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageTypes().get(14); internal_static_google_spanner_admin_instance_v1_CreateInstanceRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_CreateInstanceRequest_descriptor, @@ -751,7 +813,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "InstanceId", "Instance", }); internal_static_google_spanner_admin_instance_v1_ListInstancesRequest_descriptor = - getDescriptor().getMessageTypes().get(14); + getDescriptor().getMessageTypes().get(15); internal_static_google_spanner_admin_instance_v1_ListInstancesRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancesRequest_descriptor, @@ -759,7 +821,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "PageSize", "PageToken", "Filter", "InstanceDeadline", }); internal_static_google_spanner_admin_instance_v1_ListInstancesResponse_descriptor = - getDescriptor().getMessageTypes().get(15); + getDescriptor().getMessageTypes().get(16); internal_static_google_spanner_admin_instance_v1_ListInstancesResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancesResponse_descriptor, @@ -767,7 +829,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Instances", "NextPageToken", "Unreachable", }); internal_static_google_spanner_admin_instance_v1_UpdateInstanceRequest_descriptor = - getDescriptor().getMessageTypes().get(16); + getDescriptor().getMessageTypes().get(17); internal_static_google_spanner_admin_instance_v1_UpdateInstanceRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_UpdateInstanceRequest_descriptor, @@ -775,7 +837,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Instance", "FieldMask", }); internal_static_google_spanner_admin_instance_v1_DeleteInstanceRequest_descriptor = - getDescriptor().getMessageTypes().get(17); + getDescriptor().getMessageTypes().get(18); internal_static_google_spanner_admin_instance_v1_DeleteInstanceRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_DeleteInstanceRequest_descriptor, @@ -783,7 +845,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", }); internal_static_google_spanner_admin_instance_v1_CreateInstanceMetadata_descriptor = - getDescriptor().getMessageTypes().get(18); + getDescriptor().getMessageTypes().get(19); internal_static_google_spanner_admin_instance_v1_CreateInstanceMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_CreateInstanceMetadata_descriptor, @@ -791,7 +853,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Instance", "StartTime", "CancelTime", "EndTime", "ExpectedFulfillmentPeriod", }); internal_static_google_spanner_admin_instance_v1_UpdateInstanceMetadata_descriptor = - getDescriptor().getMessageTypes().get(19); + getDescriptor().getMessageTypes().get(20); internal_static_google_spanner_admin_instance_v1_UpdateInstanceMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_UpdateInstanceMetadata_descriptor, @@ -799,7 +861,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Instance", "StartTime", "CancelTime", "EndTime", "ExpectedFulfillmentPeriod", }); internal_static_google_spanner_admin_instance_v1_CreateInstanceConfigMetadata_descriptor = - getDescriptor().getMessageTypes().get(20); + getDescriptor().getMessageTypes().get(21); internal_static_google_spanner_admin_instance_v1_CreateInstanceConfigMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_CreateInstanceConfigMetadata_descriptor, @@ -807,7 +869,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstanceConfig", "Progress", "CancelTime", }); internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigMetadata_descriptor = - getDescriptor().getMessageTypes().get(21); + getDescriptor().getMessageTypes().get(22); internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_UpdateInstanceConfigMetadata_descriptor, @@ -815,7 +877,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstanceConfig", "Progress", "CancelTime", }); internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor = - getDescriptor().getMessageTypes().get(22); + getDescriptor().getMessageTypes().get(23); internal_static_google_spanner_admin_instance_v1_InstancePartition_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_InstancePartition_descriptor, @@ -834,7 +896,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "ComputeCapacity", }); internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor = - getDescriptor().getMessageTypes().get(23); + getDescriptor().getMessageTypes().get(24); internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionMetadata_descriptor, @@ -842,7 +904,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstancePartition", "StartTime", "CancelTime", "EndTime", }); internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor = - getDescriptor().getMessageTypes().get(24); + getDescriptor().getMessageTypes().get(25); internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_CreateInstancePartitionRequest_descriptor, @@ -850,7 +912,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "InstancePartitionId", "InstancePartition", }); internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor = - getDescriptor().getMessageTypes().get(25); + getDescriptor().getMessageTypes().get(26); internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_DeleteInstancePartitionRequest_descriptor, @@ -858,7 +920,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", "Etag", }); internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor = - getDescriptor().getMessageTypes().get(26); + getDescriptor().getMessageTypes().get(27); internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_GetInstancePartitionRequest_descriptor, @@ -866,7 +928,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", }); internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor = - getDescriptor().getMessageTypes().get(27); + getDescriptor().getMessageTypes().get(28); internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionRequest_descriptor, @@ -874,7 +936,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstancePartition", "FieldMask", }); internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor = - getDescriptor().getMessageTypes().get(28); + getDescriptor().getMessageTypes().get(29); internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_UpdateInstancePartitionMetadata_descriptor, @@ -882,7 +944,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstancePartition", "StartTime", "CancelTime", "EndTime", }); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor = - getDescriptor().getMessageTypes().get(29); + getDescriptor().getMessageTypes().get(30); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsRequest_descriptor, @@ -890,7 +952,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "PageSize", "PageToken", "InstancePartitionDeadline", }); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor = - getDescriptor().getMessageTypes().get(30); + getDescriptor().getMessageTypes().get(31); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancePartitionsResponse_descriptor, @@ -898,7 +960,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "InstancePartitions", "NextPageToken", "Unreachable", }); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor = - getDescriptor().getMessageTypes().get(31); + getDescriptor().getMessageTypes().get(32); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsRequest_descriptor, @@ -906,7 +968,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Parent", "Filter", "PageSize", "PageToken", "InstancePartitionDeadline", }); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor = - getDescriptor().getMessageTypes().get(32); + getDescriptor().getMessageTypes().get(33); internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_ListInstancePartitionOperationsResponse_descriptor, @@ -914,7 +976,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Operations", "NextPageToken", "UnreachableInstancePartitions", }); internal_static_google_spanner_admin_instance_v1_MoveInstanceRequest_descriptor = - getDescriptor().getMessageTypes().get(33); + getDescriptor().getMessageTypes().get(34); internal_static_google_spanner_admin_instance_v1_MoveInstanceRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_MoveInstanceRequest_descriptor, @@ -922,13 +984,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Name", "TargetConfig", }); internal_static_google_spanner_admin_instance_v1_MoveInstanceResponse_descriptor = - getDescriptor().getMessageTypes().get(34); + getDescriptor().getMessageTypes().get(35); internal_static_google_spanner_admin_instance_v1_MoveInstanceResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_MoveInstanceResponse_descriptor, new java.lang.String[] {}); internal_static_google_spanner_admin_instance_v1_MoveInstanceMetadata_descriptor = - getDescriptor().getMessageTypes().get(35); + getDescriptor().getMessageTypes().get(36); internal_static_google_spanner_admin_instance_v1_MoveInstanceMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_admin_instance_v1_MoveInstanceMetadata_descriptor, diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/common.proto b/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/common.proto index 075b45feaf6..69717ec228a 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/common.proto +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/common.proto @@ -16,6 +16,7 @@ syntax = "proto3"; package google.spanner.admin.instance.v1; +import "google/api/field_behavior.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Spanner.Admin.Instance.V1"; @@ -54,3 +55,9 @@ enum FulfillmentPeriod { // to complete. FULFILLMENT_PERIOD_EXTENDED = 2; } + +// ReplicaSelection identifies replicas with common properties. +message ReplicaSelection { + // Required. Name of the location of the replicas (e.g., "us-central1"). + string location = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto b/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto index b8c49260aac..ece99467a40 100644 --- a/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto +++ b/proto-google-cloud-spanner-admin-instance-v1/src/main/proto/google/spanner/admin/instance/v1/spanner_instance_admin.proto @@ -803,6 +803,34 @@ message InstanceConfig { State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; } +// ReplicaComputeCapacity describes the amount of server resources that are +// allocated to each replica identified by the replica selection. +message ReplicaComputeCapacity { + // Required. Identifies replicas by specified properties. + // All replicas in the selection have the same amount of compute capacity. + ReplicaSelection replica_selection = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Compute capacity allocated to each replica identified by the specified + // selection. + // The unit is selected based on the unit used to specify the instance size + // for non-autoscaling instances, or the unit used in autoscaling limit for + // autoscaling instances. + oneof compute_capacity { + // The number of nodes allocated to each replica. + // + // This may be zero in API responses for instances that are not yet in + // state `READY`. + int32 node_count = 2; + + // The number of processing units allocated to each replica. + // + // This may be zero in API responses for instances that are not yet in + // state `READY`. + int32 processing_units = 3; + } +} + // Autoscaling configuration for an instance. message AutoscalingConfig { // The autoscaling limits for the instance. Users can define the minimum and @@ -854,6 +882,37 @@ message AutoscalingConfig { [(google.api.field_behavior) = REQUIRED]; } + // AsymmetricAutoscalingOption specifies the scaling of replicas identified by + // the given selection. + message AsymmetricAutoscalingOption { + // Overrides the top-level autoscaling configuration for the replicas + // identified by `replica_selection`. All fields in this message are + // optional. Any unspecified fields will use the corresponding values from + // the top-level autoscaling configuration. + message AutoscalingConfigOverrides { + // Optional. If specified, overrides the min/max limit in the top-level + // autoscaling configuration for the selected replicas. + AutoscalingLimits autoscaling_limits = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If specified, overrides the autoscaling target + // high_priority_cpu_utilization_percent in the top-level autoscaling + // configuration for the selected replicas. + int32 autoscaling_target_high_priority_cpu_utilization_percent = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Selects the replicas to which this AsymmetricAutoscalingOption + // applies. Only read-only replicas are supported. + ReplicaSelection replica_selection = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. Overrides applied to the top-level autoscaling configuration + // for the selected replicas. + AutoscalingConfigOverrides overrides = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + // Required. Autoscaling limits for an instance. AutoscalingLimits autoscaling_limits = 1 [(google.api.field_behavior) = REQUIRED]; @@ -861,6 +920,18 @@ message AutoscalingConfig { // Required. The autoscaling targets for an instance. AutoscalingTargets autoscaling_targets = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Optional asymmetric autoscaling options. + // Replicas matching the replica selection criteria will be autoscaled + // independently from other replicas. The autoscaler will scale the replicas + // based on the utilization of replicas identified by the replica selection. + // Replica selections should not overlap with each other. + // + // Other replicas (those do not match any replica selection) will be + // autoscaled together and will have the same compute capacity allocated to + // them. + repeated AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3 + [(google.api.field_behavior) = OPTIONAL]; } // An isolated set of Cloud Spanner resources on which databases can be hosted. @@ -922,34 +993,56 @@ message Instance { // Must be unique per project and between 4 and 30 characters in length. string display_name = 3 [(google.api.field_behavior) = REQUIRED]; - // The number of nodes allocated to this instance. At most one of either - // node_count or processing_units should be present in the message. + // The number of nodes allocated to this instance. At most, one of either + // `node_count` or `processing_units` should be present in the message. // - // Users can set the node_count field to specify the target number of nodes + // Users can set the `node_count` field to specify the target number of nodes // allocated to the instance. // - // This may be zero in API responses for instances that are not yet in state - // `READY`. + // If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY` + // field and reflects the current number of nodes allocated to the instance. // - // See [the - // documentation](https://cloud.google.com/spanner/docs/compute-capacity) - // for more information about nodes and processing units. + // This might be zero in API responses for instances that are not yet in the + // `READY` state. + // + // If the instance has varying node count across replicas (achieved by + // setting asymmetric_autoscaling_options in autoscaling config), the + // node_count here is the maximum node count across all replicas. + // + // For more information, see + // [Compute capacity, nodes, and processing + // units](https://cloud.google.com/spanner/docs/compute-capacity). int32 node_count = 5; - // The number of processing units allocated to this instance. At most one of - // processing_units or node_count should be present in the message. + // The number of processing units allocated to this instance. At most, one of + // either `processing_units` or `node_count` should be present in the message. // - // Users can set the processing_units field to specify the target number of + // Users can set the `processing_units` field to specify the target number of // processing units allocated to the instance. // - // This may be zero in API responses for instances that are not yet in state - // `READY`. + // If autoscaling is enabled, `processing_units` is treated as an + // `OUTPUT_ONLY` field and reflects the current number of processing units + // allocated to the instance. // - // See [the - // documentation](https://cloud.google.com/spanner/docs/compute-capacity) - // for more information about nodes and processing units. + // This might be zero in API responses for instances that are not yet in the + // `READY` state. + // + // If the instance has varying processing units per replica + // (achieved by setting asymmetric_autoscaling_options in autoscaling config), + // the processing_units here is the maximum processing units across all + // replicas. + // + // For more information, see + // [Compute capacity, nodes and processing + // units](https://cloud.google.com/spanner/docs/compute-capacity). int32 processing_units = 9; + // Output only. Lists the compute capacity per ReplicaSelection. A replica + // selection identifies a set of replicas with common properties. Replicas + // identified by a ReplicaSelection are scaled with the same compute capacity. + repeated ReplicaComputeCapacity replica_compute_capacity = 19 + [(google.api.field_behavior) = OUTPUT_ONLY]; + // Optional. The autoscaling configuration. Autoscaling is enabled if this // field is set. When autoscaling is enabled, node_count and processing_units // are treated as OUTPUT_ONLY fields and reflect the current compute capacity From f910f70463726624ea32be7d309af04166037010 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 4 Oct 2024 08:50:24 +0200 Subject: [PATCH 05/10] chore(deps): update dependency com.google.cloud:libraries-bom to v26.48.0 (#3378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://redirect.github.com/googleapis/java-cloud-bom)) | `26.47.0` -> `26.48.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.cloud:libraries-bom/26.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.cloud:libraries-bom/26.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.cloud:libraries-bom/26.47.0/26.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.cloud:libraries-bom/26.47.0/26.48.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
googleapis/java-cloud-bom (com.google.cloud:libraries-bom) ### [`v26.48.0`](https://redirect.github.com/googleapis/java-cloud-bom/blob/HEAD/CHANGELOG.md#26480-2024-10-03) ##### Dependencies - update dependency com.google.cloud:first-party-dependencies to v3.36.1 ([#​6763](https://redirect.github.com/googleapis/java-cloud-bom/issues/6763)) ([77afd40](https://redirect.github.com/googleapis/java-cloud-bom/commit/77afd40862b5b36ed803995a55c3767f21c17925)) - update dependency com.google.cloud:gapic-libraries-bom to v1.45.0 ([#​6774](https://redirect.github.com/googleapis/java-cloud-bom/issues/6774)) ([a224091](https://redirect.github.com/googleapis/java-cloud-bom/commit/a224091eb130b684e1f908bd2b43902b9118e20b)) - update dependency com.google.cloud:google-cloud-bigquery to v2.42.4 ([#​6770](https://redirect.github.com/googleapis/java-cloud-bom/issues/6770)) ([c03a54a](https://redirect.github.com/googleapis/java-cloud-bom/commit/c03a54a69fc031766865579ba029b231a106c68b)) - update dependency com.google.cloud:google-cloud-bigquery to v2.43.0 ([#​6780](https://redirect.github.com/googleapis/java-cloud-bom/issues/6780)) ([0f6b4f4](https://redirect.github.com/googleapis/java-cloud-bom/commit/0f6b4f45f9a6fe7dc8234ed9d5e75ba907cfa74b)) - update dependency com.google.cloud:google-cloud-bigquerystorage-bom to v3.9.2 ([#​6771](https://redirect.github.com/googleapis/java-cloud-bom/issues/6771)) ([97a7ff0](https://redirect.github.com/googleapis/java-cloud-bom/commit/97a7ff084610a230ecea621991de324d1a86fe87)) - update dependency com.google.cloud:google-cloud-bigtable-bom to v2.44.1 ([#​6769](https://redirect.github.com/googleapis/java-cloud-bom/issues/6769)) ([3d567f5](https://redirect.github.com/googleapis/java-cloud-bom/commit/3d567f5c32dd75f9d6e670a8c98a60d3daa1fb02)) - update dependency com.google.cloud:google-cloud-datastore-bom to v2.22.0 ([#​6775](https://redirect.github.com/googleapis/java-cloud-bom/issues/6775)) ([3aed099](https://redirect.github.com/googleapis/java-cloud-bom/commit/3aed0998d6b962da0372038ff72aff974a1b8ff2)) - update dependency com.google.cloud:google-cloud-firestore-bom to v3.26.5 ([#​6768](https://redirect.github.com/googleapis/java-cloud-bom/issues/6768)) ([3a1c7c2](https://redirect.github.com/googleapis/java-cloud-bom/commit/3a1c7c2f6f36a3fe647336dfb0910f96271c4667)) - update dependency com.google.cloud:google-cloud-logging-bom to v3.20.3 ([#​6777](https://redirect.github.com/googleapis/java-cloud-bom/issues/6777)) ([e648e82](https://redirect.github.com/googleapis/java-cloud-bom/commit/e648e82d45863d655b3bbea339794b74efd775f6)) - update dependency com.google.cloud:google-cloud-logging-logback to v0.131.13-alpha ([#​6781](https://redirect.github.com/googleapis/java-cloud-bom/issues/6781)) ([0cd97b7](https://redirect.github.com/googleapis/java-cloud-bom/commit/0cd97b7151b36465390bd5e31d017ec015a4bae9)) - update dependency com.google.cloud:google-cloud-nio to v0.127.24 ([#​6778](https://redirect.github.com/googleapis/java-cloud-bom/issues/6778)) ([8a7988d](https://redirect.github.com/googleapis/java-cloud-bom/commit/8a7988ddad1bbdc1c27d030f3305e9fe47b16a1e)) - update dependency com.google.cloud:google-cloud-pubsub-bom to v1.132.3 ([#​6767](https://redirect.github.com/googleapis/java-cloud-bom/issues/6767)) ([8ed4f05](https://redirect.github.com/googleapis/java-cloud-bom/commit/8ed4f0523b818fa7ac7ff75c9fc2506a6d6c5256)) - update dependency com.google.cloud:google-cloud-pubsub-bom to v1.132.4 ([#​6776](https://redirect.github.com/googleapis/java-cloud-bom/issues/6776)) ([f00726b](https://redirect.github.com/googleapis/java-cloud-bom/commit/f00726b73ea820f81bba4d1af872269882bdc2ef)) - update dependency com.google.cloud:google-cloud-pubsub-bom to v1.133.0 ([#​6779](https://redirect.github.com/googleapis/java-cloud-bom/issues/6779)) ([ffe8e37](https://redirect.github.com/googleapis/java-cloud-bom/commit/ffe8e37c2ca2d7d2068572fd30d91d6a6dc786f1)) - update dependency com.google.cloud:google-cloud-pubsublite-bom to v1.14.3 ([#​6773](https://redirect.github.com/googleapis/java-cloud-bom/issues/6773)) ([5424d5d](https://redirect.github.com/googleapis/java-cloud-bom/commit/5424d5df207a70df386a9eadd51d75a0af253458)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.76.0 ([#​6762](https://redirect.github.com/googleapis/java-cloud-bom/issues/6762)) ([d1846f7](https://redirect.github.com/googleapis/java-cloud-bom/commit/d1846f77320d415c947fc80a0b98063547a79c3b)) - update dependency com.google.cloud:google-cloud-spanner-bom to v6.77.0 ([#​6783](https://redirect.github.com/googleapis/java-cloud-bom/issues/6783)) ([a979ad3](https://redirect.github.com/googleapis/java-cloud-bom/commit/a979ad3a2d7602f31a137b0fb18fed016f3c80d0)) - update dependency com.google.cloud:google-cloud-spanner-jdbc to v2.22.1 ([#​6784](https://redirect.github.com/googleapis/java-cloud-bom/issues/6784)) ([cfff92d](https://redirect.github.com/googleapis/java-cloud-bom/commit/cfff92df9351470235a7519c3fe35f6a097fab9c)) - update dependency com.google.cloud:google-cloud-storage-bom to v2.43.1 ([#​6766](https://redirect.github.com/googleapis/java-cloud-bom/issues/6766)) ([7589d67](https://redirect.github.com/googleapis/java-cloud-bom/commit/7589d676116a555460ae2da0ac9d3e17f4962b15)) - update dependency commons-io:commons-io to v2.17.0 ([#​6758](https://redirect.github.com/googleapis/java-cloud-bom/issues/6758)) ([6f2fe9b](https://redirect.github.com/googleapis/java-cloud-bom/commit/6f2fe9bb75c5212f5a6058e93c4a67f4ccc66d84)) - update dependency ubuntu to v24 ([#​6765](https://redirect.github.com/googleapis/java-cloud-bom/issues/6765)) ([8faee82](https://redirect.github.com/googleapis/java-cloud-bom/commit/8faee82da6aca1b33b10604c247fb1e25da6034f))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/java-spanner). --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 60cabf8ddff..90efc8b5178 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -34,7 +34,7 @@ com.google.cloud libraries-bom - 26.47.0 + 26.48.0 pom import From 438f837231dc4365fd51a876f638d6fdf48609ac Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Wed, 9 Oct 2024 20:39:52 +0530 Subject: [PATCH 06/10] chore: Add client_hash metric attribute (#3357) * chore: Add client_hash metric attribute * review comments --- .../BuiltInOpenTelemetryMetricsProvider.java | 35 +++++++++- ...iltInOpenTelemetryMetricsProviderTest.java | 66 +++++++++++++++++++ ...OpenTelemetryBuiltInMetricsTracerTest.java | 2 +- 3 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProviderTest.java diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java index 42eb76711b0..a7665f8556a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProvider.java @@ -28,6 +28,8 @@ import com.google.cloud.opentelemetry.detection.AttributeKeys; import com.google.cloud.opentelemetry.detection.DetectedPlatform; import com.google.cloud.opentelemetry.detection.GCPPlatformDetector; +import com.google.common.hash.HashFunction; +import com.google.common.hash.Hashing; import io.opentelemetry.api.OpenTelemetry; import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.metrics.SdkMeterProvider; @@ -83,11 +85,40 @@ Map createClientAttributes(String projectId, String client_name) // TODO: Replace this with real value. clientAttributes.put(INSTANCE_CONFIG_ID_KEY.getKey(), "unknown"); clientAttributes.put(CLIENT_NAME_KEY.getKey(), client_name); - clientAttributes.put(CLIENT_UID_KEY.getKey(), getDefaultTaskValue()); - clientAttributes.put(CLIENT_HASH_KEY.getKey(), "cloud_spanner_client_raw_metrics"); + String clientUid = getDefaultTaskValue(); + clientAttributes.put(CLIENT_UID_KEY.getKey(), clientUid); + clientAttributes.put(CLIENT_HASH_KEY.getKey(), generateClientHash(clientUid)); return clientAttributes; } + /** + * Generates a 6-digit zero-padded all lower case hexadecimal representation of hash of the + * accounting group. The hash utilizes the 10 most significant bits of the value returned by + * `Hashing.goodFastHash(64).hashBytes()`, so effectively the returned values are uniformly + * distributed in the range [000000, 0003ff]. + * + *

The primary purpose of this function is to generate a hash value for the `client_hash` + * resource label using `client_uid` metric field. The range of values is chosen to be small + * enough to keep the cardinality of the Resource targets under control. Note: If at later time + * the range needs to be increased, it can be done by increasing the value of `kPrefixLength` to + * up to 24 bits without changing the format of the returned value. + * + * @return Returns a 6-digit zero-padded all lower case hexadecimal representation of hash of the + * accounting group. + */ + static String generateClientHash(String clientUid) { + if (clientUid == null) { + return "000000"; + } + + HashFunction hashFunction = Hashing.goodFastHash(64); + Long hash = hashFunction.hashBytes(clientUid.getBytes()).asLong(); + // Don't change this value without reading above comment + int kPrefixLength = 10; + long shiftedValue = hash >>> (64 - kPrefixLength); + return String.format("%06x", shiftedValue); + } + static String detectClientLocation() { GCPPlatformDetector detector = GCPPlatformDetector.DEFAULT_INSTANCE; DetectedPlatform detectedPlatform = detector.detectPlatform(); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProviderTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProviderTest.java new file mode 100644 index 00000000000..43fe97113d0 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/BuiltInOpenTelemetryMetricsProviderTest.java @@ -0,0 +1,66 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class BuiltInOpenTelemetryMetricsProviderTest { + + @Test + public void testGenerateClientHashWithSimpleUid() { + String clientUid = "testClient"; + verifyHash(BuiltInOpenTelemetryMetricsProvider.generateClientHash(clientUid)); + } + + @Test + public void testGenerateClientHashWithEmptyUid() { + String clientUid = ""; + verifyHash(BuiltInOpenTelemetryMetricsProvider.generateClientHash(clientUid)); + } + + @Test + public void testGenerateClientHashWithNullUid() { + String clientUid = null; + verifyHash(BuiltInOpenTelemetryMetricsProvider.generateClientHash(clientUid)); + } + + @Test + public void testGenerateClientHashWithLongUid() { + String clientUid = "aVeryLongUniqueClientIdentifierThatIsUnusuallyLong"; + verifyHash(BuiltInOpenTelemetryMetricsProvider.generateClientHash(clientUid)); + } + + @Test + public void testGenerateClientHashWithSpecialCharacters() { + String clientUid = "273d60f2-5604-42f1-b687-f5f1b975fd07@2316645@test#"; + verifyHash(BuiltInOpenTelemetryMetricsProvider.generateClientHash(clientUid)); + } + + private void verifyHash(String hash) { + // Check if the hash length is 6 + assertEquals(hash.length(), 6); + // Check if the hash is in the range [000000, 0003ff] + long hashValue = Long.parseLong(hash, 16); // Convert hash from hex to decimal + assertTrue(hashValue >= 0 && hashValue <= 0x3FF); + } +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetryBuiltInMetricsTracerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetryBuiltInMetricsTracerTest.java index 9e3b1bfcc83..d9586acc956 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetryBuiltInMetricsTracerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OpenTelemetryBuiltInMetricsTracerTest.java @@ -99,7 +99,7 @@ public static void setup() { BuiltInOpenTelemetryMetricsProvider.detectClientLocation()) .put(BuiltInMetricsConstant.CLIENT_NAME_KEY, client_name) .put(BuiltInMetricsConstant.CLIENT_UID_KEY, attributes.get("client_uid")) - .put(BuiltInMetricsConstant.CLIENT_HASH_KEY, "cloud_spanner_client_raw_metrics") + .put(BuiltInMetricsConstant.CLIENT_HASH_KEY, attributes.get("client_hash")) .build(); } From 139a715d3f617b20a00b0cf4f5819e5a61a87c96 Mon Sep 17 00:00:00 2001 From: cloud-java-bot <122572305+cloud-java-bot@users.noreply.github.com> Date: Thu, 10 Oct 2024 06:39:47 -0400 Subject: [PATCH 07/10] chore: Update generation configuration at Thu Oct 10 02:24:36 UTC 2024 (#3385) * chore: Update generation configuration at Sat Oct 5 02:23:23 UTC 2024 * chore: generate libraries at Sat Oct 5 02:23:49 UTC 2024 * chore: Update generation configuration at Sun Oct 6 02:26:59 UTC 2024 * chore: generate libraries at Sun Oct 6 02:27:24 UTC 2024 * chore: Update generation configuration at Tue Oct 8 02:26:11 UTC 2024 * chore: Update generation configuration at Wed Oct 9 02:24:28 UTC 2024 * chore: Update generation configuration at Wed Oct 9 10:12:15 UTC 2024 * chore: generate libraries at Wed Oct 9 10:12:45 UTC 2024 * chore: Update generation configuration at Thu Oct 10 02:24:36 UTC 2024 --- README.md | 2 +- generation_config.yaml | 4 +- .../reflect-config.json | 18 + .../cloud/spanner/v1/SpannerClient.java | 4 + .../reflect-config.json | 18 + .../spanner/v1/SpannerClientHttpJsonTest.java | 6 + .../cloud/spanner/v1/SpannerClientTest.java | 8 + .../spanner/v1/BeginTransactionRequest.java | 341 +++++++++ .../v1/BeginTransactionRequestOrBuilder.java | 53 ++ .../com/google/spanner/v1/CommitRequest.java | 359 ++++++++++ .../spanner/v1/CommitRequestOrBuilder.java | 56 ++ .../com/google/spanner/v1/CommitResponse.java | 396 +++++++++++ .../spanner/v1/CommitResponseOrBuilder.java | 40 ++ .../spanner/v1/CommitResponseProto.java | 28 +- .../spanner/v1/ExecuteBatchDmlResponse.java | 371 ++++++++++ .../v1/ExecuteBatchDmlResponseOrBuilder.java | 59 ++ .../v1/MultiplexedSessionPrecommitToken.java | 648 ++++++++++++++++++ ...iplexedSessionPrecommitTokenOrBuilder.java | 54 ++ .../google/spanner/v1/PartialResultSet.java | 371 ++++++++++ .../spanner/v1/PartialResultSetOrBuilder.java | 59 ++ .../java/com/google/spanner/v1/ResultSet.java | 371 ++++++++++ .../google/spanner/v1/ResultSetOrBuilder.java | 59 ++ .../com/google/spanner/v1/ResultSetProto.java | 72 +- .../com/google/spanner/v1/SpannerProto.java | 332 ++++----- .../com/google/spanner/v1/Transaction.java | 371 ++++++++++ .../google/spanner/v1/TransactionOptions.java | 149 ++++ .../spanner/v1/TransactionOrBuilder.java | 59 ++ .../google/spanner/v1/TransactionProto.java | 95 ++- .../google/spanner/v1/commit_response.proto | 9 + .../proto/google/spanner/v1/result_set.proto | 21 + .../proto/google/spanner/v1/spanner.proto | 27 + .../proto/google/spanner/v1/transaction.proto | 34 + renovate.json | 17 + 33 files changed, 4269 insertions(+), 242 deletions(-) create mode 100644 proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java create mode 100644 proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java diff --git a/README.md b/README.md index d7455f36eb2..c83cd4fbb79 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 - 26.47.0 + 26.48.0 pom import diff --git a/generation_config.yaml b/generation_config.yaml index 0da6abef7b8..53e16e1af10 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,5 +1,5 @@ -gapic_generator_version: 2.46.1 -googleapis_commitish: b6a27d13a2f0223051ef720e4e9d0d52323560e6 +gapic_generator_version: 2.47.0 +googleapis_commitish: 10b8dc3b54c9a609dcfda8060b8c4c734a942e8c libraries_bom_version: 26.48.0 libraries: - api_shortname: spanner diff --git a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json index 2b261bc156b..4fe624b7aa7 100644 --- a/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json +++ b/google-cloud-spanner-executor/src/main/resources/META-INF/native-image/com.google.cloud.spanner.executor.v1/reflect-config.json @@ -5471,6 +5471,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.v1.MultiplexedSessionPrecommitToken", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.v1.MultiplexedSessionPrecommitToken$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.v1.Mutation", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java index 64ffdb0902a..8625c17785a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java @@ -1629,6 +1629,7 @@ public final Transaction beginTransaction(String session, TransactionOptions opt * SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").toString()) * .setOptions(TransactionOptions.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setMutationKey(Mutation.newBuilder().build()) * .build(); * Transaction response = spannerClient.beginTransaction(request); * } @@ -1662,6 +1663,7 @@ public final Transaction beginTransaction(BeginTransactionRequest request) { * SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").toString()) * .setOptions(TransactionOptions.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setMutationKey(Mutation.newBuilder().build()) * .build(); * ApiFuture future = spannerClient.beginTransactionCallable().futureCall(request); * // Do something. @@ -1911,6 +1913,7 @@ public final CommitResponse commit( * .setReturnCommitStats(true) * .setMaxCommitDelay(Duration.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) * .build(); * CommitResponse response = spannerClient.commit(request); * } @@ -1955,6 +1958,7 @@ public final CommitResponse commit(CommitRequest request) { * .setReturnCommitStats(true) * .setMaxCommitDelay(Duration.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) * .build(); * ApiFuture future = spannerClient.commitCallable().futureCall(request); * // Do something. diff --git a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json index 62b2c263dd8..ffa070f1225 100644 --- a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json +++ b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json @@ -1745,6 +1745,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.v1.MultiplexedSessionPrecommitToken", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.v1.MultiplexedSessionPrecommitToken$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.v1.Mutation", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java index 3b5f106f13f..1683d533855 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java @@ -44,6 +44,7 @@ import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.KeySet; import com.google.spanner.v1.ListSessionsResponse; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.Mutation; import com.google.spanner.v1.Partition; import com.google.spanner.v1.PartitionOptions; @@ -587,6 +588,7 @@ public void executeSqlTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -673,6 +675,7 @@ public void executeBatchDmlTest() throws Exception { ExecuteBatchDmlResponse.newBuilder() .addAllResultSets(new ArrayList()) .setStatus(Status.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -735,6 +738,7 @@ public void readTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -821,6 +825,7 @@ public void beginTransactionTest() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -868,6 +873,7 @@ public void beginTransactionTest2() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java index 22f578ac2bc..83caf7405d9 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java @@ -55,6 +55,7 @@ import com.google.spanner.v1.KeySet; import com.google.spanner.v1.ListSessionsRequest; import com.google.spanner.v1.ListSessionsResponse; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.Mutation; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.Partition; @@ -545,6 +546,7 @@ public void executeSqlTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -629,6 +631,7 @@ public void executeStreamingSqlTest() throws Exception { .setChunkedValue(true) .setResumeToken(ByteString.EMPTY) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); ExecuteSqlRequest request = @@ -702,6 +705,7 @@ public void executeBatchDmlTest() throws Exception { ExecuteBatchDmlResponse.newBuilder() .addAllResultSets(new ArrayList()) .setStatus(Status.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -762,6 +766,7 @@ public void readTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -847,6 +852,7 @@ public void streamingReadTest() throws Exception { .setChunkedValue(true) .setResumeToken(ByteString.EMPTY) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); ReadRequest request = @@ -920,6 +926,7 @@ public void beginTransactionTest() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -962,6 +969,7 @@ public void beginTransactionTest2() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java index 3d50999d6a6..59ef89bb161 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java @@ -238,6 +238,74 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( : requestOptions_; } + public static final int MUTATION_KEY_FIELD_NUMBER = 4; + private com.google.spanner.v1.Mutation mutationKey_; + /** + * + * + *

+   * Optional. Required for read-write transactions on a multiplexed session
+   * that commit mutations but do not perform any reads or queries. Clients
+   * should randomly select one of the mutations from the mutation set and send
+   * it as a part of this request.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the mutationKey field is set. + */ + @java.lang.Override + public boolean hasMutationKey() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * Optional. Required for read-write transactions on a multiplexed session
+   * that commit mutations but do not perform any reads or queries. Clients
+   * should randomly select one of the mutations from the mutation set and send
+   * it as a part of this request.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The mutationKey. + */ + @java.lang.Override + public com.google.spanner.v1.Mutation getMutationKey() { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } + /** + * + * + *
+   * Optional. Required for read-write transactions on a multiplexed session
+   * that commit mutations but do not perform any reads or queries. Clients
+   * should randomly select one of the mutations from the mutation set and send
+   * it as a part of this request.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MutationOrBuilder getMutationKeyOrBuilder() { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -261,6 +329,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(3, getRequestOptions()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(4, getMutationKey()); + } getUnknownFields().writeTo(output); } @@ -279,6 +350,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getRequestOptions()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getMutationKey()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -304,6 +378,10 @@ public boolean equals(final java.lang.Object obj) { if (hasRequestOptions()) { if (!getRequestOptions().equals(other.getRequestOptions())) return false; } + if (hasMutationKey() != other.hasMutationKey()) return false; + if (hasMutationKey()) { + if (!getMutationKey().equals(other.getMutationKey())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -325,6 +403,10 @@ public int hashCode() { hash = (37 * hash) + REQUEST_OPTIONS_FIELD_NUMBER; hash = (53 * hash) + getRequestOptions().hashCode(); } + if (hasMutationKey()) { + hash = (37 * hash) + MUTATION_KEY_FIELD_NUMBER; + hash = (53 * hash) + getMutationKey().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -468,6 +550,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getOptionsFieldBuilder(); getRequestOptionsFieldBuilder(); + getMutationKeyFieldBuilder(); } } @@ -486,6 +569,11 @@ public Builder clear() { requestOptionsBuilder_.dispose(); requestOptionsBuilder_ = null; } + mutationKey_ = null; + if (mutationKeyBuilder_ != null) { + mutationKeyBuilder_.dispose(); + mutationKeyBuilder_ = null; + } return this; } @@ -535,6 +623,11 @@ private void buildPartial0(com.google.spanner.v1.BeginTransactionRequest result) requestOptionsBuilder_ == null ? requestOptions_ : requestOptionsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.mutationKey_ = + mutationKeyBuilder_ == null ? mutationKey_ : mutationKeyBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -594,6 +687,9 @@ public Builder mergeFrom(com.google.spanner.v1.BeginTransactionRequest other) { if (other.hasRequestOptions()) { mergeRequestOptions(other.getRequestOptions()); } + if (other.hasMutationKey()) { + mergeMutationKey(other.getMutationKey()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -638,6 +734,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 34: + { + input.readMessage(getMutationKeyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1197,6 +1299,245 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( return requestOptionsBuilder_; } + private com.google.spanner.v1.Mutation mutationKey_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.Mutation, + com.google.spanner.v1.Mutation.Builder, + com.google.spanner.v1.MutationOrBuilder> + mutationKeyBuilder_; + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the mutationKey field is set. + */ + public boolean hasMutationKey() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The mutationKey. + */ + public com.google.spanner.v1.Mutation getMutationKey() { + if (mutationKeyBuilder_ == null) { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } else { + return mutationKeyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMutationKey(com.google.spanner.v1.Mutation value) { + if (mutationKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + mutationKey_ = value; + } else { + mutationKeyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMutationKey(com.google.spanner.v1.Mutation.Builder builderForValue) { + if (mutationKeyBuilder_ == null) { + mutationKey_ = builderForValue.build(); + } else { + mutationKeyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMutationKey(com.google.spanner.v1.Mutation value) { + if (mutationKeyBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && mutationKey_ != null + && mutationKey_ != com.google.spanner.v1.Mutation.getDefaultInstance()) { + getMutationKeyBuilder().mergeFrom(value); + } else { + mutationKey_ = value; + } + } else { + mutationKeyBuilder_.mergeFrom(value); + } + if (mutationKey_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMutationKey() { + bitField0_ = (bitField0_ & ~0x00000008); + mutationKey_ = null; + if (mutationKeyBuilder_ != null) { + mutationKeyBuilder_.dispose(); + mutationKeyBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.Mutation.Builder getMutationKeyBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getMutationKeyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MutationOrBuilder getMutationKeyOrBuilder() { + if (mutationKeyBuilder_ != null) { + return mutationKeyBuilder_.getMessageOrBuilder(); + } else { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } + } + /** + * + * + *
+     * Optional. Required for read-write transactions on a multiplexed session
+     * that commit mutations but do not perform any reads or queries. Clients
+     * should randomly select one of the mutations from the mutation set and send
+     * it as a part of this request.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.Mutation, + com.google.spanner.v1.Mutation.Builder, + com.google.spanner.v1.MutationOrBuilder> + getMutationKeyFieldBuilder() { + if (mutationKeyBuilder_ == null) { + mutationKeyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.Mutation, + com.google.spanner.v1.Mutation.Builder, + com.google.spanner.v1.MutationOrBuilder>( + getMutationKey(), getParentForChildren(), isClean()); + mutationKey_ = null; + } + return mutationKeyBuilder_; + } + @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/BeginTransactionRequestOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java index a002d48e49f..0d67610b513 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java @@ -140,4 +140,57 @@ public interface BeginTransactionRequestOrBuilder * .google.spanner.v1.RequestOptions request_options = 3; */ com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder(); + + /** + * + * + *
+   * Optional. Required for read-write transactions on a multiplexed session
+   * that commit mutations but do not perform any reads or queries. Clients
+   * should randomly select one of the mutations from the mutation set and send
+   * it as a part of this request.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the mutationKey field is set. + */ + boolean hasMutationKey(); + /** + * + * + *
+   * Optional. Required for read-write transactions on a multiplexed session
+   * that commit mutations but do not perform any reads or queries. Clients
+   * should randomly select one of the mutations from the mutation set and send
+   * it as a part of this request.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The mutationKey. + */ + com.google.spanner.v1.Mutation getMutationKey(); + /** + * + * + *
+   * Optional. Required for read-write transactions on a multiplexed session
+   * that commit mutations but do not perform any reads or queries. Clients
+   * should randomly select one of the mutations from the mutation set and send
+   * it as a part of this request.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MutationOrBuilder getMutationKeyOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java index 1fd86689bd9..d026425bfbb 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java @@ -495,6 +495,78 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( : requestOptions_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 9; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * Optional. If the read-write transaction was executed on a multiplexed
+   * session, the precommit token with the highest sequence number received in
+   * this transaction attempt, should be included here. Failing to do so will
+   * result in a FailedPrecondition error.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * Optional. If the read-write transaction was executed on a multiplexed
+   * session, the precommit token with the highest sequence number received in
+   * this transaction attempt, should be included here. Failing to do so will
+   * result in a FailedPrecondition error.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * Optional. If the read-write transaction was executed on a multiplexed
+   * session, the precommit token with the highest sequence number received in
+   * this transaction attempt, should be included here. Failing to do so will
+   * result in a FailedPrecondition error.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -530,6 +602,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(8, getMaxCommitDelay()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(9, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -564,6 +639,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getMaxCommitDelay()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -590,6 +668,10 @@ public boolean equals(final java.lang.Object obj) { if (hasRequestOptions()) { if (!getRequestOptions().equals(other.getRequestOptions())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getTransactionCase().equals(other.getTransactionCase())) return false; switch (transactionCase_) { case 2: @@ -628,6 +710,10 @@ public int hashCode() { hash = (37 * hash) + REQUEST_OPTIONS_FIELD_NUMBER; hash = (53 * hash) + getRequestOptions().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } switch (transactionCase_) { case 2: hash = (37 * hash) + TRANSACTION_ID_FIELD_NUMBER; @@ -782,6 +868,7 @@ private void maybeForceBuilderInitialization() { getMutationsFieldBuilder(); getMaxCommitDelayFieldBuilder(); getRequestOptionsFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -811,6 +898,11 @@ public Builder clear() { requestOptionsBuilder_.dispose(); requestOptionsBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } transactionCase_ = 0; transaction_ = null; return this; @@ -879,6 +971,11 @@ private void buildPartial0(com.google.spanner.v1.CommitRequest result) { requestOptionsBuilder_ == null ? requestOptions_ : requestOptionsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -976,6 +1073,9 @@ public Builder mergeFrom(com.google.spanner.v1.CommitRequest other) { if (other.hasRequestOptions()) { mergeRequestOptions(other.getRequestOptions()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } switch (other.getTransactionCase()) { case TRANSACTION_ID: { @@ -1067,6 +1167,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000020; break; } // case 66 + case 74: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000080; + break; + } // case 74 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2434,6 +2540,259 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( return requestOptionsBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000080) != 0); + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000080) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000080; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000080); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000080; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * Optional. If the read-write transaction was executed on a multiplexed
+     * session, the precommit token with the highest sequence number received in
+     * this transaction attempt, should be included here. Failing to do so will
+     * result in a FailedPrecondition error.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @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/CommitRequestOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java index 9695373e6ae..3a9703e11c0 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java @@ -298,5 +298,61 @@ public interface CommitRequestOrBuilder */ com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder(); + /** + * + * + *
+   * Optional. If the read-write transaction was executed on a multiplexed
+   * session, the precommit token with the highest sequence number received in
+   * this transaction attempt, should be included here. Failing to do so will
+   * result in a FailedPrecondition error.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * Optional. If the read-write transaction was executed on a multiplexed
+   * session, the precommit token with the highest sequence number received in
+   * this transaction attempt, should be included here. Failing to do so will
+   * result in a FailedPrecondition error.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * Optional. If the read-write transaction was executed on a multiplexed
+   * session, the precommit token with the highest sequence number received in
+   * this transaction attempt, should be included here. Failing to do so will
+   * result in a FailedPrecondition error.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); + com.google.spanner.v1.CommitRequest.TransactionCase getTransactionCase(); } 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 8e168f24885..af19b73626d 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 @@ -631,6 +631,52 @@ public com.google.spanner.v1.CommitResponse.CommitStats getDefaultInstanceForTyp } private int bitField0_; + private int multiplexedSessionRetryCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object multiplexedSessionRetry_; + + public enum MultiplexedSessionRetryCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PRECOMMIT_TOKEN(4), + MULTIPLEXEDSESSIONRETRY_NOT_SET(0); + private final int value; + + private MultiplexedSessionRetryCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MultiplexedSessionRetryCase valueOf(int value) { + return forNumber(value); + } + + public static MultiplexedSessionRetryCase forNumber(int value) { + switch (value) { + case 4: + return PRECOMMIT_TOKEN; + case 0: + return MULTIPLEXEDSESSIONRETRY_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public MultiplexedSessionRetryCase getMultiplexedSessionRetryCase() { + return MultiplexedSessionRetryCase.forNumber(multiplexedSessionRetryCase_); + } + public static final int COMMIT_TIMESTAMP_FIELD_NUMBER = 1; private com.google.protobuf.Timestamp commitTimestamp_; /** @@ -737,6 +783,61 @@ public com.google.spanner.v1.CommitResponse.CommitStatsOrBuilder getCommitStatsO : commitStats_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 4; + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return multiplexedSessionRetryCase_ == 4; + } + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -757,6 +858,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getCommitStats()); } + if (multiplexedSessionRetryCase_ == 4) { + output.writeMessage( + 4, (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_); + } getUnknownFields().writeTo(output); } @@ -772,6 +877,11 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCommitStats()); } + if (multiplexedSessionRetryCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -795,6 +905,15 @@ public boolean equals(final java.lang.Object obj) { if (hasCommitStats()) { if (!getCommitStats().equals(other.getCommitStats())) return false; } + if (!getMultiplexedSessionRetryCase().equals(other.getMultiplexedSessionRetryCase())) + return false; + switch (multiplexedSessionRetryCase_) { + case 4: + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + break; + case 0: + default: + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -814,6 +933,14 @@ public int hashCode() { hash = (37 * hash) + COMMIT_STATS_FIELD_NUMBER; hash = (53 * hash) + getCommitStats().hashCode(); } + switch (multiplexedSessionRetryCase_) { + case 4: + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + break; + case 0: + default: + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -972,6 +1099,11 @@ public Builder clear() { commitStatsBuilder_.dispose(); commitStatsBuilder_ = null; } + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.clear(); + } + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; return this; } @@ -1001,6 +1133,7 @@ public com.google.spanner.v1.CommitResponse buildPartial() { if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); onBuilt(); return result; } @@ -1021,6 +1154,14 @@ private void buildPartial0(com.google.spanner.v1.CommitResponse result) { result.bitField0_ |= to_bitField0_; } + private void buildPartialOneofs(com.google.spanner.v1.CommitResponse result) { + result.multiplexedSessionRetryCase_ = multiplexedSessionRetryCase_; + result.multiplexedSessionRetry_ = this.multiplexedSessionRetry_; + if (multiplexedSessionRetryCase_ == 4 && precommitTokenBuilder_ != null) { + result.multiplexedSessionRetry_ = precommitTokenBuilder_.build(); + } + } + @java.lang.Override public Builder clone() { return super.clone(); @@ -1072,6 +1213,17 @@ public Builder mergeFrom(com.google.spanner.v1.CommitResponse other) { if (other.hasCommitStats()) { mergeCommitStats(other.getCommitStats()); } + switch (other.getMultiplexedSessionRetryCase()) { + case PRECOMMIT_TOKEN: + { + mergePrecommitToken(other.getPrecommitToken()); + break; + } + case MULTIPLEXEDSESSIONRETRY_NOT_SET: + { + break; + } + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1110,6 +1262,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 34: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + multiplexedSessionRetryCase_ = 4; + break; + } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1127,6 +1285,20 @@ public Builder mergeFrom( return this; } + private int multiplexedSessionRetryCase_ = 0; + private java.lang.Object multiplexedSessionRetry_; + + public MultiplexedSessionRetryCase getMultiplexedSessionRetryCase() { + return MultiplexedSessionRetryCase.forNumber(multiplexedSessionRetryCase_); + } + + public Builder clearMultiplexedSessionRetry() { + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; + onChanged(); + return this; + } + private int bitField0_; private com.google.protobuf.Timestamp commitTimestamp_; @@ -1519,6 +1691,230 @@ public com.google.spanner.v1.CommitResponse.CommitStatsOrBuilder getCommitStatsO return commitStatsBuilder_; } + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return multiplexedSessionRetryCase_ == 4; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } else { + if (multiplexedSessionRetryCase_ == 4) { + return precommitTokenBuilder_.getMessage(); + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + multiplexedSessionRetry_ = value; + onChanged(); + } else { + precommitTokenBuilder_.setMessage(value); + } + multiplexedSessionRetryCase_ = 4; + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + multiplexedSessionRetry_ = builderForValue.build(); + onChanged(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + multiplexedSessionRetryCase_ = 4; + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (multiplexedSessionRetryCase_ == 4 + && multiplexedSessionRetry_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + multiplexedSessionRetry_ = + com.google.spanner.v1.MultiplexedSessionPrecommitToken.newBuilder( + (com.google.spanner.v1.MultiplexedSessionPrecommitToken) + multiplexedSessionRetry_) + .mergeFrom(value) + .buildPartial(); + } else { + multiplexedSessionRetry_ = value; + } + onChanged(); + } else { + if (multiplexedSessionRetryCase_ == 4) { + precommitTokenBuilder_.mergeFrom(value); + } else { + precommitTokenBuilder_.setMessage(value); + } + } + multiplexedSessionRetryCase_ = 4; + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder clearPrecommitToken() { + if (precommitTokenBuilder_ == null) { + if (multiplexedSessionRetryCase_ == 4) { + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; + onChanged(); + } + } else { + if (multiplexedSessionRetryCase_ == 4) { + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; + } + precommitTokenBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if ((multiplexedSessionRetryCase_ == 4) && (precommitTokenBuilder_ != null)) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + if (!(multiplexedSessionRetryCase_ == 4)) { + multiplexedSessionRetry_ = + com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_, + getParentForChildren(), + isClean()); + multiplexedSessionRetry_ = null; + } + multiplexedSessionRetryCase_ = 4; + onChanged(); + return precommitTokenBuilder_; + } + @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/CommitResponseOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java index 6319f1c5410..9a4e8b04a0a 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java @@ -99,4 +99,44 @@ public interface CommitResponseOrBuilder * .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; */ com.google.spanner.v1.CommitResponse.CommitStatsOrBuilder getCommitStatsOrBuilder(); + + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); + + com.google.spanner.v1.CommitResponse.MultiplexedSessionRetryCase getMultiplexedSessionRetryCase(); } 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 ade85fea295..bd550231631 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 @@ -47,22 +47,27 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n\'google/spanner/v1/commit_response.prot" + "o\022\021google.spanner.v1\032\037google/protobuf/ti" - + "mestamp.proto\"\262\001\n\016CommitResponse\0224\n\020comm" - + "it_timestamp\030\001 \001(\0132\032.google.protobuf.Tim" - + "estamp\022C\n\014commit_stats\030\002 \001(\0132-.google.sp" - + "anner.v1.CommitResponse.CommitStats\032%\n\013C" - + "ommitStats\022\026\n\016mutation_count\030\001 \001(\003B\266\001\n\025c" - + "om.google.spanner.v1B\023CommitResponseProt" - + "oP\001Z5cloud.google.com/go/spanner/apiv1/s" - + "pannerpb;spannerpb\252\002\027Google.Cloud.Spanne" - + "r.V1\312\002\027Google\\Cloud\\Spanner\\V1\352\002\032Google:" - + ":Cloud::Spanner::V1b\006proto3" + + "mestamp.proto\032#google/spanner/v1/transac" + + "tion.proto\"\235\002\n\016CommitResponse\0224\n\020commit_" + + "timestamp\030\001 \001(\0132\032.google.protobuf.Timest" + + "amp\022C\n\014commit_stats\030\002 \001(\0132-.google.spann" + + "er.v1.CommitResponse.CommitStats\022N\n\017prec" + + "ommit_token\030\004 \001(\01323.google.spanner.v1.Mu" + + "ltiplexedSessionPrecommitTokenH\000\032%\n\013Comm" + + "itStats\022\026\n\016mutation_count\030\001 \001(\003B\031\n\027Multi" + + "plexedSessionRetryB\266\001\n\025com.google.spanne" + + "r.v1B\023CommitResponseProtoP\001Z5cloud.googl" + + "e.com/go/spanner/apiv1/spannerpb;spanner" + + "pb\252\002\027Google.Cloud.Spanner.V1\312\002\027Google\\Cl" + + "oud\\Spanner\\V1\352\002\032Google::Cloud::Spanner:" + + ":V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.TimestampProto.getDescriptor(), + com.google.spanner.v1.TransactionProto.getDescriptor(), }); internal_static_google_spanner_v1_CommitResponse_descriptor = getDescriptor().getMessageTypes().get(0); @@ -70,7 +75,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_CommitResponse_descriptor, new java.lang.String[] { - "CommitTimestamp", "CommitStats", + "CommitTimestamp", "CommitStats", "PrecommitToken", "MultiplexedSessionRetry", }); internal_static_google_spanner_v1_CommitResponse_CommitStats_descriptor = internal_static_google_spanner_v1_CommitResponse_descriptor.getNestedTypes().get(0); @@ -81,6 +86,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "MutationCount", }); com.google.protobuf.TimestampProto.getDescriptor(); + com.google.spanner.v1.TransactionProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java index 4a02f258fba..8fed7627083 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java @@ -254,6 +254,81 @@ public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 3; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -274,6 +349,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getStatus()); } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -289,6 +367,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStatus()); } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -310,6 +391,10 @@ public boolean equals(final java.lang.Object obj) { if (hasStatus()) { if (!getStatus().equals(other.getStatus())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -329,6 +414,10 @@ public int hashCode() { hash = (37 * hash) + STATUS_FIELD_NUMBER; hash = (53 * hash) + getStatus().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -501,6 +590,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getResultSetsFieldBuilder(); getStatusFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -520,6 +610,11 @@ public Builder clear() { statusBuilder_.dispose(); statusBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -574,6 +669,11 @@ private void buildPartial0(com.google.spanner.v1.ExecuteBatchDmlResponse result) result.status_ = statusBuilder_ == null ? status_ : statusBuilder_.build(); to_bitField0_ |= 0x00000001; } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000002; + } result.bitField0_ |= to_bitField0_; } @@ -652,6 +752,9 @@ public Builder mergeFrom(com.google.spanner.v1.ExecuteBatchDmlResponse other) { if (other.hasStatus()) { mergeStatus(other.getStatus()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -696,6 +799,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1392,6 +1501,268 @@ public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { return statusBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000004); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @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/ExecuteBatchDmlResponseOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java index bc86ce4612e..6b7dbfe17a8 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java @@ -152,4 +152,63 @@ public interface ExecuteBatchDmlResponseOrBuilder * .google.rpc.Status status = 2; */ com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java new file mode 100644 index 00000000000..406ebe14199 --- /dev/null +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java @@ -0,0 +1,648 @@ +/* + * Copyright 2024 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/transaction.proto + +// Protobuf Java Version: 3.25.5 +package com.google.spanner.v1; + +/** + * + * + *
+ * When a read-write transaction is executed on a multiplexed session,
+ * this precommit token is sent back to the client
+ * as a part of the [Transaction] message in the BeginTransaction response and
+ * also as a part of the [ResultSet] and [PartialResultSet] responses.
+ * 
+ * + * Protobuf type {@code google.spanner.v1.MultiplexedSessionPrecommitToken} + */ +public final class MultiplexedSessionPrecommitToken extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.v1.MultiplexedSessionPrecommitToken) + MultiplexedSessionPrecommitTokenOrBuilder { + private static final long serialVersionUID = 0L; + // Use MultiplexedSessionPrecommitToken.newBuilder() to construct. + private MultiplexedSessionPrecommitToken( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private MultiplexedSessionPrecommitToken() { + precommitToken_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new MultiplexedSessionPrecommitToken(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.class, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder.class); + } + + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString precommitToken_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * Opaque precommit token.
+   * 
+ * + * bytes precommit_token = 1; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPrecommitToken() { + return precommitToken_; + } + + public static final int SEQ_NUM_FIELD_NUMBER = 2; + private int seqNum_ = 0; + /** + * + * + *
+   * An incrementing seq number is generated on every precommit token
+   * that is returned. Clients should remember the precommit token with the
+   * highest sequence number from the current transaction attempt.
+   * 
+ * + * int32 seq_num = 2; + * + * @return The seqNum. + */ + @java.lang.Override + public int getSeqNum() { + return seqNum_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!precommitToken_.isEmpty()) { + output.writeBytes(1, precommitToken_); + } + if (seqNum_ != 0) { + output.writeInt32(2, seqNum_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!precommitToken_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, precommitToken_); + } + if (seqNum_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, seqNum_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.v1.MultiplexedSessionPrecommitToken)) { + return super.equals(obj); + } + com.google.spanner.v1.MultiplexedSessionPrecommitToken other = + (com.google.spanner.v1.MultiplexedSessionPrecommitToken) obj; + + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + if (getSeqNum() != other.getSeqNum()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + hash = (37 * hash) + SEQ_NUM_FIELD_NUMBER; + hash = (53 * hash) + getSeqNum(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.v1.MultiplexedSessionPrecommitToken prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * When a read-write transaction is executed on a multiplexed session,
+   * this precommit token is sent back to the client
+   * as a part of the [Transaction] message in the BeginTransaction response and
+   * also as a part of the [ResultSet] and [PartialResultSet] responses.
+   * 
+ * + * Protobuf type {@code google.spanner.v1.MultiplexedSessionPrecommitToken} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.v1.MultiplexedSessionPrecommitToken) + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.class, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder.class); + } + + // Construct using com.google.spanner.v1.MultiplexedSessionPrecommitToken.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + precommitToken_ = com.google.protobuf.ByteString.EMPTY; + seqNum_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getDefaultInstanceForType() { + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken build() { + com.google.spanner.v1.MultiplexedSessionPrecommitToken result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken buildPartial() { + com.google.spanner.v1.MultiplexedSessionPrecommitToken result = + new com.google.spanner.v1.MultiplexedSessionPrecommitToken(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.v1.MultiplexedSessionPrecommitToken result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.precommitToken_ = precommitToken_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.seqNum_ = seqNum_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.v1.MultiplexedSessionPrecommitToken) { + return mergeFrom((com.google.spanner.v1.MultiplexedSessionPrecommitToken) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.v1.MultiplexedSessionPrecommitToken other) { + if (other == com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) + return this; + if (other.getPrecommitToken() != com.google.protobuf.ByteString.EMPTY) { + setPrecommitToken(other.getPrecommitToken()); + } + if (other.getSeqNum() != 0) { + setSeqNum(other.getSeqNum()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + precommitToken_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + seqNum_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.ByteString precommitToken_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Opaque precommit token.
+     * 
+ * + * bytes precommit_token = 1; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPrecommitToken() { + return precommitToken_; + } + /** + * + * + *
+     * Opaque precommit token.
+     * 
+ * + * bytes precommit_token = 1; + * + * @param value The precommitToken to set. + * @return This builder for chaining. + */ + public Builder setPrecommitToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Opaque precommit token.
+     * 
+ * + * bytes precommit_token = 1; + * + * @return This builder for chaining. + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000001); + precommitToken_ = getDefaultInstance().getPrecommitToken(); + onChanged(); + return this; + } + + private int seqNum_; + /** + * + * + *
+     * An incrementing seq number is generated on every precommit token
+     * that is returned. Clients should remember the precommit token with the
+     * highest sequence number from the current transaction attempt.
+     * 
+ * + * int32 seq_num = 2; + * + * @return The seqNum. + */ + @java.lang.Override + public int getSeqNum() { + return seqNum_; + } + /** + * + * + *
+     * An incrementing seq number is generated on every precommit token
+     * that is returned. Clients should remember the precommit token with the
+     * highest sequence number from the current transaction attempt.
+     * 
+ * + * int32 seq_num = 2; + * + * @param value The seqNum to set. + * @return This builder for chaining. + */ + public Builder setSeqNum(int value) { + + seqNum_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * An incrementing seq number is generated on every precommit token
+     * that is returned. Clients should remember the precommit token with the
+     * highest sequence number from the current transaction attempt.
+     * 
+ * + * int32 seq_num = 2; + * + * @return This builder for chaining. + */ + public Builder clearSeqNum() { + bitField0_ = (bitField0_ & ~0x00000002); + seqNum_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.v1.MultiplexedSessionPrecommitToken) + } + + // @@protoc_insertion_point(class_scope:google.spanner.v1.MultiplexedSessionPrecommitToken) + private static final com.google.spanner.v1.MultiplexedSessionPrecommitToken DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.v1.MultiplexedSessionPrecommitToken(); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MultiplexedSessionPrecommitToken parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java new file mode 100644 index 00000000000..1c8a9d74b98 --- /dev/null +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2024 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/transaction.proto + +// Protobuf Java Version: 3.25.5 +package com.google.spanner.v1; + +public interface MultiplexedSessionPrecommitTokenOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.v1.MultiplexedSessionPrecommitToken) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Opaque precommit token.
+   * 
+ * + * bytes precommit_token = 1; + * + * @return The precommitToken. + */ + com.google.protobuf.ByteString getPrecommitToken(); + + /** + * + * + *
+   * An incrementing seq number is generated on every precommit token
+   * that is returned. Clients should remember the precommit token with the
+   * highest sequence number from the current transaction attempt.
+   * 
+ * + * int32 seq_num = 2; + * + * @return The seqNum. + */ + int getSeqNum(); +} diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java index a77ec47c7be..261b5a8e03b 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java @@ -653,6 +653,81 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return stats_ == null ? com.google.spanner.v1.ResultSetStats.getDefaultInstance() : stats_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 8; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -682,6 +757,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(5, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(8, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -706,6 +784,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -732,6 +813,10 @@ public boolean equals(final java.lang.Object obj) { if (hasStats()) { if (!getStats().equals(other.getStats())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -759,6 +844,10 @@ public int hashCode() { hash = (37 * hash) + STATS_FIELD_NUMBER; hash = (53 * hash) + getStats().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -904,6 +993,7 @@ private void maybeForceBuilderInitialization() { getMetadataFieldBuilder(); getValuesFieldBuilder(); getStatsFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -930,6 +1020,11 @@ public Builder clear() { statsBuilder_.dispose(); statsBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -994,6 +1089,11 @@ private void buildPartial0(com.google.spanner.v1.PartialResultSet result) { result.stats_ = statsBuilder_ == null ? stats_ : statsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -1081,6 +1181,9 @@ public Builder mergeFrom(com.google.spanner.v1.PartialResultSet other) { if (other.hasStats()) { mergeStats(other.getStats()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1143,6 +1246,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000010; break; } // case 42 + case 66: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 66 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -3346,6 +3455,268 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return statsBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000020); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @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/PartialResultSetOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java index 4bf05af61e7..fdf1f461f68 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java @@ -554,4 +554,63 @@ public interface PartialResultSetOrBuilder * .google.spanner.v1.ResultSetStats stats = 5; */ com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder(); + + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java index 7a3a9563f22..42ee5817b9e 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java @@ -276,6 +276,81 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return stats_ == null ? com.google.spanner.v1.ResultSetStats.getDefaultInstance() : stats_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 5; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -299,6 +374,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(3, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(5, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -317,6 +395,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -341,6 +422,10 @@ public boolean equals(final java.lang.Object obj) { if (hasStats()) { if (!getStats().equals(other.getStats())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -364,6 +449,10 @@ public int hashCode() { hash = (37 * hash) + STATS_FIELD_NUMBER; hash = (53 * hash) + getStats().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -506,6 +595,7 @@ private void maybeForceBuilderInitialization() { getMetadataFieldBuilder(); getRowsFieldBuilder(); getStatsFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -530,6 +620,11 @@ public Builder clear() { statsBuilder_.dispose(); statsBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -587,6 +682,11 @@ private void buildPartial0(com.google.spanner.v1.ResultSet result) { result.stats_ = statsBuilder_ == null ? stats_ : statsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -668,6 +768,9 @@ public Builder mergeFrom(com.google.spanner.v1.ResultSet other) { if (other.hasStats()) { mergeStats(other.getStats()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -718,6 +821,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 42: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 42 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1598,6 +1707,268 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return statsBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000008); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * Optional. A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @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/ResultSetOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java index 64e7453b3e9..3ce8f7d3e2d 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java @@ -190,4 +190,63 @@ public interface ResultSetOrBuilder * .google.spanner.v1.ResultSetStats stats = 3; */ com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder(); + + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * Optional. A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } 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 82416656145..93b78d65669 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 @@ -54,39 +54,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\"\237\001\n\tResultS" - + "et\0226\n\010metadata\030\001 \001(\0132$.google.spanner.v1" - + ".ResultSetMetadata\022(\n\004rows\030\002 \003(\0132\032.googl" - + "e.protobuf.ListValue\0220\n\005stats\030\003 \001(\0132!.go" - + "ogle.spanner.v1.ResultSetStats\"\321\001\n\020Parti" - + "alResultSet\0226\n\010metadata\030\001 \001(\0132$.google.s" - + "panner.v1.ResultSetMetadata\022&\n\006values\030\002 " - + "\003(\0132\026.google.protobuf.Value\022\025\n\rchunked_v" - + "alue\030\003 \001(\010\022\024\n\014resume_token\030\004 \001(\014\0220\n\005stat" - + "s\030\005 \001(\0132!.google.spanner.v1.ResultSetSta" - + "ts\"\267\001\n\021ResultSetMetadata\022/\n\010row_type\030\001 \001" - + "(\0132\035.google.spanner.v1.StructType\0223\n\013tra" - + "nsaction\030\002 \001(\0132\036.google.spanner.v1.Trans" - + "action\022<\n\025undeclared_parameters\030\003 \001(\0132\035." - + "google.spanner.v1.StructType\"\271\001\n\016ResultS" - + "etStats\0220\n\nquery_plan\030\001 \001(\0132\034.google.spa" - + "nner.v1.QueryPlan\022,\n\013query_stats\030\002 \001(\0132\027" - + ".google.protobuf.Struct\022\031\n\017row_count_exa" - + "ct\030\003 \001(\003H\000\022\037\n\025row_count_lower_bound\030\004 \001(" - + "\003H\000B\013\n\trow_countB\264\001\n\025com.google.spanner." - + "v1B\016ResultSetProtoP\001Z5cloud.google.com/g" - + "o/spanner/apiv1/spannerpb;spannerpb\370\001\001\252\002" - + "\027Google.Cloud.Spanner.V1\312\002\027Google\\Cloud\\" - + "Spanner\\V1\352\002\032Google::Cloud::Spanner::V1b" - + "\006proto3" + + "ogle.spanner.v1\032\037google/api/field_behavi" + + "or.proto\032\034google/protobuf/struct.proto\032\"" + + "google/spanner/v1/query_plan.proto\032#goog" + + "le/spanner/v1/transaction.proto\032\034google/" + + "spanner/v1/type.proto\"\362\001\n\tResultSet\0226\n\010m" + + "etadata\030\001 \001(\0132$.google.spanner.v1.Result" + + "SetMetadata\022(\n\004rows\030\002 \003(\0132\032.google.proto" + + "buf.ListValue\0220\n\005stats\030\003 \001(\0132!.google.sp" + + "anner.v1.ResultSetStats\022Q\n\017precommit_tok" + + "en\030\005 \001(\01323.google.spanner.v1.Multiplexed" + + "SessionPrecommitTokenB\003\340A\001\"\244\002\n\020PartialRe" + + "sultSet\0226\n\010metadata\030\001 \001(\0132$.google.spann" + + "er.v1.ResultSetMetadata\022&\n\006values\030\002 \003(\0132" + + "\026.google.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\022Q" + + "\n\017precommit_token\030\010 \001(\01323.google.spanner" + + ".v1.MultiplexedSessionPrecommitTokenB\003\340A" + + "\001\"\267\001\n\021ResultSetMetadata\022/\n\010row_type\030\001 \001(" + + "\0132\035.google.spanner.v1.StructType\0223\n\013tran" + + "saction\030\002 \001(\0132\036.google.spanner.v1.Transa" + + "ction\022<\n\025undeclared_parameters\030\003 \001(\0132\035.g" + + "oogle.spanner.v1.StructType\"\271\001\n\016ResultSe" + + "tStats\0220\n\nquery_plan\030\001 \001(\0132\034.google.span" + + "ner.v1.QueryPlan\022,\n\013query_stats\030\002 \001(\0132\027." + + "google.protobuf.Struct\022\031\n\017row_count_exac" + + "t\030\003 \001(\003H\000\022\037\n\025row_count_lower_bound\030\004 \001(\003" + + "H\000B\013\n\trow_countB\264\001\n\025com.google.spanner.v" + + "1B\016ResultSetProtoP\001Z5cloud.google.com/go" + + "/spanner/apiv1/spannerpb;spannerpb\370\001\001\252\002\027" + + "Google.Cloud.Spanner.V1\312\002\027Google\\Cloud\\S" + + "panner\\V1\352\002\032Google::Cloud::Spanner::V1b\006" + + "proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), com.google.protobuf.StructProto.getDescriptor(), com.google.spanner.v1.QueryPlanProto.getDescriptor(), com.google.spanner.v1.TransactionProto.getDescriptor(), @@ -98,7 +104,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_ResultSet_descriptor, new java.lang.String[] { - "Metadata", "Rows", "Stats", + "Metadata", "Rows", "Stats", "PrecommitToken", }); internal_static_google_spanner_v1_PartialResultSet_descriptor = getDescriptor().getMessageTypes().get(1); @@ -106,7 +112,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_PartialResultSet_descriptor, new java.lang.String[] { - "Metadata", "Values", "ChunkedValue", "ResumeToken", "Stats", + "Metadata", "Values", "ChunkedValue", "ResumeToken", "Stats", "PrecommitToken", }); internal_static_google_spanner_v1_ResultSetMetadata_descriptor = getDescriptor().getMessageTypes().get(2); @@ -124,6 +130,12 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "QueryPlan", "QueryStats", "RowCountExact", "RowCountLowerBound", "RowCount", }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); com.google.protobuf.StructProto.getDescriptor(); com.google.spanner.v1.QueryPlanProto.getDescriptor(); com.google.spanner.v1.TransactionProto.getDescriptor(); 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 9c90d3f61a1..d8679c5b35d 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 @@ -272,167 +272,172 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\003(\0132C.google.spanner.v1.ExecuteBatchDmlR" + "equest.Statement.ParamTypesEntry\032J\n\017Para" + "mTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005value\030\002 \001(\0132" - + "\027.google.spanner.v1.Type:\0028\001\"p\n\027ExecuteB" - + "atchDmlResponse\0221\n\013result_sets\030\001 \003(\0132\034.g" - + "oogle.spanner.v1.ResultSet\022\"\n\006status\030\002 \001" - + "(\0132\022.google.rpc.Status\"H\n\020PartitionOptio" - + "ns\022\034\n\024partition_size_bytes\030\001 \001(\003\022\026\n\016max_" - + "partitions\030\002 \001(\003\"\243\003\n\025PartitionQueryReque" - + "st\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner.goo" - + "gleapis.com/Session\022;\n\013transaction\030\002 \001(\013" - + "2&.google.spanner.v1.TransactionSelector" - + "\022\020\n\003sql\030\003 \001(\tB\003\340A\002\022\'\n\006params\030\004 \001(\0132\027.goo" - + "gle.protobuf.Struct\022M\n\013param_types\030\005 \003(\013" - + "28.google.spanner.v1.PartitionQueryReque" - + "st.ParamTypesEntry\022>\n\021partition_options\030" - + "\006 \001(\0132#.google.spanner.v1.PartitionOptio" - + "ns\032J\n\017ParamTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005va" - + "lue\030\002 \001(\0132\027.google.spanner.v1.Type:\0028\001\"\261" - + "\002\n\024PartitionReadRequest\0227\n\007session\030\001 \001(\t" - + "B&\340A\002\372A \n\036spanner.googleapis.com/Session" - + "\022;\n\013transaction\030\002 \001(\0132&.google.spanner.v" - + "1.TransactionSelector\022\022\n\005table\030\003 \001(\tB\003\340A" - + "\002\022\r\n\005index\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022/\n\007key" - + "_set\030\006 \001(\0132\031.google.spanner.v1.KeySetB\003\340" - + "A\002\022>\n\021partition_options\030\t \001(\0132#.google.s" - + "panner.v1.PartitionOptions\"$\n\tPartition\022" - + "\027\n\017partition_token\030\001 \001(\014\"z\n\021PartitionRes" - + "ponse\0220\n\npartitions\030\001 \003(\0132\034.google.spann" - + "er.v1.Partition\0223\n\013transaction\030\002 \001(\0132\036.g" - + "oogle.spanner.v1.Transaction\"\366\005\n\013ReadReq" - + "uest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner.g" - + "oogleapis.com/Session\022;\n\013transaction\030\002 \001" - + "(\0132&.google.spanner.v1.TransactionSelect" - + "or\022\022\n\005table\030\003 \001(\tB\003\340A\002\022\r\n\005index\030\004 \001(\t\022\024\n" - + "\007columns\030\005 \003(\tB\003\340A\002\022/\n\007key_set\030\006 \001(\0132\031.g" - + "oogle.spanner.v1.KeySetB\003\340A\002\022\r\n\005limit\030\010 " - + "\001(\003\022\024\n\014resume_token\030\t \001(\014\022\027\n\017partition_t" - + "oken\030\n \001(\014\022:\n\017request_options\030\013 \001(\0132!.go" - + "ogle.spanner.v1.RequestOptions\022E\n\025direct" - + "ed_read_options\030\016 \001(\0132&.google.spanner.v" - + "1.DirectedReadOptions\022\032\n\022data_boost_enab" - + "led\030\017 \001(\010\022=\n\010order_by\030\020 \001(\0162&.google.spa" - + "nner.v1.ReadRequest.OrderByB\003\340A\001\022?\n\tlock" - + "_hint\030\021 \001(\0162\'.google.spanner.v1.ReadRequ" - + "est.LockHintB\003\340A\001\"T\n\007OrderBy\022\030\n\024ORDER_BY" - + "_UNSPECIFIED\020\000\022\030\n\024ORDER_BY_PRIMARY_KEY\020\001" - + "\022\025\n\021ORDER_BY_NO_ORDER\020\002\"T\n\010LockHint\022\031\n\025L" - + "OCK_HINT_UNSPECIFIED\020\000\022\024\n\020LOCK_HINT_SHAR" - + "ED\020\001\022\027\n\023LOCK_HINT_EXCLUSIVE\020\002\"\313\001\n\027BeginT" - + "ransactionRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372" - + "A \n\036spanner.googleapis.com/Session\022;\n\007op" - + "tions\030\002 \001(\0132%.google.spanner.v1.Transact" - + "ionOptionsB\003\340A\002\022:\n\017request_options\030\003 \001(\013" - + "2!.google.spanner.v1.RequestOptions\"\375\002\n\r" - + "CommitRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036" - + "spanner.googleapis.com/Session\022\030\n\016transa" - + "ction_id\030\002 \001(\014H\000\022G\n\026single_use_transacti" - + "on\030\003 \001(\0132%.google.spanner.v1.Transaction" - + "OptionsH\000\022.\n\tmutations\030\004 \003(\0132\033.google.sp" - + "anner.v1.Mutation\022\033\n\023return_commit_stats" - + "\030\005 \001(\010\0228\n\020max_commit_delay\030\010 \001(\0132\031.googl" - + "e.protobuf.DurationB\003\340A\001\022:\n\017request_opti" - + "ons\030\006 \001(\0132!.google.spanner.v1.RequestOpt" - + "ionsB\r\n\013transaction\"g\n\017RollbackRequest\0227" - + "\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner.googlea" - + "pis.com/Session\022\033\n\016transaction_id\030\002 \001(\014B" - + "\003\340A\002\"\316\002\n\021BatchWriteRequest\0227\n\007session\030\001 " - + "\001(\tB&\340A\002\372A \n\036spanner.googleapis.com/Sess" - + "ion\022:\n\017request_options\030\003 \001(\0132!.google.sp" - + "anner.v1.RequestOptions\022P\n\017mutation_grou" - + "ps\030\004 \003(\01322.google.spanner.v1.BatchWriteR" - + "equest.MutationGroupB\003\340A\002\022,\n\037exclude_txn" - + "_from_change_streams\030\005 \001(\010B\003\340A\001\032D\n\rMutat" - + "ionGroup\0223\n\tmutations\030\001 \003(\0132\033.google.spa" - + "nner.v1.MutationB\003\340A\002\"\177\n\022BatchWriteRespo" - + "nse\022\017\n\007indexes\030\001 \003(\005\022\"\n\006status\030\002 \001(\0132\022.g" - + "oogle.rpc.Status\0224\n\020commit_timestamp\030\003 \001" - + "(\0132\032.google.protobuf.Timestamp2\213\030\n\007Spann" - + "er\022\246\001\n\rCreateSession\022\'.google.spanner.v1" - + ".CreateSessionRequest\032\032.google.spanner.v" - + "1.Session\"P\332A\010database\202\323\344\223\002?\":/v1/{datab" - + "ase=projects/*/instances/*/databases/*}/" - + "sessions:\001*\022\340\001\n\023BatchCreateSessions\022-.go" - + "ogle.spanner.v1.BatchCreateSessionsReque" - + "st\032..google.spanner.v1.BatchCreateSessio" - + "nsResponse\"j\332A\026database,session_count\202\323\344" - + "\223\002K\"F/v1/{database=projects/*/instances/" - + "*/databases/*}/sessions:batchCreate:\001*\022\227" - + "\001\n\nGetSession\022$.google.spanner.v1.GetSes" - + "sionRequest\032\032.google.spanner.v1.Session\"" - + "G\332A\004name\202\323\344\223\002:\0228/v1/{name=projects/*/ins" - + "tances/*/databases/*/sessions/*}\022\256\001\n\014Lis" - + "tSessions\022&.google.spanner.v1.ListSessio" - + "nsRequest\032\'.google.spanner.v1.ListSessio" - + "nsResponse\"M\332A\010database\202\323\344\223\002<\022:/v1/{data" - + "base=projects/*/instances/*/databases/*}" - + "/sessions\022\231\001\n\rDeleteSession\022\'.google.spa" - + "nner.v1.DeleteSessionRequest\032\026.google.pr" - + "otobuf.Empty\"G\332A\004name\202\323\344\223\002:*8/v1/{name=p" - + "rojects/*/instances/*/databases/*/sessio" - + "ns/*}\022\243\001\n\nExecuteSql\022$.google.spanner.v1" - + ".ExecuteSqlRequest\032\034.google.spanner.v1.R" - + "esultSet\"Q\202\323\344\223\002K\"F/v1/{session=projects/" - + "*/instances/*/databases/*/sessions/*}:ex" - + "ecuteSql:\001*\022\276\001\n\023ExecuteStreamingSql\022$.go" - + "ogle.spanner.v1.ExecuteSqlRequest\032#.goog" - + "le.spanner.v1.PartialResultSet\"Z\202\323\344\223\002T\"O" - + "/v1/{session=projects/*/instances/*/data" - + "bases/*/sessions/*}:executeStreamingSql:" - + "\001*0\001\022\300\001\n\017ExecuteBatchDml\022).google.spanne" - + "r.v1.ExecuteBatchDmlRequest\032*.google.spa" - + "nner.v1.ExecuteBatchDmlResponse\"V\202\323\344\223\002P\"" - + "K/v1/{session=projects/*/instances/*/dat" - + "abases/*/sessions/*}:executeBatchDml:\001*\022" - + "\221\001\n\004Read\022\036.google.spanner.v1.ReadRequest" - + "\032\034.google.spanner.v1.ResultSet\"K\202\323\344\223\002E\"@" - + "/v1/{session=projects/*/instances/*/data" - + "bases/*/sessions/*}:read:\001*\022\254\001\n\rStreamin" - + "gRead\022\036.google.spanner.v1.ReadRequest\032#." - + "google.spanner.v1.PartialResultSet\"T\202\323\344\223" - + "\002N\"I/v1/{session=projects/*/instances/*/" - + "databases/*/sessions/*}:streamingRead:\001*" - + "0\001\022\311\001\n\020BeginTransaction\022*.google.spanner" - + ".v1.BeginTransactionRequest\032\036.google.spa" - + "nner.v1.Transaction\"i\332A\017session,options\202" - + "\323\344\223\002Q\"L/v1/{session=projects/*/instances" - + "/*/databases/*/sessions/*}:beginTransact" - + "ion:\001*\022\353\001\n\006Commit\022 .google.spanner.v1.Co" - + "mmitRequest\032!.google.spanner.v1.CommitRe" - + "sponse\"\233\001\332A session,transaction_id,mutat" - + "ions\332A(session,single_use_transaction,mu" - + "tations\202\323\344\223\002G\"B/v1/{session=projects/*/i" - + "nstances/*/databases/*/sessions/*}:commi" - + "t:\001*\022\260\001\n\010Rollback\022\".google.spanner.v1.Ro" - + "llbackRequest\032\026.google.protobuf.Empty\"h\332" - + "A\026session,transaction_id\202\323\344\223\002I\"D/v1/{ses" - + "sion=projects/*/instances/*/databases/*/" - + "sessions/*}:rollback:\001*\022\267\001\n\016PartitionQue" - + "ry\022(.google.spanner.v1.PartitionQueryReq" - + "uest\032$.google.spanner.v1.PartitionRespon" - + "se\"U\202\323\344\223\002O\"J/v1/{session=projects/*/inst" - + "ances/*/databases/*/sessions/*}:partitio" - + "nQuery:\001*\022\264\001\n\rPartitionRead\022\'.google.spa" - + "nner.v1.PartitionReadRequest\032$.google.sp" - + "anner.v1.PartitionResponse\"T\202\323\344\223\002N\"I/v1/" - + "{session=projects/*/instances/*/database" - + "s/*/sessions/*}:partitionRead:\001*\022\310\001\n\nBat" - + "chWrite\022$.google.spanner.v1.BatchWriteRe" - + "quest\032%.google.spanner.v1.BatchWriteResp" - + "onse\"k\332A\027session,mutation_groups\202\323\344\223\002K\"F" - + "/v1/{session=projects/*/instances/*/data" - + "bases/*/sessions/*}:batchWrite:\001*0\001\032w\312A\026" - + "spanner.googleapis.com\322A[https://www.goo" - + "gleapis.com/auth/cloud-platform,https://" - + "www.googleapis.com/auth/spanner.dataB\221\002\n" - + "\025com.google.spanner.v1B\014SpannerProtoP\001Z5" - + "cloud.google.com/go/spanner/apiv1/spanne" - + "rpb;spannerpb\252\002\027Google.Cloud.Spanner.V1\312" - + "\002\027Google\\Cloud\\Spanner\\V1\352\002\032Google::Clou" - + "d::Spanner::V1\352A_\n\037spanner.googleapis.co" - + "m/Database\022\n\021partition_opti" + + "ons\030\006 \001(\0132#.google.spanner.v1.PartitionO" + + "ptions\032J\n\017ParamTypesEntry\022\013\n\003key\030\001 \001(\t\022&" + + "\n\005value\030\002 \001(\0132\027.google.spanner.v1.Type:\002" + + "8\001\"\261\002\n\024PartitionReadRequest\0227\n\007session\030\001" + + " \001(\tB&\340A\002\372A \n\036spanner.googleapis.com/Ses" + + "sion\022;\n\013transaction\030\002 \001(\0132&.google.spann" + + "er.v1.TransactionSelector\022\022\n\005table\030\003 \001(\t" + + "B\003\340A\002\022\r\n\005index\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022/\n" + + "\007key_set\030\006 \001(\0132\031.google.spanner.v1.KeySe" + + "tB\003\340A\002\022>\n\021partition_options\030\t \001(\0132#.goog" + + "le.spanner.v1.PartitionOptions\"$\n\tPartit" + + "ion\022\027\n\017partition_token\030\001 \001(\014\"z\n\021Partitio" + + "nResponse\0220\n\npartitions\030\001 \003(\0132\034.google.s" + + "panner.v1.Partition\0223\n\013transaction\030\002 \001(\013" + + "2\036.google.spanner.v1.Transaction\"\366\005\n\013Rea" + + "dRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spann" + + "er.googleapis.com/Session\022;\n\013transaction" + + "\030\002 \001(\0132&.google.spanner.v1.TransactionSe" + + "lector\022\022\n\005table\030\003 \001(\tB\003\340A\002\022\r\n\005index\030\004 \001(" + + "\t\022\024\n\007columns\030\005 \003(\tB\003\340A\002\022/\n\007key_set\030\006 \001(\013" + + "2\031.google.spanner.v1.KeySetB\003\340A\002\022\r\n\005limi" + + "t\030\010 \001(\003\022\024\n\014resume_token\030\t \001(\014\022\027\n\017partiti" + + "on_token\030\n \001(\014\022:\n\017request_options\030\013 \001(\0132" + + "!.google.spanner.v1.RequestOptions\022E\n\025di" + + "rected_read_options\030\016 \001(\0132&.google.spann" + + "er.v1.DirectedReadOptions\022\032\n\022data_boost_" + + "enabled\030\017 \001(\010\022=\n\010order_by\030\020 \001(\0162&.google" + + ".spanner.v1.ReadRequest.OrderByB\003\340A\001\022?\n\t" + + "lock_hint\030\021 \001(\0162\'.google.spanner.v1.Read" + + "Request.LockHintB\003\340A\001\"T\n\007OrderBy\022\030\n\024ORDE" + + "R_BY_UNSPECIFIED\020\000\022\030\n\024ORDER_BY_PRIMARY_K" + + "EY\020\001\022\025\n\021ORDER_BY_NO_ORDER\020\002\"T\n\010LockHint\022" + + "\031\n\025LOCK_HINT_UNSPECIFIED\020\000\022\024\n\020LOCK_HINT_" + + "SHARED\020\001\022\027\n\023LOCK_HINT_EXCLUSIVE\020\002\"\203\002\n\027Be" + + "ginTransactionRequest\0227\n\007session\030\001 \001(\tB&" + + "\340A\002\372A \n\036spanner.googleapis.com/Session\022;" + + "\n\007options\030\002 \001(\0132%.google.spanner.v1.Tran" + + "sactionOptionsB\003\340A\002\022:\n\017request_options\030\003" + + " \001(\0132!.google.spanner.v1.RequestOptions\022" + + "6\n\014mutation_key\030\004 \001(\0132\033.google.spanner.v" + + "1.MutationB\003\340A\001\"\320\003\n\rCommitRequest\0227\n\007ses" + + "sion\030\001 \001(\tB&\340A\002\372A \n\036spanner.googleapis.c" + + "om/Session\022\030\n\016transaction_id\030\002 \001(\014H\000\022G\n\026" + + "single_use_transaction\030\003 \001(\0132%.google.sp" + + "anner.v1.TransactionOptionsH\000\022.\n\tmutatio" + + "ns\030\004 \003(\0132\033.google.spanner.v1.Mutation\022\033\n" + + "\023return_commit_stats\030\005 \001(\010\0228\n\020max_commit" + + "_delay\030\010 \001(\0132\031.google.protobuf.DurationB" + + "\003\340A\001\022:\n\017request_options\030\006 \001(\0132!.google.s" + + "panner.v1.RequestOptions\022Q\n\017precommit_to" + + "ken\030\t \001(\01323.google.spanner.v1.Multiplexe" + + "dSessionPrecommitTokenB\003\340A\001B\r\n\013transacti" + + "on\"g\n\017RollbackRequest\0227\n\007session\030\001 \001(\tB&" + + "\340A\002\372A \n\036spanner.googleapis.com/Session\022\033" + + "\n\016transaction_id\030\002 \001(\014B\003\340A\002\"\316\002\n\021BatchWri" + + "teRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036span" + + "ner.googleapis.com/Session\022:\n\017request_op" + + "tions\030\003 \001(\0132!.google.spanner.v1.RequestO" + + "ptions\022P\n\017mutation_groups\030\004 \003(\01322.google" + + ".spanner.v1.BatchWriteRequest.MutationGr" + + "oupB\003\340A\002\022,\n\037exclude_txn_from_change_stre" + + "ams\030\005 \001(\010B\003\340A\001\032D\n\rMutationGroup\0223\n\tmutat" + + "ions\030\001 \003(\0132\033.google.spanner.v1.MutationB" + + "\003\340A\002\"\177\n\022BatchWriteResponse\022\017\n\007indexes\030\001 " + + "\003(\005\022\"\n\006status\030\002 \001(\0132\022.google.rpc.Status\022" + + "4\n\020commit_timestamp\030\003 \001(\0132\032.google.proto" + + "buf.Timestamp2\213\030\n\007Spanner\022\246\001\n\rCreateSess" + + "ion\022\'.google.spanner.v1.CreateSessionReq" + + "uest\032\032.google.spanner.v1.Session\"P\332A\010dat" + + "abase\202\323\344\223\002?\":/v1/{database=projects/*/in" + + "stances/*/databases/*}/sessions:\001*\022\340\001\n\023B" + + "atchCreateSessions\022-.google.spanner.v1.B" + + "atchCreateSessionsRequest\032..google.spann" + + "er.v1.BatchCreateSessionsResponse\"j\332A\026da" + + "tabase,session_count\202\323\344\223\002K\"F/v1/{databas" + + "e=projects/*/instances/*/databases/*}/se" + + "ssions:batchCreate:\001*\022\227\001\n\nGetSession\022$.g" + + "oogle.spanner.v1.GetSessionRequest\032\032.goo" + + "gle.spanner.v1.Session\"G\332A\004name\202\323\344\223\002:\0228/" + + "v1/{name=projects/*/instances/*/database" + + "s/*/sessions/*}\022\256\001\n\014ListSessions\022&.googl" + + "e.spanner.v1.ListSessionsRequest\032\'.googl" + + "e.spanner.v1.ListSessionsResponse\"M\332A\010da" + + "tabase\202\323\344\223\002<\022:/v1/{database=projects/*/i" + + "nstances/*/databases/*}/sessions\022\231\001\n\rDel" + + "eteSession\022\'.google.spanner.v1.DeleteSes" + + "sionRequest\032\026.google.protobuf.Empty\"G\332A\004" + + "name\202\323\344\223\002:*8/v1/{name=projects/*/instanc" + + "es/*/databases/*/sessions/*}\022\243\001\n\nExecute" + + "Sql\022$.google.spanner.v1.ExecuteSqlReques" + + "t\032\034.google.spanner.v1.ResultSet\"Q\202\323\344\223\002K\"" + + "F/v1/{session=projects/*/instances/*/dat" + + "abases/*/sessions/*}:executeSql:\001*\022\276\001\n\023E" + + "xecuteStreamingSql\022$.google.spanner.v1.E" + + "xecuteSqlRequest\032#.google.spanner.v1.Par" + + "tialResultSet\"Z\202\323\344\223\002T\"O/v1/{session=proj" + + "ects/*/instances/*/databases/*/sessions/" + + "*}:executeStreamingSql:\001*0\001\022\300\001\n\017ExecuteB" + + "atchDml\022).google.spanner.v1.ExecuteBatch" + + "DmlRequest\032*.google.spanner.v1.ExecuteBa" + + "tchDmlResponse\"V\202\323\344\223\002P\"K/v1/{session=pro" + + "jects/*/instances/*/databases/*/sessions" + + "/*}:executeBatchDml:\001*\022\221\001\n\004Read\022\036.google" + + ".spanner.v1.ReadRequest\032\034.google.spanner" + + ".v1.ResultSet\"K\202\323\344\223\002E\"@/v1/{session=proj" + + "ects/*/instances/*/databases/*/sessions/" + + "*}:read:\001*\022\254\001\n\rStreamingRead\022\036.google.sp" + + "anner.v1.ReadRequest\032#.google.spanner.v1" + + ".PartialResultSet\"T\202\323\344\223\002N\"I/v1/{session=" + + "projects/*/instances/*/databases/*/sessi" + + "ons/*}:streamingRead:\001*0\001\022\311\001\n\020BeginTrans" + + "action\022*.google.spanner.v1.BeginTransact" + + "ionRequest\032\036.google.spanner.v1.Transacti" + + "on\"i\332A\017session,options\202\323\344\223\002Q\"L/v1/{sessi" + + "on=projects/*/instances/*/databases/*/se" + + "ssions/*}:beginTransaction:\001*\022\353\001\n\006Commit" + + "\022 .google.spanner.v1.CommitRequest\032!.goo" + + "gle.spanner.v1.CommitResponse\"\233\001\332A sessi" + + "on,transaction_id,mutations\332A(session,si" + + "ngle_use_transaction,mutations\202\323\344\223\002G\"B/v" + + "1/{session=projects/*/instances/*/databa" + + "ses/*/sessions/*}:commit:\001*\022\260\001\n\010Rollback" + + "\022\".google.spanner.v1.RollbackRequest\032\026.g" + + "oogle.protobuf.Empty\"h\332A\026session,transac" + + "tion_id\202\323\344\223\002I\"D/v1/{session=projects/*/i" + + "nstances/*/databases/*/sessions/*}:rollb" + + "ack:\001*\022\267\001\n\016PartitionQuery\022(.google.spann" + + "er.v1.PartitionQueryRequest\032$.google.spa" + + "nner.v1.PartitionResponse\"U\202\323\344\223\002O\"J/v1/{" + + "session=projects/*/instances/*/databases" + + "/*/sessions/*}:partitionQuery:\001*\022\264\001\n\rPar" + + "titionRead\022\'.google.spanner.v1.Partition" + + "ReadRequest\032$.google.spanner.v1.Partitio" + + "nResponse\"T\202\323\344\223\002N\"I/v1/{session=projects" + + "/*/instances/*/databases/*/sessions/*}:p" + + "artitionRead:\001*\022\310\001\n\nBatchWrite\022$.google." + + "spanner.v1.BatchWriteRequest\032%.google.sp" + + "anner.v1.BatchWriteResponse\"k\332A\027session," + + "mutation_groups\202\323\344\223\002K\"F/v1/{session=proj" + + "ects/*/instances/*/databases/*/sessions/" + + "*}:batchWrite:\001*0\001\032w\312A\026spanner.googleapi" + + "s.com\322A[https://www.googleapis.com/auth/" + + "cloud-platform,https://www.googleapis.co" + + "m/auth/spanner.dataB\221\002\n\025com.google.spann" + + "er.v1B\014SpannerProtoP\001Z5cloud.google.com/" + + "go/spanner/apiv1/spannerpb;spannerpb\252\002\027G" + + "oogle.Cloud.Spanner.V1\312\002\027Google\\Cloud\\Sp" + + "anner\\V1\352\002\032Google::Cloud::Spanner::V1\352A_" + + "\n\037spanner.googleapis.com/Database\022 + * A precommit token will be included in the response of a BeginTransaction + * request if the read-write transaction is on a multiplexed session and + * a mutation_key was specified in the + * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + * request for this transaction. + * This feature is not yet supported and will result in an UNIMPLEMENTED + * error. + * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -174,6 +249,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getReadTimestamp()); } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -189,6 +267,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getReadTimestamp()); } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -209,6 +290,10 @@ public boolean equals(final java.lang.Object obj) { if (hasReadTimestamp()) { if (!getReadTimestamp().equals(other.getReadTimestamp())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -226,6 +311,10 @@ public int hashCode() { hash = (37 * hash) + READ_TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + getReadTimestamp().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -366,6 +455,7 @@ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getReadTimestampFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -379,6 +469,11 @@ public Builder clear() { readTimestampBuilder_.dispose(); readTimestampBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -423,6 +518,11 @@ private void buildPartial0(com.google.spanner.v1.Transaction result) { readTimestampBuilder_ == null ? readTimestamp_ : readTimestampBuilder_.build(); to_bitField0_ |= 0x00000001; } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000002; + } result.bitField0_ |= to_bitField0_; } @@ -477,6 +577,9 @@ public Builder mergeFrom(com.google.spanner.v1.Transaction other) { if (other.hasReadTimestamp()) { mergeReadTimestamp(other.getReadTimestamp()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -515,6 +618,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -840,6 +949,268 @@ public com.google.protobuf.TimestampOrBuilder getReadTimestampOrBuilder() { return readTimestampBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000004); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @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/TransactionOptions.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java index 7970c77cc7d..31688b10739 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java @@ -413,6 +413,25 @@ public interface ReadWriteOrBuilder * @return The readLockMode. */ com.google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode getReadLockMode(); + + /** + * + * + *
+     * Optional. Clients should pass the transaction ID of the previous
+     * transaction attempt that was aborted if this transaction is being
+     * executed on a multiplexed session.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The multiplexedSessionPreviousTransactionId. + */ + com.google.protobuf.ByteString getMultiplexedSessionPreviousTransactionId(); } /** * @@ -436,6 +455,7 @@ private ReadWrite(com.google.protobuf.GeneratedMessageV3.Builder builder) { private ReadWrite() { readLockMode_ = 0; + multiplexedSessionPreviousTransactionId_ = com.google.protobuf.ByteString.EMPTY; } @java.lang.Override @@ -672,6 +692,31 @@ public com.google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode getReadLo : result; } + public static final int MULTIPLEXED_SESSION_PREVIOUS_TRANSACTION_ID_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString multiplexedSessionPreviousTransactionId_ = + com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Optional. Clients should pass the transaction ID of the previous
+     * transaction attempt that was aborted if this transaction is being
+     * executed on a multiplexed session.
+     * This feature is not yet supported and will result in an UNIMPLEMENTED
+     * error.
+     * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The multiplexedSessionPreviousTransactionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMultiplexedSessionPreviousTransactionId() { + return multiplexedSessionPreviousTransactionId_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -692,6 +737,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io .getNumber()) { output.writeEnum(1, readLockMode_); } + if (!multiplexedSessionPreviousTransactionId_.isEmpty()) { + output.writeBytes(2, multiplexedSessionPreviousTransactionId_); + } getUnknownFields().writeTo(output); } @@ -707,6 +755,11 @@ public int getSerializedSize() { .getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, readLockMode_); } + if (!multiplexedSessionPreviousTransactionId_.isEmpty()) { + size += + com.google.protobuf.CodedOutputStream.computeBytesSize( + 2, multiplexedSessionPreviousTransactionId_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -724,6 +777,8 @@ public boolean equals(final java.lang.Object obj) { (com.google.spanner.v1.TransactionOptions.ReadWrite) obj; if (readLockMode_ != other.readLockMode_) return false; + if (!getMultiplexedSessionPreviousTransactionId() + .equals(other.getMultiplexedSessionPreviousTransactionId())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -737,6 +792,8 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + READ_LOCK_MODE_FIELD_NUMBER; hash = (53 * hash) + readLockMode_; + hash = (37 * hash) + MULTIPLEXED_SESSION_PREVIOUS_TRANSACTION_ID_FIELD_NUMBER; + hash = (53 * hash) + getMultiplexedSessionPreviousTransactionId().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -880,6 +937,7 @@ public Builder clear() { super.clear(); bitField0_ = 0; readLockMode_ = 0; + multiplexedSessionPreviousTransactionId_ = com.google.protobuf.ByteString.EMPTY; return this; } @@ -919,6 +977,10 @@ private void buildPartial0(com.google.spanner.v1.TransactionOptions.ReadWrite re if (((from_bitField0_ & 0x00000001) != 0)) { result.readLockMode_ = readLockMode_; } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.multiplexedSessionPreviousTransactionId_ = + multiplexedSessionPreviousTransactionId_; + } } @java.lang.Override @@ -972,6 +1034,11 @@ public Builder mergeFrom(com.google.spanner.v1.TransactionOptions.ReadWrite othe if (other.readLockMode_ != 0) { setReadLockModeValue(other.getReadLockModeValue()); } + if (other.getMultiplexedSessionPreviousTransactionId() + != com.google.protobuf.ByteString.EMPTY) { + setMultiplexedSessionPreviousTransactionId( + other.getMultiplexedSessionPreviousTransactionId()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1004,6 +1071,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 8 + case 18: + { + multiplexedSessionPreviousTransactionId_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1122,6 +1195,82 @@ public Builder clearReadLockMode() { return this; } + private com.google.protobuf.ByteString multiplexedSessionPreviousTransactionId_ = + com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+       * Optional. Clients should pass the transaction ID of the previous
+       * transaction attempt that was aborted if this transaction is being
+       * executed on a multiplexed session.
+       * This feature is not yet supported and will result in an UNIMPLEMENTED
+       * error.
+       * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The multiplexedSessionPreviousTransactionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMultiplexedSessionPreviousTransactionId() { + return multiplexedSessionPreviousTransactionId_; + } + /** + * + * + *
+       * Optional. Clients should pass the transaction ID of the previous
+       * transaction attempt that was aborted if this transaction is being
+       * executed on a multiplexed session.
+       * This feature is not yet supported and will result in an UNIMPLEMENTED
+       * error.
+       * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The multiplexedSessionPreviousTransactionId to set. + * @return This builder for chaining. + */ + public Builder setMultiplexedSessionPreviousTransactionId( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + multiplexedSessionPreviousTransactionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. Clients should pass the transaction ID of the previous
+       * transaction attempt that was aborted if this transaction is being
+       * executed on a multiplexed session.
+       * This feature is not yet supported and will result in an UNIMPLEMENTED
+       * error.
+       * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearMultiplexedSessionPreviousTransactionId() { + bitField0_ = (bitField0_ & ~0x00000002); + multiplexedSessionPreviousTransactionId_ = + getDefaultInstance().getMultiplexedSessionPreviousTransactionId(); + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java index 6670124ea7a..bf2232c24d2 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java @@ -93,4 +93,63 @@ public interface TransactionOrBuilder * .google.protobuf.Timestamp read_timestamp = 2; */ com.google.protobuf.TimestampOrBuilder getReadTimestampOrBuilder(); + + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * This feature is not yet supported and will result in an UNIMPLEMENTED
+   * error.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } 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 897dc67b000..07dbdbbb0b0 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 @@ -52,6 +52,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_v1_TransactionSelector_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_v1_TransactionSelector_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -62,44 +66,51 @@ 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\"\224\006\n\022TransactionOptions\022E\n\nread_write\030\001" - + " \001(\0132/.google.spanner.v1.TransactionOpti" - + "ons.ReadWriteH\000\022O\n\017partitioned_dml\030\003 \001(\013" - + "24.google.spanner.v1.TransactionOptions." - + "PartitionedDmlH\000\022C\n\tread_only\030\002 \001(\0132..go" - + "ogle.spanner.v1.TransactionOptions.ReadO" - + "nlyH\000\022\'\n\037exclude_txn_from_change_streams" - + "\030\005 \001(\010\032\262\001\n\tReadWrite\022T\n\016read_lock_mode\030\001" - + " \001(\0162<.google.spanner.v1.TransactionOpti" - + "ons.ReadWrite.ReadLockMode\"O\n\014ReadLockMo" - + "de\022\036\n\032READ_LOCK_MODE_UNSPECIFIED\020\000\022\017\n\013PE" - + "SSIMISTIC\020\001\022\016\n\nOPTIMISTIC\020\002\032\020\n\016Partition" - + "edDml\032\250\002\n\010ReadOnly\022\020\n\006strong\030\001 \001(\010H\000\0228\n\022" - + "min_read_timestamp\030\002 \001(\0132\032.google.protob" - + "uf.TimestampH\000\0222\n\rmax_staleness\030\003 \001(\0132\031." - + "google.protobuf.DurationH\000\0224\n\016read_times" - + "tamp\030\004 \001(\0132\032.google.protobuf.TimestampH\000" - + "\0224\n\017exact_staleness\030\005 \001(\0132\031.google.proto" - + "buf.DurationH\000\022\035\n\025return_read_timestamp\030" - + "\006 \001(\010B\021\n\017timestamp_boundB\006\n\004mode\"M\n\013Tran" - + "saction\022\n\n\002id\030\001 \001(\014\0222\n\016read_timestamp\030\002 " - + "\001(\0132\032.google.protobuf.Timestamp\"\244\001\n\023Tran" - + "sactionSelector\022;\n\nsingle_use\030\001 \001(\0132%.go" - + "ogle.spanner.v1.TransactionOptionsH\000\022\014\n\002" - + "id\030\002 \001(\014H\000\0226\n\005begin\030\003 \001(\0132%.google.spann" - + "er.v1.TransactionOptionsH\000B\n\n\010selectorB\263" - + "\001\n\025com.google.spanner.v1B\020TransactionPro" - + "toP\001Z5cloud.google.com/go/spanner/apiv1/" - + "spannerpb;spannerpb\252\002\027Google.Cloud.Spann" - + "er.V1\312\002\027Google\\Cloud\\Spanner\\V1\352\002\032Google" - + "::Cloud::Spanner::V1b\006proto3" + + "oogle.spanner.v1\032\037google/api/field_behav" + + "ior.proto\032\036google/protobuf/duration.prot" + + "o\032\037google/protobuf/timestamp.proto\"\316\006\n\022T" + + "ransactionOptions\022E\n\nread_write\030\001 \001(\0132/." + + "google.spanner.v1.TransactionOptions.Rea" + + "dWriteH\000\022O\n\017partitioned_dml\030\003 \001(\01324.goog" + + "le.spanner.v1.TransactionOptions.Partiti" + + "onedDmlH\000\022C\n\tread_only\030\002 \001(\0132..google.sp" + + "anner.v1.TransactionOptions.ReadOnlyH\000\022\'" + + "\n\037exclude_txn_from_change_streams\030\005 \001(\010\032" + + "\354\001\n\tReadWrite\022T\n\016read_lock_mode\030\001 \001(\0162<." + + "google.spanner.v1.TransactionOptions.Rea" + + "dWrite.ReadLockMode\0228\n+multiplexed_sessi" + + "on_previous_transaction_id\030\002 \001(\014B\003\340A\001\"O\n" + + "\014ReadLockMode\022\036\n\032READ_LOCK_MODE_UNSPECIF" + + "IED\020\000\022\017\n\013PESSIMISTIC\020\001\022\016\n\nOPTIMISTIC\020\002\032\020" + + "\n\016PartitionedDml\032\250\002\n\010ReadOnly\022\020\n\006strong\030" + + "\001 \001(\010H\000\0228\n\022min_read_timestamp\030\002 \001(\0132\032.go" + + "ogle.protobuf.TimestampH\000\0222\n\rmax_stalene" + + "ss\030\003 \001(\0132\031.google.protobuf.DurationH\000\0224\n" + + "\016read_timestamp\030\004 \001(\0132\032.google.protobuf." + + "TimestampH\000\0224\n\017exact_staleness\030\005 \001(\0132\031.g" + + "oogle.protobuf.DurationH\000\022\035\n\025return_read" + + "_timestamp\030\006 \001(\010B\021\n\017timestamp_boundB\006\n\004m" + + "ode\"\233\001\n\013Transaction\022\n\n\002id\030\001 \001(\014\0222\n\016read_" + + "timestamp\030\002 \001(\0132\032.google.protobuf.Timest" + + "amp\022L\n\017precommit_token\030\003 \001(\01323.google.sp" + + "anner.v1.MultiplexedSessionPrecommitToke" + + "n\"\244\001\n\023TransactionSelector\022;\n\nsingle_use\030" + + "\001 \001(\0132%.google.spanner.v1.TransactionOpt" + + "ionsH\000\022\014\n\002id\030\002 \001(\014H\000\0226\n\005begin\030\003 \001(\0132%.go" + + "ogle.spanner.v1.TransactionOptionsH\000B\n\n\010" + + "selector\"L\n MultiplexedSessionPrecommitT" + + "oken\022\027\n\017precommit_token\030\001 \001(\014\022\017\n\007seq_num" + + "\030\002 \001(\005B\263\001\n\025com.google.spanner.v1B\020Transa" + + "ctionProtoP\001Z5cloud.google.com/go/spanne" + + "r/apiv1/spannerpb;spannerpb\252\002\027Google.Clo" + + "ud.Spanner.V1\312\002\027Google\\Cloud\\Spanner\\V1\352" + + "\002\032Google::Cloud::Spanner::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), }); @@ -117,7 +128,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_TransactionOptions_ReadWrite_descriptor, new java.lang.String[] { - "ReadLockMode", + "ReadLockMode", "MultiplexedSessionPreviousTransactionId", }); internal_static_google_spanner_v1_TransactionOptions_PartitionedDml_descriptor = internal_static_google_spanner_v1_TransactionOptions_descriptor.getNestedTypes().get(1); @@ -145,7 +156,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_Transaction_descriptor, new java.lang.String[] { - "Id", "ReadTimestamp", + "Id", "ReadTimestamp", "PrecommitToken", }); internal_static_google_spanner_v1_TransactionSelector_descriptor = getDescriptor().getMessageTypes().get(2); @@ -155,6 +166,20 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "SingleUse", "Id", "Begin", "Selector", }); + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor, + new java.lang.String[] { + "PrecommitToken", "SeqNum", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); } 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 d44aad63b61..d5f9b15d5b3 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 @@ -17,6 +17,7 @@ syntax = "proto3"; package google.spanner.v1; import "google/protobuf/timestamp.proto"; +import "google/spanner/v1/transaction.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb"; @@ -47,4 +48,12 @@ message CommitResponse { // For more information, see // [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. CommitStats commit_stats = 2; + + // Clients should examine and retry the commit if any of the following + // reasons are populated. + oneof MultiplexedSessionRetry { + // If specified, transaction has not committed yet. + // Clients must retry the commit with the new precommit token. + MultiplexedSessionPrecommitToken precommit_token = 4; + } } 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 f392c1d7ddc..0b8aabf8679 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,6 +16,7 @@ syntax = "proto3"; package google.spanner.v1; +import "google/api/field_behavior.proto"; import "google/protobuf/struct.proto"; import "google/spanner/v1/query_plan.proto"; import "google/spanner/v1/transaction.proto"; @@ -53,6 +54,16 @@ message ResultSet { // Other fields may or may not be populated, based on the // [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. ResultSetStats stats = 3; + + // Optional. A precommit token will be included if the read-write transaction + // is on a multiplexed session. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the + // [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + MultiplexedSessionPrecommitToken precommit_token = 5 + [(google.api.field_behavior) = OPTIONAL]; } // Partial results from a streaming read or SQL query. Streaming reads and @@ -157,6 +168,16 @@ message PartialResultSet { // This field will also be present in the last response for DML // statements. ResultSetStats stats = 5; + + // Optional. A precommit token will be included if the read-write transaction + // is on a multiplexed session. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the + // [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + MultiplexedSessionPrecommitToken precommit_token = 8 + [(google.api.field_behavior) = OPTIONAL]; } // Metadata about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet]. 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 856a51b7dfe..847815464a4 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 @@ -909,6 +909,16 @@ message ExecuteBatchDmlResponse { // If all DML statements are executed successfully, the status is `OK`. // Otherwise, the error status of the first failed statement. google.rpc.Status status = 2; + + // Optional. A precommit token will be included if the read-write transaction + // is on a multiplexed session. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the + // [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + MultiplexedSessionPrecommitToken precommit_token = 3 + [(google.api.field_behavior) = OPTIONAL]; } // Options for a PartitionQueryRequest and @@ -1225,6 +1235,14 @@ message BeginTransactionRequest { // transaction, set it on the reads and writes that are part of this // transaction instead. RequestOptions request_options = 3; + + // Optional. Required for read-write transactions on a multiplexed session + // that commit mutations but do not perform any reads or queries. Clients + // should randomly select one of the mutations from the mutation set and send + // it as a part of this request. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + Mutation mutation_key = 4 [(google.api.field_behavior) = OPTIONAL]; } // The request for [Commit][google.spanner.v1.Spanner.Commit]. @@ -1272,6 +1290,15 @@ message CommitRequest { // Common options for this request. RequestOptions request_options = 6; + + // Optional. If the read-write transaction was executed on a multiplexed + // session, the precommit token with the highest sequence number received in + // this transaction attempt, should be included here. Failing to do so will + // result in a FailedPrecondition error. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + MultiplexedSessionPrecommitToken precommit_token = 9 + [(google.api.field_behavior) = OPTIONAL]; } // The request for [Rollback][google.spanner.v1.Spanner.Rollback]. 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 8af513d1563..fe564538466 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,6 +16,7 @@ syntax = "proto3"; package google.spanner.v1; +import "google/api/field_behavior.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; @@ -378,6 +379,14 @@ message TransactionOptions { // Read lock mode for the transaction. ReadLockMode read_lock_mode = 1; + + // Optional. Clients should pass the transaction ID of the previous + // transaction attempt that was aborted if this transaction is being + // executed on a multiplexed session. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + bytes multiplexed_session_previous_transaction_id = 2 + [(google.api.field_behavior) = OPTIONAL]; } // Message type to initiate a Partitioned DML transaction. @@ -512,6 +521,17 @@ message Transaction { // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. // Example: `"2014-10-02T15:01:23.045123456Z"`. google.protobuf.Timestamp read_timestamp = 2; + + // A precommit token will be included in the response of a BeginTransaction + // request if the read-write transaction is on a multiplexed session and + // a mutation_key was specified in the + // [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + // request for this transaction. + // This feature is not yet supported and will result in an UNIMPLEMENTED + // error. + MultiplexedSessionPrecommitToken precommit_token = 3; } // This message is used to select the transaction in which a @@ -539,3 +559,17 @@ message TransactionSelector { TransactionOptions begin = 3; } } + +// When a read-write transaction is executed on a multiplexed session, +// this precommit token is sent back to the client +// as a part of the [Transaction] message in the BeginTransaction response and +// also as a part of the [ResultSet] and [PartialResultSet] responses. +message MultiplexedSessionPrecommitToken { + // Opaque precommit token. + bytes precommit_token = 1; + + // An incrementing seq number is generated on every precommit token + // that is returned. Clients should remember the precommit token with the + // highest sequence number from the current transaction attempt. + int32 seq_num = 2; +} diff --git a/renovate.json b/renovate.json index 3ad0aae27d8..167bf279fe7 100644 --- a/renovate.json +++ b/renovate.json @@ -41,6 +41,16 @@ ], "depNameTemplate": "com.google.cloud:sdk-platform-java-config", "datasourceTemplate": "maven" + }, + { + "fileMatch": [ + "^.github/workflows/hermetic_library_generation.yaml$" + ], + "matchStrings": [ + "uses: googleapis/sdk-platform-java/.github/scripts@v(?.+?)\\n" + ], + "depNameTemplate": "com.google.api:gapic-generator-java", + "datasourceTemplate": "maven" } ], "packageRules": [ @@ -101,6 +111,13 @@ "^com.fasterxml.jackson.core" ], "groupName": "jackson dependencies" + }, + { + "matchPackagePatterns": [ + "^com.google.api:gapic-generator-java", + "^com.google.cloud:sdk-platform-java-config" + ], + "groupName": "SDK platform Java dependencies" } ], "semanticCommits": true, From 1e40bcc116b19fdddf4ee032d81ddeeedf9e7329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Fri, 11 Oct 2024 07:51:47 +0200 Subject: [PATCH 08/10] refactor: add internal data structures for transactional connection state (#3321) * refactor: add internal data structures for transactional connection state This change adds internal data structures that can be used for transactional connection state. These data structures also reduces the amount of code that is needed for each connection property that is added. Connection properties are currently represented as actual variables in the ConnectionImpl class. These new data structures removes the need for that. Only the connection property retryAbortsInternally is refactored to use the new data structure. All other connection properties will be refactored in a following change, in order to keep each change as small as possible. The data structure supports both transactional and non-transactional connection state. Transactional state is disabled in the current version in order to be consistent with the current behavior. It will be enabled in a later change when all connection properties have been refactored to use the new data structure. * refactor: replace individual variables with ConnectionProperty (#3322) * refactor: add internal data structures for transactional connection state This change adds internal data structures that can be used for transactional connection state. These data structures also reduces the amount of code that is needed for each connection property that is added. Connection properties are currently represented as actual variables in the ConnectionImpl class. These new data structures removes the need for that. Only the connection property retryAbortsInternally is refactored to use the new data structure. All other connection properties will be refactored in a following change, in order to keep each change as small as possible. The data structure supports both transactional and non-transactional connection state. Transactional state is disabled in the current version in order to be consistent with the current behavior. It will be enabled in a later change when all connection properties have been refactored to use the new data structure. * refactor: replace individual variables with ConnectionProperty Replace individual variables in ConnectionOptions and ConnectionImpl with references to ConnectionProperties. This reduces the amount of code bloat, especially in ConnectionOptions, as all connection property parsing is now handled by the ConnectionState class in a generic way. This setup also reduces the amount of code that is needed to add a new connection property, as there is only one source of truth: the list of properties in the ConnectionProperties class. Following steps that will reduce the amount of code bloat further are: 1. Replace all the regular expressions for SET and SHOW statements with a simple token-based parser. 2. Cleaning up ConnectionOptions further by removing the duplicate list of ConnectionProperties there. These can be removed once the JDBC driver has been updated to use the new list of properties. * feat: enable transactional connection state as an opt-in (#3326) * refactor: add internal data structures for transactional connection state This change adds internal data structures that can be used for transactional connection state. These data structures also reduces the amount of code that is needed for each connection property that is added. Connection properties are currently represented as actual variables in the ConnectionImpl class. These new data structures removes the need for that. Only the connection property retryAbortsInternally is refactored to use the new data structure. All other connection properties will be refactored in a following change, in order to keep each change as small as possible. The data structure supports both transactional and non-transactional connection state. Transactional state is disabled in the current version in order to be consistent with the current behavior. It will be enabled in a later change when all connection properties have been refactored to use the new data structure. * refactor: replace individual variables with ConnectionProperty Replace individual variables in ConnectionOptions and ConnectionImpl with references to ConnectionProperties. This reduces the amount of code bloat, especially in ConnectionOptions, as all connection property parsing is now handled by the ConnectionState class in a generic way. This setup also reduces the amount of code that is needed to add a new connection property, as there is only one source of truth: the list of properties in the ConnectionProperties class. Following steps that will reduce the amount of code bloat further are: 1. Replace all the regular expressions for SET and SHOW statements with a simple token-based parser. 2. Cleaning up ConnectionOptions further by removing the duplicate list of ConnectionProperties there. These can be removed once the JDBC driver has been updated to use the new list of properties. * refactor: add internal data structures for transactional connection state This change adds internal data structures that can be used for transactional connection state. These data structures also reduces the amount of code that is needed for each connection property that is added. Connection properties are currently represented as actual variables in the ConnectionImpl class. These new data structures removes the need for that. Only the connection property retryAbortsInternally is refactored to use the new data structure. All other connection properties will be refactored in a following change, in order to keep each change as small as possible. The data structure supports both transactional and non-transactional connection state. Transactional state is disabled in the current version in order to be consistent with the current behavior. It will be enabled in a later change when all connection properties have been refactored to use the new data structure. * refactor: replace individual variables with ConnectionProperty Replace individual variables in ConnectionOptions and ConnectionImpl with references to ConnectionProperties. This reduces the amount of code bloat, especially in ConnectionOptions, as all connection property parsing is now handled by the ConnectionState class in a generic way. This setup also reduces the amount of code that is needed to add a new connection property, as there is only one source of truth: the list of properties in the ConnectionProperties class. Following steps that will reduce the amount of code bloat further are: 1. Replace all the regular expressions for SET and SHOW statements with a simple token-based parser. 2. Cleaning up ConnectionOptions further by removing the duplicate list of ConnectionProperties there. These can be removed once the JDBC driver has been updated to use the new list of properties. * feat: enable transactional connection state as an opt-in This change enables transactional connection state for the Connection API. It can be enabled by default for PostgreSQL-dialect databases using a system property, and is always an opt-in for GoogleSQL-dialect databases. Transactional connection state can be enabled for any database connection with the `connection_state_type` connection STARTUP property. * chore: remove misleading comment * chore: generate libraries at Tue Oct 8 12:50:40 UTC 2024 --------- Co-authored-by: cloud-java-bot --- .../ClientSideStatementValueConverters.java | 150 ++++ .../spanner/connection/ConnectionImpl.java | 425 +++++---- .../spanner/connection/ConnectionOptions.java | 806 +++++------------- .../connection/ConnectionProperties.java | 515 +++++++++++ .../connection/ConnectionProperty.java | 197 +++++ .../connection/ConnectionPropertyValue.java | 80 ++ .../spanner/connection/ConnectionState.java | 282 ++++++ .../cloud/spanner/connection/DdlBatch.java | 7 +- .../connection/DirectedReadOptionsUtil.java | 19 + .../cloud/spanner/connection/DmlBatch.java | 7 +- .../connection/ReadOnlyTransaction.java | 15 +- .../connection/ReadWriteTransaction.java | 42 +- .../connection/SingleUseTransaction.java | 7 +- .../cloud/spanner/connection/UnitOfWork.java | 25 +- .../connection/ConnectionImplTest.java | 34 +- .../connection/ConnectionPropertyTest.java | 301 +++++++ .../ConnectionPropertyValueTest.java | 100 +++ .../ConnectionStateMockServerTest.java | 231 +++++ .../connection/ConnectionStateTest.java | 267 ++++++ .../connection/CredentialsProviderTest.java | 10 + .../spanner/connection/DdlBatchTest.java | 4 +- .../spanner/connection/DmlBatchTest.java | 4 +- .../NoopEndTransactionCallback.java | 31 + .../spanner/connection/QueryOptionsTest.java | 2 +- .../connection/ReadOnlyTransactionTest.java | 14 +- .../connection/ReadWriteTransactionTest.java | 16 +- .../connection/SingleUseTransactionTest.java | 4 +- 27 files changed, 2809 insertions(+), 786 deletions(-) create mode 100644 google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java create mode 100644 google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java create mode 100644 google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionPropertyValue.java create mode 100644 google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionState.java create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyTest.java create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyValueTest.java create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateMockServerTest.java create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateTest.java create mode 100644 google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/NoopEndTransactionCallback.java diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementValueConverters.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementValueConverters.java index 1bea4306e1a..fd078c99b6a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementValueConverters.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ClientSideStatementValueConverters.java @@ -19,6 +19,8 @@ import static com.google.cloud.spanner.connection.ReadOnlyStalenessUtil.parseTimeUnit; import static com.google.cloud.spanner.connection.ReadOnlyStalenessUtil.toChronoUnit; +import com.google.api.gax.core.CredentialsProvider; +import com.google.cloud.spanner.Dialect; import com.google.cloud.spanner.ErrorCode; import com.google.cloud.spanner.Options.RpcPriority; import com.google.cloud.spanner.SpannerException; @@ -31,6 +33,8 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.spanner.v1.DirectedReadOptions; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.Base64; @@ -73,7 +77,11 @@ private E get(String value) { /** Converter from string to {@link Boolean} */ static class BooleanConverter implements ClientSideStatementValueConverter { + static final BooleanConverter INSTANCE = new BooleanConverter(); + private BooleanConverter() {} + + /** Constructor that is needed for reflection. */ public BooleanConverter(String allowedValues) {} @Override @@ -142,7 +150,11 @@ public Boolean convert(String value) { /** Converter from string to a non-negative integer. */ static class NonNegativeIntegerConverter implements ClientSideStatementValueConverter { + static final NonNegativeIntegerConverter INSTANCE = new NonNegativeIntegerConverter(); + + private NonNegativeIntegerConverter() {} + /** Constructor needed for reflection. */ public NonNegativeIntegerConverter(String allowedValues) {} @Override @@ -167,6 +179,9 @@ public Integer convert(String value) { /** Converter from string to {@link Duration}. */ static class DurationConverter implements ClientSideStatementValueConverter { + static final DurationConverter INSTANCE = + new DurationConverter("('(\\d{1,19})(s|ms|us|ns)'|\\d{1,19}|NULL)"); + private final String resetValue; private final Pattern allowedValues; @@ -227,6 +242,10 @@ public PgDurationConverter(String allowedValues) { /** Converter from string to possible values for read only staleness ({@link TimestampBound}). */ static class ReadOnlyStalenessConverter implements ClientSideStatementValueConverter { + static final ReadOnlyStalenessConverter INSTANCE = + new ReadOnlyStalenessConverter( + "'((STRONG)|(MIN_READ_TIMESTAMP)[\\t ]+((\\d{4})-(\\d{2})-(\\d{2})([Tt](\\d{2}):(\\d{2}):(\\d{2})(\\.\\d{1,9})?)([Zz]|([+-])(\\d{2}):(\\d{2})))|(READ_TIMESTAMP)[\\t ]+((\\d{4})-(\\d{2})-(\\d{2})([Tt](\\d{2}):(\\d{2}):(\\d{2})(\\.\\d{1,9})?)([Zz]|([+-])(\\d{2}):(\\d{2})))|(MAX_STALENESS)[\\t ]+((\\d{1,19})(s|ms|us|ns))|(EXACT_STALENESS)[\\t ]+((\\d{1,19})(s|ms|us|ns)))'"); + private final Pattern allowedValues; private final CaseInsensitiveEnumMap values = new CaseInsensitiveEnumMap<>(Mode.class); @@ -337,9 +356,14 @@ public DirectedReadOptions convert(String value) { /** Converter for converting strings to {@link AutocommitDmlMode} values. */ static class AutocommitDmlModeConverter implements ClientSideStatementValueConverter { + static final AutocommitDmlModeConverter INSTANCE = new AutocommitDmlModeConverter(); + private final CaseInsensitiveEnumMap values = new CaseInsensitiveEnumMap<>(AutocommitDmlMode.class); + private AutocommitDmlModeConverter() {} + + /** Constructor needed for reflection. */ public AutocommitDmlModeConverter(String allowedValues) {} @Override @@ -353,7 +377,35 @@ public AutocommitDmlMode convert(String value) { } } + static class ConnectionStateTypeConverter + implements ClientSideStatementValueConverter { + static final ConnectionStateTypeConverter INSTANCE = new ConnectionStateTypeConverter(); + + private final CaseInsensitiveEnumMap values = + new CaseInsensitiveEnumMap<>(ConnectionState.Type.class); + + private ConnectionStateTypeConverter() {} + + /** Constructor that is needed for reflection. */ + public ConnectionStateTypeConverter(String allowedValues) {} + + @Override + public Class getParameterClass() { + return ConnectionState.Type.class; + } + + @Override + public ConnectionState.Type convert(String value) { + return values.get(value); + } + } + static class StringValueConverter implements ClientSideStatementValueConverter { + static final StringValueConverter INSTANCE = new StringValueConverter(); + + private StringValueConverter() {} + + /** Constructor needed for reflection. */ public StringValueConverter(String allowedValues) {} @Override @@ -481,6 +533,8 @@ public PgTransactionMode convert(String value) { /** Converter for converting strings to {@link RpcPriority} values. */ static class RpcPriorityConverter implements ClientSideStatementValueConverter { + static final RpcPriorityConverter INSTANCE = new RpcPriorityConverter("(HIGH|MEDIUM|LOW|NULL)"); + private final CaseInsensitiveEnumMap values = new CaseInsensitiveEnumMap<>(RpcPriority.class); private final Pattern allowedValues; @@ -512,9 +566,14 @@ public RpcPriority convert(String value) { /** Converter for converting strings to {@link SavepointSupport} values. */ static class SavepointSupportConverter implements ClientSideStatementValueConverter { + static final SavepointSupportConverter INSTANCE = new SavepointSupportConverter(); + private final CaseInsensitiveEnumMap values = new CaseInsensitiveEnumMap<>(SavepointSupport.class); + private SavepointSupportConverter() {} + + /** Constructor needed for reflection. */ public SavepointSupportConverter(String allowedValues) {} @Override @@ -528,6 +587,30 @@ public SavepointSupport convert(String value) { } } + /** Converter for converting strings to {@link DdlInTransactionMode} values. */ + static class DdlInTransactionModeConverter + implements ClientSideStatementValueConverter { + static final DdlInTransactionModeConverter INSTANCE = new DdlInTransactionModeConverter(); + + private final CaseInsensitiveEnumMap values = + new CaseInsensitiveEnumMap<>(DdlInTransactionMode.class); + + private DdlInTransactionModeConverter() {} + + /** Constructor needed for reflection. */ + public DdlInTransactionModeConverter(String allowedValues) {} + + @Override + public Class getParameterClass() { + return DdlInTransactionMode.class; + } + + @Override + public DdlInTransactionMode convert(String value) { + return values.get(value); + } + } + static class ExplainCommandConverter implements ClientSideStatementValueConverter { @Override public Class getParameterClass() { @@ -588,4 +671,71 @@ public String convert(String filePath) { return filePath; } } + + static class CredentialsProviderConverter + implements ClientSideStatementValueConverter { + static final CredentialsProviderConverter INSTANCE = new CredentialsProviderConverter(); + + private CredentialsProviderConverter() {} + + @Override + public Class getParameterClass() { + return CredentialsProvider.class; + } + + @Override + public CredentialsProvider convert(String credentialsProviderName) { + if (!Strings.isNullOrEmpty(credentialsProviderName)) { + try { + Class clazz = + (Class) Class.forName(credentialsProviderName); + Constructor constructor = clazz.getDeclaredConstructor(); + return constructor.newInstance(); + } catch (ClassNotFoundException classNotFoundException) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, + "Unknown or invalid CredentialsProvider class name: " + credentialsProviderName, + classNotFoundException); + } catch (NoSuchMethodException noSuchMethodException) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, + "Credentials provider " + + credentialsProviderName + + " does not have a public no-arg constructor.", + noSuchMethodException); + } catch (InvocationTargetException + | InstantiationException + | IllegalAccessException exception) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, + "Failed to create an instance of " + + credentialsProviderName + + ": " + + exception.getMessage(), + exception); + } + } + return null; + } + } + + /** Converter for converting strings to {@link Dialect} values. */ + static class DialectConverter implements ClientSideStatementValueConverter { + static final DialectConverter INSTANCE = new DialectConverter(); + + private final CaseInsensitiveEnumMap values = + new CaseInsensitiveEnumMap<>(Dialect.class); + + private DialectConverter() {} + + @Override + public Class getParameterClass() { + return Dialect.class; + } + + @Override + public Dialect convert(String value) { + return values.get(value); + } + } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java index b481c67bb45..407742678d9 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionImpl.java @@ -17,7 +17,28 @@ package com.google.cloud.spanner.connection; import static com.google.cloud.spanner.SpannerApiFutures.get; +import static com.google.cloud.spanner.connection.ConnectionOptions.isEnableTransactionalConnectionStateForPostgreSQL; import static com.google.cloud.spanner.connection.ConnectionPreconditions.checkValidIdentifier; +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTOCOMMIT; +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTOCOMMIT_DML_MODE; +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTO_PARTITION_MODE; +import static com.google.cloud.spanner.connection.ConnectionProperties.DATA_BOOST_ENABLED; +import static com.google.cloud.spanner.connection.ConnectionProperties.DDL_IN_TRANSACTION_MODE; +import static com.google.cloud.spanner.connection.ConnectionProperties.DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE; +import static com.google.cloud.spanner.connection.ConnectionProperties.DIRECTED_READ; +import static com.google.cloud.spanner.connection.ConnectionProperties.KEEP_TRANSACTION_ALIVE; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_COMMIT_DELAY; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_PARTITIONED_PARALLELISM; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_PARTITIONS; +import static com.google.cloud.spanner.connection.ConnectionProperties.OPTIMIZER_STATISTICS_PACKAGE; +import static com.google.cloud.spanner.connection.ConnectionProperties.OPTIMIZER_VERSION; +import static com.google.cloud.spanner.connection.ConnectionProperties.READONLY; +import static com.google.cloud.spanner.connection.ConnectionProperties.READ_ONLY_STALENESS; +import static com.google.cloud.spanner.connection.ConnectionProperties.RETRY_ABORTS_INTERNALLY; +import static com.google.cloud.spanner.connection.ConnectionProperties.RETURN_COMMIT_STATS; +import static com.google.cloud.spanner.connection.ConnectionProperties.RPC_PRIORITY; +import static com.google.cloud.spanner.connection.ConnectionProperties.SAVEPOINT_SUPPORT; +import static com.google.cloud.spanner.connection.ConnectionProperties.TRACING_PREFIX; import com.google.api.core.ApiFuture; import com.google.api.core.ApiFutures; @@ -50,13 +71,16 @@ import com.google.cloud.spanner.TimestampBound.Mode; import com.google.cloud.spanner.connection.AbstractStatementParser.ParsedStatement; import com.google.cloud.spanner.connection.AbstractStatementParser.StatementType; +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import com.google.cloud.spanner.connection.ConnectionState.Type; import com.google.cloud.spanner.connection.StatementExecutor.StatementTimeout; import com.google.cloud.spanner.connection.StatementResult.ResultType; import com.google.cloud.spanner.connection.UnitOfWork.CallType; +import com.google.cloud.spanner.connection.UnitOfWork.EndTransactionCallback; import com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; +import com.google.common.base.Suppliers; import com.google.common.util.concurrent.MoreExecutors; import com.google.spanner.v1.DirectedReadOptions; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; @@ -92,7 +116,6 @@ /** Implementation for {@link Connection}, the generic Spanner connection API (not JDBC). */ class ConnectionImpl implements Connection { private static final String INSTRUMENTATION_SCOPE = "cloud.google.com/java"; - private static final String DEFAULT_TRACING_PREFIX = "CloudSpanner"; private static final String SINGLE_USE_TRANSACTION = "SingleUseTransaction"; private static final String READ_ONLY_TRANSACTION = "ReadOnlyTransaction"; private static final String READ_WRITE_TRANSACTION = "ReadWriteTransaction"; @@ -210,16 +233,11 @@ static UnitOfWorkType of(TransactionMode transactionMode) { private final Spanner spanner; private final Tracer tracer; - private final String tracingPrefix; private final Attributes openTelemetryAttributes; private final DdlClient ddlClient; private final DatabaseClient dbClient; private final BatchClient batchClient; - private boolean autocommit; - private boolean readOnly; - private boolean returnCommitStats; - private boolean delayTransactionStartUntilFirstWrite; - private boolean keepTransactionAlive; + private final ConnectionState connectionState; private UnitOfWork currentUnitOfWork = null; /** @@ -236,46 +254,13 @@ static UnitOfWorkType of(TransactionMode transactionMode) { private BatchMode batchMode; private UnitOfWorkType unitOfWorkType; private final Stack transactionStack = new Stack<>(); - private boolean retryAbortsInternally; private final List transactionRetryListeners = new ArrayList<>(); - private AutocommitDmlMode autocommitDmlMode = AutocommitDmlMode.TRANSACTIONAL; - private TimestampBound readOnlyStaleness = TimestampBound.strong(); - /** - * autoPartitionMode will force this connection to execute all queries as partitioned queries. If - * a query cannot be executed as a partitioned query, for example if it is not partitionable, then - * the query will fail. This mode is intended for integrations with frameworks that should always - * use partitioned queries, and that do not support executing custom SQL statements. This setting - * can be used in combination with the dataBoostEnabled flag to force all queries to use data - * boost. - */ - private boolean autoPartitionMode; - /** - * dataBoostEnabled=true will cause all partitionedQueries to use data boost. All other queries - * and other statements ignore this flag. - */ - private boolean dataBoostEnabled; - /** - * maxPartitions determines the maximum number of partitions that will be used for partitioned - * queries. All other statements ignore this variable. - */ - private int maxPartitions; - /** - * maxPartitionedParallelism determines the maximum number of threads that will be used to execute - * partitions in parallel when executing a partitioned query on this connection. - */ - private int maxPartitionedParallelism; - - private DirectedReadOptions directedReadOptions = null; - private QueryOptions queryOptions = QueryOptions.getDefaultInstance(); - private RpcPriority rpcPriority = null; - private SavepointSupport savepointSupport = SavepointSupport.FAIL_AFTER_ROLLBACK; - private DdlInTransactionMode ddlInTransactionMode; + // The following properties are not 'normal' connection properties, but transient properties that + // are automatically reset after executing a transaction or statement. private String transactionTag; private String statementTag; private boolean excludeTxnFromChangeStreams; - - private Duration maxCommitDelay; private byte[] protoDescriptors; private String protoDescriptorsFilePath; @@ -297,8 +282,6 @@ static UnitOfWorkType of(TransactionMode transactionMode) { .getTracer( INSTRUMENTATION_SCOPE, GaxProperties.getLibraryVersion(spanner.getOptions().getClass())); - this.tracingPrefix = - MoreObjects.firstNonNull(options.getTracingPrefix(), DEFAULT_TRACING_PREFIX); this.openTelemetryAttributes = createOpenTelemetryAttributes(options.getDatabaseId()); if (options.isAutoConfigEmulator()) { EmulatorUtil.maybeCreateInstanceAndDatabase( @@ -307,9 +290,18 @@ static UnitOfWorkType of(TransactionMode transactionMode) { this.dbClient = spanner.getDatabaseClient(options.getDatabaseId()); this.batchClient = spanner.getBatchClient(options.getDatabaseId()); this.ddlClient = createDdlClient(); + this.connectionState = + new ConnectionState( + options.getInitialConnectionPropertyValues(), + Suppliers.memoize( + () -> + isEnableTransactionalConnectionStateForPostgreSQL() + && getDialect() == Dialect.POSTGRESQL + ? Type.TRANSACTIONAL + : Type.NON_TRANSACTIONAL)); // (Re)set the state of the connection to the default. - reset(); + setDefaultTransactionOptions(); } /** Constructor only for test purposes. */ @@ -326,14 +318,16 @@ static UnitOfWorkType of(TransactionMode transactionMode) { new StatementExecutor(options.isUseVirtualThreads(), Collections.emptyList()); this.spannerPool = Preconditions.checkNotNull(spannerPool); this.options = Preconditions.checkNotNull(options); - this.ddlInTransactionMode = options.getDdlInTransactionMode(); this.spanner = spannerPool.getSpanner(options, this); this.tracer = OpenTelemetry.noop().getTracer(INSTRUMENTATION_SCOPE); - this.tracingPrefix = DEFAULT_TRACING_PREFIX; this.openTelemetryAttributes = Attributes.empty(); this.ddlClient = Preconditions.checkNotNull(ddlClient); this.dbClient = Preconditions.checkNotNull(dbClient); this.batchClient = Preconditions.checkNotNull(batchClient); + this.connectionState = + new ConnectionState( + options.getInitialConnectionPropertyValues(), + Suppliers.ofInstance(Type.NON_TRANSACTIONAL)); setReadOnly(options.isReadOnly()); setAutocommit(options.isAutocommit()); setReturnCommitStats(options.isReturnCommitStats()); @@ -375,6 +369,11 @@ static Attributes createOpenTelemetryAttributes(DatabaseId databaseId) { return attributesBuilder.build(); } + @VisibleForTesting + ConnectionState.Type getConnectionStateType() { + return this.connectionState.getType(); + } + @Override public void close() { try { @@ -423,35 +422,45 @@ public ApiFuture closeAsync() { return ApiFutures.immediateFuture(null); } + private Context getCurrentContext() { + return Context.USER; + } + /** * Resets the state of this connection to the default state in the {@link ConnectionOptions} of * this connection. */ public void reset() { - ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - - this.retryAbortsInternally = options.isRetryAbortsInternally(); - this.readOnly = options.isReadOnly(); - this.autocommit = options.isAutocommit(); - this.queryOptions = - QueryOptions.getDefaultInstance().toBuilder().mergeFrom(options.getQueryOptions()).build(); - this.rpcPriority = options.getRPCPriority(); - this.ddlInTransactionMode = options.getDdlInTransactionMode(); - this.returnCommitStats = options.isReturnCommitStats(); - this.delayTransactionStartUntilFirstWrite = options.isDelayTransactionStartUntilFirstWrite(); - this.keepTransactionAlive = options.isKeepTransactionAlive(); - this.dataBoostEnabled = options.isDataBoostEnabled(); - this.autoPartitionMode = options.isAutoPartitionMode(); - this.maxPartitions = options.getMaxPartitions(); - this.maxPartitionedParallelism = options.getMaxPartitionedParallelism(); - this.maxCommitDelay = options.getMaxCommitDelay(); - - this.autocommitDmlMode = AutocommitDmlMode.TRANSACTIONAL; - this.readOnlyStaleness = TimestampBound.strong(); + reset(getCurrentContext(), isInTransaction()); + } + + private void reset(Context context, boolean inTransaction) { + ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); + + // TODO: Replace all of these with a resetAll in ConnectionState. + this.connectionState.resetValue(RETRY_ABORTS_INTERNALLY, context, inTransaction); + this.connectionState.resetValue(AUTOCOMMIT, context, inTransaction); + this.connectionState.resetValue(READONLY, context, inTransaction); + this.connectionState.resetValue(READ_ONLY_STALENESS, context, inTransaction); + this.connectionState.resetValue(OPTIMIZER_VERSION, context, inTransaction); + this.connectionState.resetValue(OPTIMIZER_STATISTICS_PACKAGE, context, inTransaction); + this.connectionState.resetValue(RPC_PRIORITY, context, inTransaction); + this.connectionState.resetValue(DDL_IN_TRANSACTION_MODE, context, inTransaction); + this.connectionState.resetValue(RETURN_COMMIT_STATS, context, inTransaction); + this.connectionState.resetValue( + DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE, context, inTransaction); + this.connectionState.resetValue(KEEP_TRANSACTION_ALIVE, context, inTransaction); + this.connectionState.resetValue(AUTO_PARTITION_MODE, context, inTransaction); + this.connectionState.resetValue(DATA_BOOST_ENABLED, context, inTransaction); + this.connectionState.resetValue(MAX_PARTITIONS, context, inTransaction); + this.connectionState.resetValue(MAX_PARTITIONED_PARALLELISM, context, inTransaction); + this.connectionState.resetValue(MAX_COMMIT_DELAY, context, inTransaction); + + this.connectionState.resetValue(AUTOCOMMIT_DML_MODE, context, inTransaction); this.statementTag = null; this.statementTimeout = new StatementExecutor.StatementTimeout(); - this.directedReadOptions = null; - this.savepointSupport = SavepointSupport.FAIL_AFTER_ROLLBACK; + this.connectionState.resetValue(DIRECTED_READ, context, inTransaction); + this.connectionState.resetValue(SAVEPOINT_SUPPORT, context, inTransaction); this.protoDescriptors = null; this.protoDescriptorsFilePath = null; @@ -495,6 +504,39 @@ public boolean isClosed() { return closed; } + private T getConnectionPropertyValue( + com.google.cloud.spanner.connection.ConnectionProperty property) { + return this.connectionState.getValue(property).getValue(); + } + + private void setConnectionPropertyValue(ConnectionProperty property, T value) { + setConnectionPropertyValue(property, value, /* local = */ false); + } + + private void setConnectionPropertyValue( + ConnectionProperty property, T value, boolean local) { + if (local) { + setLocalConnectionPropertyValue(property, value); + } else { + this.connectionState.setValue(property, value, getCurrentContext(), isInTransaction()); + } + } + + /** + * Sets a connection property value only for the duration of the current transaction. The effects + * of this will be undone once the transaction ends, regardless whether the transaction is + * committed or rolled back. 'Local' properties are supported for both {@link + * com.google.cloud.spanner.connection.ConnectionState.Type#TRANSACTIONAL} and {@link + * com.google.cloud.spanner.connection.ConnectionState.Type#NON_TRANSACTIONAL} connection states. + * + *

NOTE: This feature is not yet exposed in the public API. + */ + private void setLocalConnectionPropertyValue(ConnectionProperty property, T value) { + ConnectionPreconditions.checkState( + isInTransaction(), "SET LOCAL statements are only supported in transactions"); + this.connectionState.setLocalValue(property, value); + } + @Override public void setAutocommit(boolean autocommit) { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); @@ -509,14 +551,24 @@ public void setAutocommit(boolean autocommit) { "Cannot set autocommit while in a temporary transaction"); ConnectionPreconditions.checkState( !transactionBeginMarked, "Cannot set autocommit when a transaction has begun"); - this.autocommit = autocommit; + setConnectionPropertyValue(AUTOCOMMIT, autocommit); + if (autocommit) { + // Commit the current transaction state if we went from autocommit=false to autocommit=true. + // Otherwise, we get the strange situation that autocommit=true cannot be committed, as we no + // longer have a transaction. Note that all the above state checks essentially mean that + // autocommit can only be set before a transaction has actually started, and not in the + // middle of a transaction. + this.connectionState.commit(); + } clearLastTransactionAndSetDefaultTransactionOptions(); // Reset the readOnlyStaleness value if it is no longer compatible with the new autocommit // value. - if (!autocommit - && (readOnlyStaleness.getMode() == Mode.MAX_STALENESS - || readOnlyStaleness.getMode() == Mode.MIN_READ_TIMESTAMP)) { - readOnlyStaleness = TimestampBound.strong(); + if (!autocommit) { + TimestampBound readOnlyStaleness = getReadOnlyStaleness(); + if (readOnlyStaleness.getMode() == Mode.MAX_STALENESS + || readOnlyStaleness.getMode() == Mode.MIN_READ_TIMESTAMP) { + setConnectionPropertyValue(READ_ONLY_STALENESS, TimestampBound.strong()); + } } } @@ -527,7 +579,7 @@ public boolean isAutocommit() { } private boolean internalIsAutocommit() { - return this.autocommit; + return getConnectionPropertyValue(AUTOCOMMIT); } @Override @@ -541,14 +593,14 @@ public void setReadOnly(boolean readOnly) { "Cannot set read-only while in a temporary transaction"); ConnectionPreconditions.checkState( !transactionBeginMarked, "Cannot set read-only when a transaction has begun"); - this.readOnly = readOnly; + setConnectionPropertyValue(READONLY, readOnly); clearLastTransactionAndSetDefaultTransactionOptions(); } @Override public boolean isReadOnly() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.readOnly; + return getConnectionPropertyValue(READONLY); } private void clearLastTransactionAndSetDefaultTransactionOptions() { @@ -567,7 +619,7 @@ public void setAutocommitDmlMode(AutocommitDmlMode mode) { "Cannot set autocommit DML mode while not in autocommit mode or while a transaction is active"); ConnectionPreconditions.checkState( !isReadOnly(), "Cannot set autocommit DML mode for a read-only connection"); - this.autocommitDmlMode = mode; + setConnectionPropertyValue(AUTOCOMMIT_DML_MODE, mode); } @Override @@ -575,7 +627,7 @@ public AutocommitDmlMode getAutocommitDmlMode() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); ConnectionPreconditions.checkState( !isBatchActive(), "Cannot get autocommit DML mode while in a batch"); - return this.autocommitDmlMode; + return getConnectionPropertyValue(AUTOCOMMIT_DML_MODE); } @Override @@ -593,14 +645,14 @@ public void setReadOnlyStaleness(TimestampBound staleness) { isAutocommit() && !inTransaction, "MAX_STALENESS and MIN_READ_TIMESTAMP are only allowed in autocommit mode"); } - this.readOnlyStaleness = staleness; + setConnectionPropertyValue(READ_ONLY_STALENESS, staleness); } @Override public TimestampBound getReadOnlyStaleness() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); ConnectionPreconditions.checkState(!isBatchActive(), "Cannot get read-only while in a batch"); - return this.readOnlyStaleness; + return getConnectionPropertyValue(READ_ONLY_STALENESS); } @Override @@ -609,57 +661,63 @@ public void setDirectedRead(DirectedReadOptions directedReadOptions) { ConnectionPreconditions.checkState( !isTransactionStarted(), "Cannot set directed read options when a transaction has been started"); - this.directedReadOptions = directedReadOptions; + setConnectionPropertyValue(DIRECTED_READ, directedReadOptions); } @Override public DirectedReadOptions getDirectedRead() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.directedReadOptions; + return getConnectionPropertyValue(DIRECTED_READ); } @Override public void setOptimizerVersion(String optimizerVersion) { Preconditions.checkNotNull(optimizerVersion); ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - this.queryOptions = queryOptions.toBuilder().setOptimizerVersion(optimizerVersion).build(); + setConnectionPropertyValue(OPTIMIZER_VERSION, optimizerVersion); } @Override public String getOptimizerVersion() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.queryOptions.getOptimizerVersion(); + return getConnectionPropertyValue(OPTIMIZER_VERSION); } @Override public void setOptimizerStatisticsPackage(String optimizerStatisticsPackage) { Preconditions.checkNotNull(optimizerStatisticsPackage); ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - this.queryOptions = - queryOptions.toBuilder().setOptimizerStatisticsPackage(optimizerStatisticsPackage).build(); + setConnectionPropertyValue(OPTIMIZER_STATISTICS_PACKAGE, optimizerStatisticsPackage); } @Override public String getOptimizerStatisticsPackage() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.queryOptions.getOptimizerStatisticsPackage(); + return getConnectionPropertyValue(OPTIMIZER_STATISTICS_PACKAGE); + } + + private QueryOptions buildQueryOptions() { + return QueryOptions.newBuilder() + .setOptimizerVersion(getConnectionPropertyValue(OPTIMIZER_VERSION)) + .setOptimizerStatisticsPackage(getConnectionPropertyValue(OPTIMIZER_STATISTICS_PACKAGE)) + .build(); } @Override public void setRPCPriority(RpcPriority rpcPriority) { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - this.rpcPriority = rpcPriority; + setConnectionPropertyValue(RPC_PRIORITY, rpcPriority); } @Override public RpcPriority getRPCPriority() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.rpcPriority; + return getConnectionPropertyValue(RPC_PRIORITY); } @Override public DdlInTransactionMode getDdlInTransactionMode() { - return this.ddlInTransactionMode; + return getConnectionPropertyValue(DDL_IN_TRANSACTION_MODE); } @Override @@ -669,7 +727,7 @@ public void setDdlInTransactionMode(DdlInTransactionMode ddlInTransactionMode) { !isBatchActive(), "Cannot set DdlInTransactionMode while in a batch"); ConnectionPreconditions.checkState( !isTransactionStarted(), "Cannot set DdlInTransactionMode while a transaction is active"); - this.ddlInTransactionMode = Preconditions.checkNotNull(ddlInTransactionMode); + setConnectionPropertyValue(DDL_IN_TRANSACTION_MODE, ddlInTransactionMode); } @Override @@ -856,13 +914,13 @@ private void checkSetRetryAbortsInternallyAvailable() { @Override public boolean isRetryAbortsInternally() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return retryAbortsInternally; + return getConnectionPropertyValue(RETRY_ABORTS_INTERNALLY); } @Override public void setRetryAbortsInternally(boolean retryAbortsInternally) { checkSetRetryAbortsInternallyAvailable(); - this.retryAbortsInternally = retryAbortsInternally; + setConnectionPropertyValue(RETRY_ABORTS_INTERNALLY, retryAbortsInternally); } @Override @@ -908,6 +966,10 @@ private boolean internalIsTransactionStarted() { && this.currentUnitOfWork.getState() == UnitOfWorkState.STARTED; } + private boolean hasTransactionalChanges() { + return internalIsTransactionStarted() || this.connectionState.hasTransactionalChanges(); + } + @Override public Timestamp getReadTimestamp() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); @@ -951,26 +1013,31 @@ CommitResponse getCommitResponseOrNull() { @Override public void setReturnCommitStats(boolean returnCommitStats) { + setReturnCommitStats(returnCommitStats, /* local = */ false); + } + + @VisibleForTesting + void setReturnCommitStats(boolean returnCommitStats, boolean local) { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - this.returnCommitStats = returnCommitStats; + setConnectionPropertyValue(RETURN_COMMIT_STATS, returnCommitStats, local); } @Override public boolean isReturnCommitStats() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.returnCommitStats; + return getConnectionPropertyValue(RETURN_COMMIT_STATS); } @Override public void setMaxCommitDelay(Duration maxCommitDelay) { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - this.maxCommitDelay = maxCommitDelay; + setConnectionPropertyValue(MAX_COMMIT_DELAY, maxCommitDelay); } @Override public Duration getMaxCommitDelay() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.maxCommitDelay; + return getConnectionPropertyValue(MAX_COMMIT_DELAY); } @Override @@ -980,13 +1047,14 @@ public void setDelayTransactionStartUntilFirstWrite( ConnectionPreconditions.checkState( !isTransactionStarted(), "Cannot set DelayTransactionStartUntilFirstWrite while a transaction is active"); - this.delayTransactionStartUntilFirstWrite = delayTransactionStartUntilFirstWrite; + setConnectionPropertyValue( + DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE, delayTransactionStartUntilFirstWrite); } @Override public boolean isDelayTransactionStartUntilFirstWrite() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.delayTransactionStartUntilFirstWrite; + return getConnectionPropertyValue(DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE); } @Override @@ -994,13 +1062,13 @@ public void setKeepTransactionAlive(boolean keepTransactionAlive) { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); ConnectionPreconditions.checkState( !isTransactionStarted(), "Cannot set KeepTransactionAlive while a transaction is active"); - this.keepTransactionAlive = keepTransactionAlive; + setConnectionPropertyValue(KEEP_TRANSACTION_ALIVE, keepTransactionAlive); } @Override public boolean isKeepTransactionAlive() { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - return this.keepTransactionAlive; + return getConnectionPropertyValue(KEEP_TRANSACTION_ALIVE); } /** Resets this connection to its default transaction options. */ @@ -1046,10 +1114,22 @@ private interface EndTransactionMethod { ApiFuture endAsync(CallType callType, UnitOfWork t); } - private static final class Commit implements EndTransactionMethod { + private final class Commit implements EndTransactionMethod { @Override public ApiFuture endAsync(CallType callType, UnitOfWork t) { - return t.commitAsync(callType); + return t.commitAsync( + callType, + new EndTransactionCallback() { + @Override + public void onSuccess() { + ConnectionImpl.this.connectionState.commit(); + } + + @Override + public void onFailure() { + ConnectionImpl.this.connectionState.rollback(); + } + }); } } @@ -1070,10 +1150,22 @@ private ApiFuture commitAsync(CallType callType) { return endCurrentTransactionAsync(callType, commit); } - private static final class Rollback implements EndTransactionMethod { + private final class Rollback implements EndTransactionMethod { @Override public ApiFuture endAsync(CallType callType, UnitOfWork t) { - return t.rollbackAsync(callType); + return t.rollbackAsync( + callType, + new EndTransactionCallback() { + @Override + public void onSuccess() { + ConnectionImpl.this.connectionState.rollback(); + } + + @Override + public void onFailure() { + ConnectionImpl.this.connectionState.rollback(); + } + }); } } @@ -1102,7 +1194,7 @@ private ApiFuture endCurrentTransactionAsync( statementTag == null, "Statement tags are not supported for COMMIT or ROLLBACK"); ApiFuture res; try { - if (isTransactionStarted()) { + if (hasTransactionalChanges()) { res = endTransactionMethod.endAsync(callType, getCurrentUnitOfWorkOrStartNewUnitOfWork()); } else { this.currentUnitOfWork = null; @@ -1120,7 +1212,7 @@ private ApiFuture endCurrentTransactionAsync( @Override public SavepointSupport getSavepointSupport() { - return this.savepointSupport; + return getConnectionPropertyValue(SAVEPOINT_SUPPORT); } @Override @@ -1130,12 +1222,13 @@ public void setSavepointSupport(SavepointSupport savepointSupport) { !isBatchActive(), "Cannot set SavepointSupport while in a batch"); ConnectionPreconditions.checkState( !isTransactionStarted(), "Cannot set SavepointSupport while a transaction is active"); - this.savepointSupport = savepointSupport; + setConnectionPropertyValue(SAVEPOINT_SUPPORT, savepointSupport); } @Override public void savepoint(String name) { ConnectionPreconditions.checkState(isInTransaction(), "This connection has no transaction"); + SavepointSupport savepointSupport = getSavepointSupport(); ConnectionPreconditions.checkState( savepointSupport.isSavepointCreationAllowed(), "This connection does not allow the creation of savepoints. Current value of SavepointSupport: " @@ -1155,7 +1248,7 @@ public void rollbackToSavepoint(String name) { ConnectionPreconditions.checkState( isTransactionStarted(), "This connection has no active transaction"); getCurrentUnitOfWorkOrStartNewUnitOfWork() - .rollbackToSavepoint(checkValidIdentifier(name), savepointSupport); + .rollbackToSavepoint(checkValidIdentifier(name), getSavepointSupport()); } @Override @@ -1172,7 +1265,7 @@ public StatementResult execute(Statement statement, Set allowedResul private StatementResult internalExecute( Statement statement, @Nullable Set allowedResultTypes) { ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - ParsedStatement parsedStatement = getStatementParser().parse(statement, this.queryOptions); + ParsedStatement parsedStatement = getStatementParser().parse(statement, buildQueryOptions()); checkResultTypeAllowed(parsedStatement, allowedResultTypes); switch (parsedStatement.getType()) { case CLIENT_SIDE: @@ -1251,7 +1344,7 @@ private static ResultType getResultType(ParsedStatement parsedStatement) { public AsyncStatementResult executeAsync(Statement statement) { Preconditions.checkNotNull(statement); ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - ParsedStatement parsedStatement = getStatementParser().parse(statement, this.queryOptions); + ParsedStatement parsedStatement = getStatementParser().parse(statement, buildQueryOptions()); switch (parsedStatement.getType()) { case CLIENT_SIDE: return AsyncStatementResultImpl.of( @@ -1297,38 +1390,46 @@ public ResultSet analyzeQuery(Statement query, QueryAnalyzeMode queryMode) { @Override public void setDataBoostEnabled(boolean dataBoostEnabled) { - this.dataBoostEnabled = dataBoostEnabled; + setConnectionPropertyValue(DATA_BOOST_ENABLED, dataBoostEnabled); } @Override public boolean isDataBoostEnabled() { - return this.dataBoostEnabled; + return getConnectionPropertyValue(DATA_BOOST_ENABLED); } @Override public void setAutoPartitionMode(boolean autoPartitionMode) { - this.autoPartitionMode = autoPartitionMode; + setConnectionPropertyValue(AUTO_PARTITION_MODE, autoPartitionMode); } + /** + * autoPartitionMode will force this connection to execute all queries as partitioned queries. If + * a query cannot be executed as a partitioned query, for example if it is not partitionable, then + * the query will fail. This mode is intended for integrations with frameworks that should always + * use partitioned queries, and that do not support executing custom SQL statements. This setting + * can be used in combination with the dataBoostEnabled flag to force all queries to use data + * boost. + */ @Override public boolean isAutoPartitionMode() { - return this.autoPartitionMode; + return getConnectionPropertyValue(AUTO_PARTITION_MODE); } @Override public void setMaxPartitions(int maxPartitions) { - this.maxPartitions = maxPartitions; + setConnectionPropertyValue(MAX_PARTITIONS, maxPartitions); } @Override public int getMaxPartitions() { - return this.maxPartitions; + return getConnectionPropertyValue(MAX_PARTITIONS); } @Override public ResultSet partitionQuery( Statement query, PartitionOptions partitionOptions, QueryOption... options) { - ParsedStatement parsedStatement = getStatementParser().parse(query, this.queryOptions); + ParsedStatement parsedStatement = getStatementParser().parse(query, buildQueryOptions()); if (parsedStatement.getType() != StatementType.QUERY) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INVALID_ARGUMENT, @@ -1349,7 +1450,7 @@ public ResultSet partitionQuery( private PartitionOptions getEffectivePartitionOptions( PartitionOptions callSpecificPartitionOptions) { - if (maxPartitions == 0) { + if (getMaxPartitions() == 0) { if (callSpecificPartitionOptions == null) { return PartitionOptions.newBuilder().build(); } else { @@ -1363,11 +1464,11 @@ private PartitionOptions getEffectivePartitionOptions( if (callSpecificPartitionOptions != null && callSpecificPartitionOptions.getPartitionSizeBytes() > 0L) { return PartitionOptions.newBuilder() - .setMaxPartitions(maxPartitions) + .setMaxPartitions(getMaxPartitions()) .setPartitionSizeBytes(callSpecificPartitionOptions.getPartitionSizeBytes()) .build(); } - return PartitionOptions.newBuilder().setMaxPartitions(maxPartitions).build(); + return PartitionOptions.newBuilder().setMaxPartitions(getMaxPartitions()).build(); } @Override @@ -1382,12 +1483,12 @@ public ResultSet runPartition(String encodedPartitionId) { @Override public void setMaxPartitionedParallelism(int maxThreads) { Preconditions.checkArgument(maxThreads >= 0, "maxThreads must be >=0"); - this.maxPartitionedParallelism = maxThreads; + setConnectionPropertyValue(MAX_PARTITIONED_PARALLELISM, maxThreads); } @Override public int getMaxPartitionedParallelism() { - return this.maxPartitionedParallelism; + return getConnectionPropertyValue(MAX_PARTITIONED_PARALLELISM); } @Override @@ -1401,7 +1502,7 @@ public PartitionedQueryResultSet runPartitionedQuery( } // parallelism=0 means 'dynamically choose based on the number of available processors and the // number of partitions'. - return new MergedResultSet(this, partitionIds, maxPartitionedParallelism); + return new MergedResultSet(this, partitionIds, getMaxPartitionedParallelism()); } /** @@ -1413,7 +1514,7 @@ private ResultSet parseAndExecuteQuery( Preconditions.checkNotNull(query); Preconditions.checkNotNull(analyzeMode); ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - ParsedStatement parsedStatement = getStatementParser().parse(query, this.queryOptions); + ParsedStatement parsedStatement = getStatementParser().parse(query, buildQueryOptions()); if (parsedStatement.isQuery() || parsedStatement.isUpdate()) { switch (parsedStatement.getType()) { case CLIENT_SIDE: @@ -1452,7 +1553,7 @@ private AsyncResultSet parseAndExecuteQueryAsync( CallType callType, Statement query, AnalyzeMode analyzeMode, QueryOption... options) { Preconditions.checkNotNull(query); ConnectionPreconditions.checkState(!isClosed(), CLOSED_ERROR_MSG); - ParsedStatement parsedStatement = getStatementParser().parse(query, this.queryOptions); + ParsedStatement parsedStatement = getStatementParser().parse(query, buildQueryOptions()); if (parsedStatement.isQuery() || parsedStatement.isUpdate()) { switch (parsedStatement.getType()) { case CLIENT_SIDE: @@ -1667,7 +1768,7 @@ private QueryOption[] concat( } private QueryOption[] mergeDataBoost(QueryOption... options) { - if (this.dataBoostEnabled) { + if (isDataBoostEnabled()) { options = appendQueryOption(options, Options.dataBoostEnabled(true)); } return options; @@ -1683,13 +1784,16 @@ private QueryOption[] mergeQueryStatementTag(QueryOption... options) { private QueryOption[] mergeQueryRequestOptions( ParsedStatement parsedStatement, QueryOption... options) { - if (this.rpcPriority != null) { - options = appendQueryOption(options, Options.priority(this.rpcPriority)); + if (getConnectionPropertyValue(RPC_PRIORITY) != null) { + options = + appendQueryOption(options, Options.priority(getConnectionPropertyValue(RPC_PRIORITY))); } - if (this.directedReadOptions != null - && currentUnitOfWork != null - && currentUnitOfWork.supportsDirectedReads(parsedStatement)) { - options = appendQueryOption(options, Options.directedRead(this.directedReadOptions)); + if (currentUnitOfWork != null + && currentUnitOfWork.supportsDirectedReads(parsedStatement) + && getConnectionPropertyValue(DIRECTED_READ) != null) { + options = + appendQueryOption( + options, Options.directedRead(getConnectionPropertyValue(DIRECTED_READ))); } return options; } @@ -1719,13 +1823,13 @@ private UpdateOption[] mergeUpdateStatementTag(UpdateOption... options) { } private UpdateOption[] mergeUpdateRequestOptions(UpdateOption... options) { - if (this.rpcPriority != null) { + if (getConnectionPropertyValue(RPC_PRIORITY) != null) { // Shortcut for the most common scenario. if (options == null || options.length == 0) { - options = new UpdateOption[] {Options.priority(this.rpcPriority)}; + options = new UpdateOption[] {Options.priority(getConnectionPropertyValue(RPC_PRIORITY))}; } else { options = Arrays.copyOf(options, options.length + 1); - options[options.length - 1] = Options.priority(this.rpcPriority); + options[options.length - 1] = Options.priority(getConnectionPropertyValue(RPC_PRIORITY)); } } return options; @@ -1744,7 +1848,7 @@ private ResultSet internalExecuteQuery( boolean isInternalMetadataQuery = isInternalMetadataQuery(options); QueryOption[] combinedOptions = concat(statement.getOptionsFromHints(), options); UnitOfWork transaction = getCurrentUnitOfWorkOrStartNewUnitOfWork(isInternalMetadataQuery); - if (autoPartitionMode + if (isAutoPartitionMode() && statement.getType() == StatementType.QUERY && !isInternalMetadataQuery) { return runPartitionedQuery( @@ -1768,7 +1872,7 @@ private AsyncResultSet internalExecuteQueryAsync( || (statement.getType() == StatementType.UPDATE && statement.hasReturningClause()), "Statement must be a query or DML with returning clause."); ConnectionPreconditions.checkState( - !(autoPartitionMode && statement.getType() == StatementType.QUERY), + !(isAutoPartitionMode() && statement.getType() == StatementType.QUERY), "Partitioned queries cannot be executed asynchronously"); boolean isInternalMetadataQuery = isInternalMetadataQuery(options); QueryOption[] combinedOptions = concat(statement.getOptionsFromHints(), options); @@ -1848,7 +1952,7 @@ UnitOfWork getCurrentUnitOfWorkOrStartNewUnitOfWork( createNewUnitOfWork( /* isInternalMetadataQuery = */ false, /* forceSingleUse = */ statementType == StatementType.DDL - && this.ddlInTransactionMode != DdlInTransactionMode.FAIL + && getDdlInTransactionMode() != DdlInTransactionMode.FAIL && !this.transactionBeginMarked, statementType); } @@ -1857,7 +1961,11 @@ UnitOfWork getCurrentUnitOfWorkOrStartNewUnitOfWork( private Span createSpanForUnitOfWork(String name) { return tracer - .spanBuilder(this.tracingPrefix + "." + name) + .spanBuilder( + // We can memoize this, as it is a STARTUP property. + Suppliers.memoize(() -> this.connectionState.getValue(TRACING_PREFIX).getValue()).get() + + "." + + name) .setAllAttributes(getOpenTelemetryAttributes()) .startSpan(); } @@ -1866,7 +1974,7 @@ void maybeAutoCommitCurrentTransaction(StatementType statementType) { if (this.currentUnitOfWork instanceof ReadWriteTransaction && this.currentUnitOfWork.isActive() && statementType == StatementType.DDL - && this.ddlInTransactionMode == DdlInTransactionMode.AUTO_COMMIT_TRANSACTION) { + && getDdlInTransactionMode() == DdlInTransactionMode.AUTO_COMMIT_TRANSACTION) { commit(); } } @@ -1888,12 +1996,12 @@ UnitOfWork createNewUnitOfWork( .setDdlClient(ddlClient) .setDatabaseClient(dbClient) .setBatchClient(batchClient) - .setReadOnly(isReadOnly()) - .setReadOnlyStaleness(readOnlyStaleness) - .setAutocommitDmlMode(autocommitDmlMode) - .setReturnCommitStats(returnCommitStats) + .setReadOnly(getConnectionPropertyValue(READONLY)) + .setReadOnlyStaleness(getConnectionPropertyValue(READ_ONLY_STALENESS)) + .setAutocommitDmlMode(getConnectionPropertyValue(AUTOCOMMIT_DML_MODE)) + .setReturnCommitStats(getConnectionPropertyValue(RETURN_COMMIT_STATS)) .setExcludeTxnFromChangeStreams(excludeTxnFromChangeStreams) - .setMaxCommitDelay(maxCommitDelay) + .setMaxCommitDelay(getConnectionPropertyValue(MAX_COMMIT_DELAY)) .setStatementTimeout(statementTimeout) .withStatementExecutor(statementExecutor) .setSpan( @@ -1912,11 +2020,11 @@ UnitOfWork createNewUnitOfWork( return ReadOnlyTransaction.newBuilder() .setDatabaseClient(dbClient) .setBatchClient(batchClient) - .setReadOnlyStaleness(readOnlyStaleness) + .setReadOnlyStaleness(getConnectionPropertyValue(READ_ONLY_STALENESS)) .setStatementTimeout(statementTimeout) .withStatementExecutor(statementExecutor) .setTransactionTag(transactionTag) - .setRpcPriority(rpcPriority) + .setRpcPriority(getConnectionPropertyValue(RPC_PRIORITY)) .setSpan(createSpanForUnitOfWork(READ_ONLY_TRANSACTION)) .build(); case READ_WRITE_TRANSACTION: @@ -1924,18 +2032,19 @@ UnitOfWork createNewUnitOfWork( .setUsesEmulator(options.usesEmulator()) .setUseAutoSavepointsForEmulator(options.useAutoSavepointsForEmulator()) .setDatabaseClient(dbClient) - .setDelayTransactionStartUntilFirstWrite(delayTransactionStartUntilFirstWrite) - .setKeepTransactionAlive(keepTransactionAlive) - .setRetryAbortsInternally(retryAbortsInternally) - .setSavepointSupport(savepointSupport) - .setReturnCommitStats(returnCommitStats) - .setMaxCommitDelay(maxCommitDelay) + .setDelayTransactionStartUntilFirstWrite( + getConnectionPropertyValue(DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE)) + .setKeepTransactionAlive(getConnectionPropertyValue(KEEP_TRANSACTION_ALIVE)) + .setRetryAbortsInternally(getConnectionPropertyValue(RETRY_ABORTS_INTERNALLY)) + .setSavepointSupport(getConnectionPropertyValue(SAVEPOINT_SUPPORT)) + .setReturnCommitStats(getConnectionPropertyValue(RETURN_COMMIT_STATS)) + .setMaxCommitDelay(getConnectionPropertyValue(MAX_COMMIT_DELAY)) .setTransactionRetryListeners(transactionRetryListeners) .setStatementTimeout(statementTimeout) .withStatementExecutor(statementExecutor) .setTransactionTag(transactionTag) .setExcludeTxnFromChangeStreams(excludeTxnFromChangeStreams) - .setRpcPriority(rpcPriority) + .setRpcPriority(getConnectionPropertyValue(RPC_PRIORITY)) .setSpan(createSpanForUnitOfWork(READ_WRITE_TRANSACTION)) .build(); case DML_BATCH: @@ -1948,7 +2057,7 @@ UnitOfWork createNewUnitOfWork( .withStatementExecutor(statementExecutor) .setStatementTag(statementTag) .setExcludeTxnFromChangeStreams(excludeTxnFromChangeStreams) - .setRpcPriority(rpcPriority) + .setRpcPriority(getConnectionPropertyValue(RPC_PRIORITY)) // Use the transaction Span for the DML batch. .setSpan(transactionStack.peek().getSpan()) .build(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java index 7710a1dee58..1795ad172e2 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java @@ -16,6 +16,41 @@ package com.google.cloud.spanner.connection; +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTOCOMMIT; +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTO_CONFIG_EMULATOR; +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTO_PARTITION_MODE; +import static com.google.cloud.spanner.connection.ConnectionProperties.CHANNEL_PROVIDER; +import static com.google.cloud.spanner.connection.ConnectionProperties.CREDENTIALS_PROVIDER; +import static com.google.cloud.spanner.connection.ConnectionProperties.CREDENTIALS_URL; +import static com.google.cloud.spanner.connection.ConnectionProperties.DATABASE_ROLE; +import static com.google.cloud.spanner.connection.ConnectionProperties.DATA_BOOST_ENABLED; +import static com.google.cloud.spanner.connection.ConnectionProperties.DIALECT; +import static com.google.cloud.spanner.connection.ConnectionProperties.ENABLE_API_TRACING; +import static com.google.cloud.spanner.connection.ConnectionProperties.ENABLE_EXTENDED_TRACING; +import static com.google.cloud.spanner.connection.ConnectionProperties.ENCODED_CREDENTIALS; +import static com.google.cloud.spanner.connection.ConnectionProperties.ENDPOINT; +import static com.google.cloud.spanner.connection.ConnectionProperties.LENIENT; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_COMMIT_DELAY; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_PARTITIONED_PARALLELISM; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_PARTITIONS; +import static com.google.cloud.spanner.connection.ConnectionProperties.MAX_SESSIONS; +import static com.google.cloud.spanner.connection.ConnectionProperties.MIN_SESSIONS; +import static com.google.cloud.spanner.connection.ConnectionProperties.NUM_CHANNELS; +import static com.google.cloud.spanner.connection.ConnectionProperties.OAUTH_TOKEN; +import static com.google.cloud.spanner.connection.ConnectionProperties.READONLY; +import static com.google.cloud.spanner.connection.ConnectionProperties.RETRY_ABORTS_INTERNALLY; +import static com.google.cloud.spanner.connection.ConnectionProperties.RETURN_COMMIT_STATS; +import static com.google.cloud.spanner.connection.ConnectionProperties.ROUTE_TO_LEADER; +import static com.google.cloud.spanner.connection.ConnectionProperties.TRACING_PREFIX; +import static com.google.cloud.spanner.connection.ConnectionProperties.TRACK_CONNECTION_LEAKS; +import static com.google.cloud.spanner.connection.ConnectionProperties.TRACK_SESSION_LEAKS; +import static com.google.cloud.spanner.connection.ConnectionProperties.USER_AGENT; +import static com.google.cloud.spanner.connection.ConnectionProperties.USE_AUTO_SAVEPOINTS_FOR_EMULATOR; +import static com.google.cloud.spanner.connection.ConnectionProperties.USE_PLAIN_TEXT; +import static com.google.cloud.spanner.connection.ConnectionProperties.USE_VIRTUAL_GRPC_TRANSPORT_THREADS; +import static com.google.cloud.spanner.connection.ConnectionProperties.USE_VIRTUAL_THREADS; +import static com.google.cloud.spanner.connection.ConnectionPropertyValue.cast; + import com.google.api.core.InternalApi; import com.google.api.gax.core.CredentialsProvider; import com.google.api.gax.rpc.TransportChannelProvider; @@ -38,19 +73,19 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.base.Suppliers; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; -import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; import io.opentelemetry.api.OpenTelemetry; import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Set; @@ -87,7 +122,12 @@ */ @InternalApi public class ConnectionOptions { - /** Supported connection properties that can be included in the connection URI. */ + /** + * Supported connection properties that can be included in the connection URI. + * + * @deprecated Replaced by {@link com.google.cloud.spanner.connection.ConnectionProperty}. + */ + @Deprecated public static class ConnectionProperty { private static final String[] BOOLEAN_VALUES = new String[] {"true", "false"}; private final String name; @@ -167,41 +207,48 @@ public String[] getValidValues() { } } + /** + * Set this system property to true to enable transactional connection state by default for + * PostgreSQL-dialect databases. The default is currently false. + */ + public static String ENABLE_TRANSACTIONAL_CONNECTION_STATE_FOR_POSTGRESQL_PROPERTY = + "spanner.enable_transactional_connection_state_for_postgresql"; + private static final LocalConnectionChecker LOCAL_CONNECTION_CHECKER = new LocalConnectionChecker(); - private static final boolean DEFAULT_USE_PLAIN_TEXT = false; + static final boolean DEFAULT_USE_PLAIN_TEXT = false; static final boolean DEFAULT_AUTOCOMMIT = true; static final boolean DEFAULT_READONLY = false; static final boolean DEFAULT_RETRY_ABORTS_INTERNALLY = true; static final boolean DEFAULT_USE_VIRTUAL_THREADS = false; static final boolean DEFAULT_USE_VIRTUAL_GRPC_TRANSPORT_THREADS = false; - private static final String DEFAULT_CREDENTIALS = null; - private static final String DEFAULT_OAUTH_TOKEN = null; - private static final String DEFAULT_MIN_SESSIONS = null; - private static final String DEFAULT_MAX_SESSIONS = null; - private static final String DEFAULT_NUM_CHANNELS = null; + static final String DEFAULT_CREDENTIALS = null; + static final String DEFAULT_OAUTH_TOKEN = null; + static final Integer DEFAULT_MIN_SESSIONS = null; + static final Integer DEFAULT_MAX_SESSIONS = null; + static final Integer DEFAULT_NUM_CHANNELS = null; static final String DEFAULT_ENDPOINT = null; - private static final String DEFAULT_CHANNEL_PROVIDER = null; - private static final String DEFAULT_DATABASE_ROLE = null; - private static final String DEFAULT_USER_AGENT = null; - private static final String DEFAULT_OPTIMIZER_VERSION = ""; - private static final String DEFAULT_OPTIMIZER_STATISTICS_PACKAGE = ""; - private static final RpcPriority DEFAULT_RPC_PRIORITY = null; - private static final DdlInTransactionMode DEFAULT_DDL_IN_TRANSACTION_MODE = + static final String DEFAULT_CHANNEL_PROVIDER = null; + static final String DEFAULT_DATABASE_ROLE = null; + static final String DEFAULT_USER_AGENT = null; + static final String DEFAULT_OPTIMIZER_VERSION = ""; + static final String DEFAULT_OPTIMIZER_STATISTICS_PACKAGE = ""; + static final RpcPriority DEFAULT_RPC_PRIORITY = null; + static final DdlInTransactionMode DEFAULT_DDL_IN_TRANSACTION_MODE = DdlInTransactionMode.ALLOW_IN_EMPTY_TRANSACTION; - private static final boolean DEFAULT_RETURN_COMMIT_STATS = false; - private static final boolean DEFAULT_LENIENT = false; - private static final boolean DEFAULT_ROUTE_TO_LEADER = true; - private static final boolean DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE = false; - private static final boolean DEFAULT_KEEP_TRANSACTION_ALIVE = false; - private static final boolean DEFAULT_TRACK_SESSION_LEAKS = true; - private static final boolean DEFAULT_TRACK_CONNECTION_LEAKS = true; - private static final boolean DEFAULT_DATA_BOOST_ENABLED = false; - private static final boolean DEFAULT_AUTO_PARTITION_MODE = false; - private static final int DEFAULT_MAX_PARTITIONS = 0; - private static final int DEFAULT_MAX_PARTITIONED_PARALLELISM = 1; - private static final Boolean DEFAULT_ENABLE_EXTENDED_TRACING = null; - private static final Boolean DEFAULT_ENABLE_API_TRACING = null; + static final boolean DEFAULT_RETURN_COMMIT_STATS = false; + static final boolean DEFAULT_LENIENT = false; + static final boolean DEFAULT_ROUTE_TO_LEADER = true; + static final boolean DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE = false; + static final boolean DEFAULT_KEEP_TRANSACTION_ALIVE = false; + static final boolean DEFAULT_TRACK_SESSION_LEAKS = true; + static final boolean DEFAULT_TRACK_CONNECTION_LEAKS = true; + static final boolean DEFAULT_DATA_BOOST_ENABLED = false; + static final boolean DEFAULT_AUTO_PARTITION_MODE = false; + static final int DEFAULT_MAX_PARTITIONS = 0; + static final int DEFAULT_MAX_PARTITIONED_PARALLELISM = 1; + static final Boolean DEFAULT_ENABLE_EXTENDED_TRACING = null; + static final Boolean DEFAULT_ENABLE_API_TRACING = null; private static final String PLAIN_TEXT_PROTOCOL = "http:"; private static final String HOST_PROTOCOL = "https:"; @@ -209,7 +256,7 @@ public String[] getValidValues() { private static final String SPANNER_EMULATOR_HOST_ENV_VAR = "SPANNER_EMULATOR_HOST"; private static final String DEFAULT_EMULATOR_HOST = "http://localhost:9010"; /** Use plain text is only for local testing purposes. */ - private static final String USE_PLAIN_TEXT_PROPERTY_NAME = "usePlainText"; + static final String USE_PLAIN_TEXT_PROPERTY_NAME = "usePlainText"; /** Name of the 'autocommit' connection property. */ public static final String AUTOCOMMIT_PROPERTY_NAME = "autocommit"; /** Name of the 'readonly' connection property. */ @@ -252,12 +299,11 @@ public String[] getValidValues() { public static final String ENABLE_CHANNEL_PROVIDER_SYSTEM_PROPERTY = "ENABLE_CHANNEL_PROVIDER"; /** Custom user agent string is only for other Google libraries. */ - private static final String USER_AGENT_PROPERTY_NAME = "userAgent"; + static final String USER_AGENT_PROPERTY_NAME = "userAgent"; /** Query optimizer version to use for a connection. */ - private static final String OPTIMIZER_VERSION_PROPERTY_NAME = "optimizerVersion"; + static final String OPTIMIZER_VERSION_PROPERTY_NAME = "optimizerVersion"; /** Query optimizer statistics package to use for a connection. */ - private static final String OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME = - "optimizerStatisticsPackage"; + static final String OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME = "optimizerStatisticsPackage"; /** Name of the 'lenientMode' connection property. */ public static final String LENIENT_PROPERTY_NAME = "lenient"; /** Name of the 'rpcPriority' connection property. */ @@ -265,7 +311,7 @@ public String[] getValidValues() { public static final String DDL_IN_TRANSACTION_MODE_PROPERTY_NAME = "ddlInTransactionMode"; /** Dialect to use for a connection. */ - private static final String DIALECT_PROPERTY_NAME = "dialect"; + static final String DIALECT_PROPERTY_NAME = "dialect"; /** Name of the 'databaseRole' connection property. */ public static final String DATABASE_ROLE_PROPERTY_NAME = "databaseRole"; /** Name of the 'delay transaction start until first write' property. */ @@ -300,7 +346,17 @@ private static String generateGuardedConnectionPropertyError( systemPropertyName); } - /** All valid connection properties. */ + static boolean isEnableTransactionalConnectionStateForPostgreSQL() { + return Boolean.parseBoolean( + System.getProperty(ENABLE_TRANSACTIONAL_CONNECTION_STATE_FOR_POSTGRESQL_PROPERTY, "false")); + } + + /** + * All valid connection properties. + * + * @deprecated Replaced by {@link ConnectionProperties#CONNECTION_PROPERTIES} + */ + @Deprecated public static final Set VALID_PROPERTIES = Collections.unmodifiableSet( new HashSet<>( @@ -373,7 +429,8 @@ private static String generateGuardedConnectionPropertyError( "Sets the default query optimizer version to use for this connection."), ConnectionProperty.createStringProperty( OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME, ""), - ConnectionProperty.createBooleanProperty("returnCommitStats", "", false), + ConnectionProperty.createBooleanProperty( + "returnCommitStats", "", DEFAULT_RETURN_COMMIT_STATS), ConnectionProperty.createStringProperty( "maxCommitDelay", "The maximum commit delay in milliseconds that should be applied to commit requests from this connection."), @@ -534,16 +591,15 @@ public interface ExternalChannelProvider { /** Builder for {@link ConnectionOptions} instances. */ public static class Builder { + private final Map> connectionPropertyValues = + new HashMap<>(); private String uri; - private String credentialsUrl; - private String oauthToken; private Credentials credentials; private SessionPoolOptions sessionPoolOptions; private List statementExecutionInterceptors = Collections.emptyList(); private SpannerOptionsConfigurator configurator; private OpenTelemetry openTelemetry; - private String tracingPrefix; private Builder() {} @@ -626,11 +682,20 @@ public Builder setUri(String uri) { Preconditions.checkArgument( isValidUri(uri), "The specified URI is not a valid Cloud Spanner connection URI. Please specify a URI in the format \"cloudspanner:[//host[:port]]/projects/project-id[/instances/instance-id[/databases/database-name]][\\?property-name=property-value[;property-name=property-value]*]?\""); - checkValidProperties(uri); + ConnectionPropertyValue value = + cast(ConnectionProperties.parseValues(uri).get(LENIENT.getKey())); + checkValidProperties(value != null && value.getValue(), uri); this.uri = uri; return this; } + Builder setConnectionPropertyValue( + com.google.cloud.spanner.connection.ConnectionProperty property, T value) { + this.connectionPropertyValues.put( + property.getKey(), new ConnectionPropertyValue<>(property, value, value)); + return this; + } + /** Sets the {@link SessionPoolOptions} to use for the connection. */ public Builder setSessionPoolOptions(SessionPoolOptions sessionPoolOptions) { Preconditions.checkNotNull(sessionPoolOptions); @@ -655,7 +720,7 @@ public Builder setSessionPoolOptions(SessionPoolOptions sessionPoolOptions) { * @return this builder */ public Builder setCredentialsUrl(String credentialsUrl) { - this.credentialsUrl = credentialsUrl; + setConnectionPropertyValue(CREDENTIALS_URL, credentialsUrl); return this; } @@ -671,7 +736,7 @@ public Builder setCredentialsUrl(String credentialsUrl) { * @return this builder */ public Builder setOAuthToken(String oauthToken) { - this.oauthToken = oauthToken; + setConnectionPropertyValue(OAUTH_TOKEN, oauthToken); return this; } @@ -699,7 +764,7 @@ public Builder setOpenTelemetry(OpenTelemetry openTelemetry) { } public Builder setTracingPrefix(String tracingPrefix) { - this.tracingPrefix = tracingPrefix; + setConnectionPropertyValue(TRACING_PREFIX, tracingPrefix); return this; } @@ -720,55 +785,19 @@ public static Builder newBuilder() { return new Builder(); } + private final ConnectionState initialConnectionState; private final String uri; private final String warnings; - private final String credentialsUrl; - private final String encodedCredentials; - private final CredentialsProvider credentialsProvider; - private final String oauthToken; private final Credentials fixedCredentials; - private final boolean usePlainText; private final String host; private final String projectId; private final String instanceId; private final String databaseName; private final Credentials credentials; private final SessionPoolOptions sessionPoolOptions; - private final Integer numChannels; - private final String channelProvider; - private final Integer minSessions; - private final Integer maxSessions; - private final String databaseRole; - private final String userAgent; - private final QueryOptions queryOptions; - private final boolean returnCommitStats; - private final Long maxCommitDelay; - private final boolean autoConfigEmulator; - private final boolean useAutoSavepointsForEmulator; - private final Dialect dialect; - private final RpcPriority rpcPriority; - private final DdlInTransactionMode ddlInTransactionMode; - private final boolean delayTransactionStartUntilFirstWrite; - private final boolean keepTransactionAlive; - private final boolean trackSessionLeaks; - private final boolean trackConnectionLeaks; - - private final boolean dataBoostEnabled; - private final boolean autoPartitionMode; - private final int maxPartitions; - private final int maxPartitionedParallelism; - - private final boolean autocommit; - private final boolean readOnly; - private final boolean routeToLeader; - private final boolean retryAbortsInternally; - private final boolean useVirtualThreads; - private final boolean useVirtualGrpcTransportThreads; + private final OpenTelemetry openTelemetry; - private final String tracingPrefix; - private final Boolean enableExtendedTracing; - private final Boolean enableApiTracing; private final List statementExecutionInterceptors; private final SpannerOptionsConfigurator configurator; @@ -776,72 +805,79 @@ private ConnectionOptions(Builder builder) { Matcher matcher = Builder.SPANNER_URI_PATTERN.matcher(builder.uri); Preconditions.checkArgument( matcher.find(), String.format("Invalid connection URI specified: %s", builder.uri)); - this.warnings = checkValidProperties(builder.uri); + ImmutableMap> connectionPropertyValues = + ImmutableMap.>builder() + .putAll(ConnectionProperties.parseValues(builder.uri)) + .putAll(builder.connectionPropertyValues) + .buildKeepingLast(); this.uri = builder.uri; - this.credentialsUrl = - builder.credentialsUrl != null ? builder.credentialsUrl : parseCredentials(builder.uri); - this.encodedCredentials = parseEncodedCredentials(builder.uri); - this.credentialsProvider = parseCredentialsProvider(builder.uri); - this.oauthToken = - builder.oauthToken != null ? builder.oauthToken : parseOAuthToken(builder.uri); + ConnectionPropertyValue value = cast(connectionPropertyValues.get(LENIENT.getKey())); + this.warnings = checkValidProperties(value != null && value.getValue(), uri); + this.fixedCredentials = builder.credentials; + + this.openTelemetry = builder.openTelemetry; + this.statementExecutionInterceptors = + Collections.unmodifiableList(builder.statementExecutionInterceptors); + this.configurator = builder.configurator; + + // Create the initial connection state from the parsed properties in the connection URL. + this.initialConnectionState = new ConnectionState(connectionPropertyValues); + // Check that at most one of credentials location, encoded credentials, credentials provider and // OUAuth token has been specified in the connection URI. Preconditions.checkArgument( Stream.of( - this.credentialsUrl, - this.encodedCredentials, - this.credentialsProvider, - this.oauthToken) + getInitialConnectionPropertyValue(CREDENTIALS_URL), + getInitialConnectionPropertyValue(ENCODED_CREDENTIALS), + getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER), + getInitialConnectionPropertyValue(OAUTH_TOKEN)) .filter(Objects::nonNull) .count() <= 1, "Specify only one of credentialsUrl, encodedCredentials, credentialsProvider and OAuth token"); - this.fixedCredentials = builder.credentials; + checkGuardedProperty( + getInitialConnectionPropertyValue(ENCODED_CREDENTIALS), + ENABLE_ENCODED_CREDENTIALS_SYSTEM_PROPERTY, + ENCODED_CREDENTIALS_PROPERTY_NAME); + checkGuardedProperty( + getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER) == null + ? null + : getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER).getClass().getName(), + ENABLE_CREDENTIALS_PROVIDER_SYSTEM_PROPERTY, + CREDENTIALS_PROVIDER_PROPERTY_NAME); + checkGuardedProperty( + getInitialConnectionPropertyValue(CHANNEL_PROVIDER), + ENABLE_CHANNEL_PROVIDER_SYSTEM_PROPERTY, + CHANNEL_PROVIDER_PROPERTY_NAME); - this.userAgent = parseUserAgent(this.uri); - QueryOptions.Builder queryOptionsBuilder = QueryOptions.newBuilder(); - queryOptionsBuilder.setOptimizerVersion(parseOptimizerVersion(this.uri)); - queryOptionsBuilder.setOptimizerStatisticsPackage(parseOptimizerStatisticsPackage(this.uri)); - this.queryOptions = queryOptionsBuilder.build(); - this.returnCommitStats = parseReturnCommitStats(this.uri); - this.maxCommitDelay = parseMaxCommitDelay(this.uri); - this.autoConfigEmulator = parseAutoConfigEmulator(this.uri); - this.useAutoSavepointsForEmulator = parseUseAutoSavepointsForEmulator(this.uri); - this.dialect = parseDialect(this.uri); - this.usePlainText = this.autoConfigEmulator || parseUsePlainText(this.uri); + boolean usePlainText = + getInitialConnectionPropertyValue(AUTO_CONFIG_EMULATOR) + || getInitialConnectionPropertyValue(USE_PLAIN_TEXT); this.host = determineHost( - matcher, parseEndpoint(this.uri), autoConfigEmulator, usePlainText, System.getenv()); - this.rpcPriority = parseRPCPriority(this.uri); - this.ddlInTransactionMode = parseDdlInTransactionMode(this.uri); - this.delayTransactionStartUntilFirstWrite = parseDelayTransactionStartUntilFirstWrite(this.uri); - this.keepTransactionAlive = parseKeepTransactionAlive(this.uri); - this.trackSessionLeaks = parseTrackSessionLeaks(this.uri); - this.trackConnectionLeaks = parseTrackConnectionLeaks(this.uri); - - this.dataBoostEnabled = parseDataBoostEnabled(this.uri); - this.autoPartitionMode = parseAutoPartitionMode(this.uri); - this.maxPartitions = parseMaxPartitions(this.uri); - this.maxPartitionedParallelism = parseMaxPartitionedParallelism(this.uri); - - this.instanceId = matcher.group(Builder.INSTANCE_GROUP); - this.databaseName = matcher.group(Builder.DATABASE_GROUP); + matcher, + getInitialConnectionPropertyValue(ENDPOINT), + getInitialConnectionPropertyValue(AUTO_CONFIG_EMULATOR), + usePlainText, + System.getenv()); // Using credentials on a plain text connection is not allowed, so if the user has not specified // any credentials and is using a plain text connection, we should not try to get the // credentials from the environment, but default to NoCredentials. if (this.fixedCredentials == null - && this.credentialsUrl == null - && this.encodedCredentials == null - && this.credentialsProvider == null - && this.oauthToken == null - && this.usePlainText) { + && getInitialConnectionPropertyValue(CREDENTIALS_URL) == null + && getInitialConnectionPropertyValue(ENCODED_CREDENTIALS) == null + && getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER) == null + && getInitialConnectionPropertyValue(OAUTH_TOKEN) == null + && usePlainText) { this.credentials = NoCredentials.getInstance(); - } else if (this.oauthToken != null) { - this.credentials = new GoogleCredentials(new AccessToken(oauthToken, null)); - } else if (this.credentialsProvider != null) { + } else if (getInitialConnectionPropertyValue(OAUTH_TOKEN) != null) { + this.credentials = + new GoogleCredentials( + new AccessToken(getInitialConnectionPropertyValue(OAUTH_TOKEN), null)); + } else if (getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER) != null) { try { - this.credentials = this.credentialsProvider.getCredentials(); + this.credentials = getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER).getCredentials(); } catch (IOException exception) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.INVALID_ARGUMENT, @@ -850,52 +886,31 @@ private ConnectionOptions(Builder builder) { } } else if (this.fixedCredentials != null) { this.credentials = fixedCredentials; - } else if (this.encodedCredentials != null) { - this.credentials = getCredentialsService().decodeCredentials(this.encodedCredentials); + } else if (getInitialConnectionPropertyValue(ENCODED_CREDENTIALS) != null) { + this.credentials = + getCredentialsService() + .decodeCredentials(getInitialConnectionPropertyValue(ENCODED_CREDENTIALS)); } else { - this.credentials = getCredentialsService().createCredentials(this.credentialsUrl); + this.credentials = + getCredentialsService() + .createCredentials(getInitialConnectionPropertyValue(CREDENTIALS_URL)); } - this.minSessions = - parseIntegerProperty(MIN_SESSIONS_PROPERTY_NAME, parseMinSessions(builder.uri)); - this.maxSessions = - parseIntegerProperty(MAX_SESSIONS_PROPERTY_NAME, parseMaxSessions(builder.uri)); - this.numChannels = - parseIntegerProperty(NUM_CHANNELS_PROPERTY_NAME, parseNumChannels(builder.uri)); - this.channelProvider = parseChannelProvider(builder.uri); - this.databaseRole = parseDatabaseRole(this.uri); - String projectId = matcher.group(Builder.PROJECT_GROUP); - if (Builder.DEFAULT_PROJECT_ID_PLACEHOLDER.equalsIgnoreCase(projectId)) { - projectId = getDefaultProjectId(this.credentials); - } - this.projectId = projectId; - - this.autocommit = parseAutocommit(this.uri); - this.readOnly = parseReadOnly(this.uri); - this.routeToLeader = parseRouteToLeader(this.uri); - this.retryAbortsInternally = parseRetryAbortsInternally(this.uri); - this.useVirtualThreads = parseUseVirtualThreads(this.uri); - this.useVirtualGrpcTransportThreads = parseUseVirtualGrpcTransportThreads(this.uri); - this.openTelemetry = builder.openTelemetry; - this.tracingPrefix = builder.tracingPrefix; - this.enableExtendedTracing = parseEnableExtendedTracing(this.uri); - this.enableApiTracing = parseEnableApiTracing(this.uri); - this.statementExecutionInterceptors = - Collections.unmodifiableList(builder.statementExecutionInterceptors); - this.configurator = builder.configurator; - - if (this.minSessions != null || this.maxSessions != null || !this.trackSessionLeaks) { + if (getInitialConnectionPropertyValue(MIN_SESSIONS) != null + || getInitialConnectionPropertyValue(MAX_SESSIONS) != null + || !getInitialConnectionPropertyValue(TRACK_SESSION_LEAKS)) { SessionPoolOptions.Builder sessionPoolOptionsBuilder = builder.sessionPoolOptions == null ? SessionPoolOptions.newBuilder() : builder.sessionPoolOptions.toBuilder(); - sessionPoolOptionsBuilder.setTrackStackTraceOfSessionCheckout(this.trackSessionLeaks); + sessionPoolOptionsBuilder.setTrackStackTraceOfSessionCheckout( + getInitialConnectionPropertyValue(TRACK_SESSION_LEAKS)); sessionPoolOptionsBuilder.setAutoDetectDialect(true); - if (this.minSessions != null) { - sessionPoolOptionsBuilder.setMinSessions(this.minSessions); + if (getInitialConnectionPropertyValue(MIN_SESSIONS) != null) { + sessionPoolOptionsBuilder.setMinSessions(getInitialConnectionPropertyValue(MIN_SESSIONS)); } - if (this.maxSessions != null) { - sessionPoolOptionsBuilder.setMaxSessions(this.maxSessions); + if (getInitialConnectionPropertyValue(MAX_SESSIONS) != null) { + sessionPoolOptionsBuilder.setMaxSessions(getInitialConnectionPropertyValue(MAX_SESSIONS)); } this.sessionPoolOptions = sessionPoolOptionsBuilder.build(); } else if (builder.sessionPoolOptions != null) { @@ -903,6 +918,14 @@ private ConnectionOptions(Builder builder) { } else { this.sessionPoolOptions = SessionPoolOptions.newBuilder().setAutoDetectDialect(true).build(); } + + String projectId = matcher.group(Builder.PROJECT_GROUP); + if (Builder.DEFAULT_PROJECT_ID_PLACEHOLDER.equalsIgnoreCase(projectId)) { + projectId = getDefaultProjectId(this.credentials); + } + this.projectId = projectId; + this.instanceId = matcher.group(Builder.INSTANCE_GROUP); + this.databaseName = matcher.group(Builder.DATABASE_GROUP); } @VisibleForTesting @@ -937,20 +960,6 @@ static String determineHost( return HOST_PROTOCOL + host; } - private static Integer parseIntegerProperty(String propertyName, String value) { - if (value != null) { - try { - return Integer.valueOf(value); - } catch (NumberFormatException e) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, - String.format("Invalid %s value specified: %s", propertyName, value), - e); - } - } - return null; - } - /** * @return an instance of OpenTelemetry. If OpenTelemetry object is not set then null * will be returned. @@ -959,15 +968,6 @@ OpenTelemetry getOpenTelemetry() { return this.openTelemetry; } - /** - * @return The prefix that will be added to all traces that are started by the Connection API. - * This property is used by for example the JDBC driver to make sure all traces start with - * CloudSpannerJdbc. - */ - String getTracingPrefix() { - return this.tracingPrefix; - } - SpannerOptionsConfigurator getConfigurator() { return configurator; } @@ -977,103 +977,6 @@ CredentialsService getCredentialsService() { return CredentialsService.INSTANCE; } - @VisibleForTesting - static boolean parseUsePlainText(String uri) { - String value = parseUriProperty(uri, USE_PLAIN_TEXT_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_USE_PLAIN_TEXT; - } - - @VisibleForTesting - static boolean parseAutocommit(String uri) { - String value = parseUriProperty(uri, AUTOCOMMIT_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_AUTOCOMMIT; - } - - @VisibleForTesting - static boolean parseReadOnly(String uri) { - String value = parseUriProperty(uri, READONLY_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_READONLY; - } - - static boolean parseRouteToLeader(String uri) { - String value = parseUriProperty(uri, ROUTE_TO_LEADER_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_ROUTE_TO_LEADER; - } - - @VisibleForTesting - static boolean parseRetryAbortsInternally(String uri) { - String value = parseUriProperty(uri, RETRY_ABORTS_INTERNALLY_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_RETRY_ABORTS_INTERNALLY; - } - - @VisibleForTesting - static boolean parseUseVirtualThreads(String uri) { - String value = parseUriProperty(uri, USE_VIRTUAL_THREADS_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_USE_VIRTUAL_THREADS; - } - - @VisibleForTesting - static boolean parseUseVirtualGrpcTransportThreads(String uri) { - String value = parseUriProperty(uri, USE_VIRTUAL_GRPC_TRANSPORT_THREADS_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_USE_VIRTUAL_GRPC_TRANSPORT_THREADS; - } - - @VisibleForTesting - static @Nullable String parseCredentials(String uri) { - String value = parseUriProperty(uri, CREDENTIALS_PROPERTY_NAME); - return value != null ? value : DEFAULT_CREDENTIALS; - } - - @VisibleForTesting - static @Nullable String parseEncodedCredentials(String uri) { - String encodedCredentials = parseUriProperty(uri, ENCODED_CREDENTIALS_PROPERTY_NAME); - checkGuardedProperty( - encodedCredentials, - ENABLE_ENCODED_CREDENTIALS_SYSTEM_PROPERTY, - ENCODED_CREDENTIALS_PROPERTY_NAME); - return encodedCredentials; - } - - @VisibleForTesting - static @Nullable CredentialsProvider parseCredentialsProvider(String uri) { - String credentialsProviderName = parseUriProperty(uri, CREDENTIALS_PROVIDER_PROPERTY_NAME); - checkGuardedProperty( - credentialsProviderName, - ENABLE_CREDENTIALS_PROVIDER_SYSTEM_PROPERTY, - CREDENTIALS_PROVIDER_PROPERTY_NAME); - if (!Strings.isNullOrEmpty(credentialsProviderName)) { - try { - Class clazz = - (Class) Class.forName(credentialsProviderName); - Constructor constructor = clazz.getDeclaredConstructor(); - return constructor.newInstance(); - } catch (ClassNotFoundException classNotFoundException) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, - "Unknown or invalid CredentialsProvider class name: " + credentialsProviderName, - classNotFoundException); - } catch (NoSuchMethodException noSuchMethodException) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, - "Credentials provider " - + credentialsProviderName - + " does not have a public no-arg constructor.", - noSuchMethodException); - } catch (InvocationTargetException - | InstantiationException - | IllegalAccessException exception) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, - "Failed to create an instance of " - + credentialsProviderName - + ": " - + exception.getMessage(), - exception); - } - } - return null; - } - private static void checkGuardedProperty( String value, String systemPropertyName, String connectionPropertyName) { if (!Strings.isNullOrEmpty(value) @@ -1084,219 +987,6 @@ private static void checkGuardedProperty( } } - @VisibleForTesting - static @Nullable String parseOAuthToken(String uri) { - String value = parseUriProperty(uri, OAUTH_TOKEN_PROPERTY_NAME); - return value != null ? value : DEFAULT_OAUTH_TOKEN; - } - - @VisibleForTesting - static String parseMinSessions(String uri) { - String value = parseUriProperty(uri, MIN_SESSIONS_PROPERTY_NAME); - return value != null ? value : DEFAULT_MIN_SESSIONS; - } - - @VisibleForTesting - static String parseMaxSessions(String uri) { - String value = parseUriProperty(uri, MAX_SESSIONS_PROPERTY_NAME); - return value != null ? value : DEFAULT_MAX_SESSIONS; - } - - @VisibleForTesting - static String parseNumChannels(String uri) { - String value = parseUriProperty(uri, NUM_CHANNELS_PROPERTY_NAME); - return value != null ? value : DEFAULT_NUM_CHANNELS; - } - - private static String parseEndpoint(String uri) { - String value = parseUriProperty(uri, ENDPOINT_PROPERTY_NAME); - return value != null ? value : DEFAULT_ENDPOINT; - } - - @VisibleForTesting - static String parseChannelProvider(String uri) { - String value = parseUriProperty(uri, CHANNEL_PROVIDER_PROPERTY_NAME); - checkGuardedProperty( - value, ENABLE_CHANNEL_PROVIDER_SYSTEM_PROPERTY, CHANNEL_PROVIDER_PROPERTY_NAME); - return value != null ? value : DEFAULT_CHANNEL_PROVIDER; - } - - @VisibleForTesting - static String parseDatabaseRole(String uri) { - String value = parseUriProperty(uri, DATABASE_ROLE_PROPERTY_NAME); - return value != null ? value : DEFAULT_DATABASE_ROLE; - } - - @VisibleForTesting - static String parseUserAgent(String uri) { - String value = parseUriProperty(uri, USER_AGENT_PROPERTY_NAME); - return value != null ? value : DEFAULT_USER_AGENT; - } - - @VisibleForTesting - static String parseOptimizerVersion(String uri) { - String value = parseUriProperty(uri, OPTIMIZER_VERSION_PROPERTY_NAME); - return value != null ? value : DEFAULT_OPTIMIZER_VERSION; - } - - @VisibleForTesting - static String parseOptimizerStatisticsPackage(String uri) { - String value = parseUriProperty(uri, OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME); - return value != null ? value : DEFAULT_OPTIMIZER_STATISTICS_PACKAGE; - } - - @VisibleForTesting - static boolean parseReturnCommitStats(String uri) { - String value = parseUriProperty(uri, "returnCommitStats"); - return Boolean.parseBoolean(value); - } - - @VisibleForTesting - static Long parseMaxCommitDelay(String uri) { - String value = parseUriProperty(uri, "maxCommitDelay"); - try { - Long millis = value == null ? null : Long.valueOf(value); - if (millis != null && millis < 0L) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "maxCommitDelay must be >=0"); - } - return millis; - } catch (NumberFormatException numberFormatException) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, - "Invalid value for maxCommitDelay: " - + value - + "\n" - + "The value must be a positive integer indicating the number of " - + "milliseconds to use as the max delay."); - } - } - - static boolean parseAutoConfigEmulator(String uri) { - String value = parseUriProperty(uri, "autoConfigEmulator"); - return Boolean.parseBoolean(value); - } - - static boolean parseUseAutoSavepointsForEmulator(String uri) { - String value = parseUriProperty(uri, "useAutoSavepointsForEmulator"); - return Boolean.parseBoolean(value); - } - - @VisibleForTesting - static Dialect parseDialect(String uri) { - String value = parseUriProperty(uri, DIALECT_PROPERTY_NAME); - return value != null ? Dialect.valueOf(value.toUpperCase()) : Dialect.GOOGLE_STANDARD_SQL; - } - - @VisibleForTesting - static boolean parseLenient(String uri) { - String value = parseUriProperty(uri, LENIENT_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_LENIENT; - } - - @VisibleForTesting - static boolean parseDelayTransactionStartUntilFirstWrite(String uri) { - String value = parseUriProperty(uri, DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE_NAME); - return value != null - ? Boolean.parseBoolean(value) - : DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE; - } - - @VisibleForTesting - static boolean parseKeepTransactionAlive(String uri) { - String value = parseUriProperty(uri, KEEP_TRANSACTION_ALIVE_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_KEEP_TRANSACTION_ALIVE; - } - - @VisibleForTesting - static boolean parseTrackSessionLeaks(String uri) { - String value = parseUriProperty(uri, TRACK_SESSION_LEAKS_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_TRACK_SESSION_LEAKS; - } - - @VisibleForTesting - static boolean parseTrackConnectionLeaks(String uri) { - String value = parseUriProperty(uri, TRACK_CONNECTION_LEAKS_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_TRACK_CONNECTION_LEAKS; - } - - @VisibleForTesting - static boolean parseDataBoostEnabled(String uri) { - String value = parseUriProperty(uri, DATA_BOOST_ENABLED_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_DATA_BOOST_ENABLED; - } - - @VisibleForTesting - static boolean parseAutoPartitionMode(String uri) { - String value = parseUriProperty(uri, AUTO_PARTITION_MODE_PROPERTY_NAME); - return value != null ? Boolean.parseBoolean(value) : DEFAULT_AUTO_PARTITION_MODE; - } - - @VisibleForTesting - static int parseMaxPartitions(String uri) { - String stringValue = parseUriProperty(uri, MAX_PARTITIONS_PROPERTY_NAME); - if (stringValue == null) { - return DEFAULT_MAX_PARTITIONS; - } - try { - int value = Integer.parseInt(stringValue); - if (value < 0) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "maxPartitions must be >=0"); - } - return value; - } catch (NumberFormatException numberFormatException) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "Invalid value for maxPartitions: " + stringValue); - } - } - - @VisibleForTesting - static int parseMaxPartitionedParallelism(String uri) { - String stringValue = parseUriProperty(uri, MAX_PARTITIONED_PARALLELISM_PROPERTY_NAME); - if (stringValue == null) { - return DEFAULT_MAX_PARTITIONED_PARALLELISM; - } - try { - int value = Integer.parseInt(stringValue); - if (value < 0) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, "maxPartitionedParallelism must be >=0"); - } - return value; - } catch (NumberFormatException numberFormatException) { - throw SpannerExceptionFactory.newSpannerException( - ErrorCode.INVALID_ARGUMENT, - "Invalid value for maxPartitionedParallelism: " + stringValue); - } - } - - @VisibleForTesting - static RpcPriority parseRPCPriority(String uri) { - String value = parseUriProperty(uri, RPC_PRIORITY_NAME); - return value != null ? RpcPriority.valueOf(value) : DEFAULT_RPC_PRIORITY; - } - - @VisibleForTesting - static DdlInTransactionMode parseDdlInTransactionMode(String uri) { - String value = parseUriProperty(uri, DDL_IN_TRANSACTION_MODE_PROPERTY_NAME); - return value != null - ? DdlInTransactionMode.valueOf(value.toUpperCase()) - : DEFAULT_DDL_IN_TRANSACTION_MODE; - } - - @VisibleForTesting - static Boolean parseEnableExtendedTracing(String uri) { - String value = parseUriProperty(uri, ENABLE_EXTENDED_TRACING_PROPERTY_NAME); - return value != null ? Boolean.valueOf(value) : DEFAULT_ENABLE_EXTENDED_TRACING; - } - - @VisibleForTesting - static Boolean parseEnableApiTracing(String uri) { - String value = parseUriProperty(uri, ENABLE_API_TRACING_PROPERTY_NAME); - return value != null ? Boolean.valueOf(value) : DEFAULT_ENABLE_API_TRACING; - } - @VisibleForTesting static String parseUriProperty(String uri, String property) { Pattern pattern = Pattern.compile(String.format("(?is)(?:;|\\?)%s=(.*?)(?:;|$)", property)); @@ -1309,23 +999,23 @@ static String parseUriProperty(String uri, String property) { /** Check that only valid properties have been specified. */ @VisibleForTesting - static String checkValidProperties(String uri) { - String invalidProperties = ""; + static String checkValidProperties(boolean lenient, String uri) { + StringBuilder invalidProperties = new StringBuilder(); List properties = parseProperties(uri); - boolean lenient = parseLenient(uri); for (String property : properties) { - if (!INTERNAL_VALID_PROPERTIES.contains(ConnectionProperty.createEmptyProperty(property))) { + if (!ConnectionProperties.CONNECTION_PROPERTIES.containsKey( + property.toLowerCase(Locale.ENGLISH))) { if (invalidProperties.length() > 0) { - invalidProperties = invalidProperties + ", "; + invalidProperties.append(", "); } - invalidProperties = invalidProperties + property; + invalidProperties.append(property); } } if (lenient) { return String.format("Invalid properties found in connection URI: %s", invalidProperties); } else { Preconditions.checkArgument( - invalidProperties.isEmpty(), + invalidProperties.length() == 0, String.format( "Invalid properties found in connection URI. Add lenient=true to the connection string to ignore unknown properties. Invalid properties: %s", invalidProperties)); @@ -1369,13 +1059,23 @@ public String getUri() { return uri; } + /** The connection properties that have been pre-set for this {@link ConnectionOptions}. */ + Map> getInitialConnectionPropertyValues() { + return this.initialConnectionState.getAllValues(); + } + + T getInitialConnectionPropertyValue( + com.google.cloud.spanner.connection.ConnectionProperty property) { + return this.initialConnectionState.getValue(property).getValue(); + } + /** The credentials URL of this {@link ConnectionOptions} */ public String getCredentialsUrl() { - return credentialsUrl; + return getInitialConnectionPropertyValue(CREDENTIALS_URL); } String getOAuthToken() { - return this.oauthToken; + return getInitialConnectionPropertyValue(OAUTH_TOKEN); } Credentials getFixedCredentials() { @@ -1383,7 +1083,7 @@ Credentials getFixedCredentials() { } CredentialsProvider getCredentialsProvider() { - return this.credentialsProvider; + return getInitialConnectionPropertyValue(CREDENTIALS_PROVIDER); } /** The {@link SessionPoolOptions} of this {@link ConnectionOptions}. */ @@ -1397,7 +1097,7 @@ public SessionPoolOptions getSessionPoolOptions() { * database using the same connection settings. */ public Integer getMinSessions() { - return minSessions; + return getInitialConnectionPropertyValue(MIN_SESSIONS); } /** @@ -1406,16 +1106,17 @@ public Integer getMinSessions() { * database using the same connection settings. */ public Integer getMaxSessions() { - return maxSessions; + return getInitialConnectionPropertyValue(MAX_SESSIONS); } /** The number of channels to use for the connection. */ public Integer getNumChannels() { - return numChannels; + return getInitialConnectionPropertyValue(NUM_CHANNELS); } /** Calls the getChannelProvider() method from the supplied class. */ public TransportChannelProvider getChannelProvider() { + String channelProvider = getInitialConnectionPropertyValue(CHANNEL_PROVIDER); if (channelProvider == null) { return null; } @@ -1438,7 +1139,7 @@ public TransportChannelProvider getChannelProvider() { * used to for example restrict the access of a connection to a specific set of tables. */ public String getDatabaseRole() { - return databaseRole; + return getInitialConnectionPropertyValue(DATABASE_ROLE); } /** The host and port number that this {@link ConnectionOptions} will connect to */ @@ -1479,12 +1180,12 @@ public Credentials getCredentials() { /** The initial autocommit value for connections created by this {@link ConnectionOptions} */ public boolean isAutocommit() { - return autocommit; + return getInitialConnectionPropertyValue(AUTOCOMMIT); } /** The initial readonly value for connections created by this {@link ConnectionOptions} */ public boolean isReadOnly() { - return readOnly; + return getInitialConnectionPropertyValue(READONLY); } /** @@ -1492,7 +1193,7 @@ public boolean isReadOnly() { * region. */ public boolean isRouteToLeader() { - return routeToLeader; + return getInitialConnectionPropertyValue(ROUTE_TO_LEADER); } /** @@ -1500,17 +1201,17 @@ public boolean isRouteToLeader() { * ConnectionOptions} */ public boolean isRetryAbortsInternally() { - return retryAbortsInternally; + return getInitialConnectionPropertyValue(RETRY_ABORTS_INTERNALLY); } /** Whether connections should use virtual threads for connection executors. */ public boolean isUseVirtualThreads() { - return useVirtualThreads; + return getInitialConnectionPropertyValue(USE_VIRTUAL_THREADS); } /** Whether virtual threads should be used for gRPC transport. */ public boolean isUseVirtualGrpcTransportThreads() { - return useVirtualGrpcTransportThreads; + return getInitialConnectionPropertyValue(USE_VIRTUAL_GRPC_TRANSPORT_THREADS); } /** Any warnings that were generated while creating the {@link ConnectionOptions} instance. */ @@ -1521,7 +1222,8 @@ public String getWarnings() { /** Use http instead of https. Only valid for (local) test servers. */ boolean isUsePlainText() { - return usePlainText; + return getInitialConnectionPropertyValue(AUTO_CONFIG_EMULATOR) + || getInitialConnectionPropertyValue(USE_PLAIN_TEXT); } /** @@ -1529,28 +1231,23 @@ boolean isUsePlainText() { * default JDBC user agent string will be used. */ String getUserAgent() { - return userAgent; - } - - /** The {@link QueryOptions} to use for the connection. */ - QueryOptions getQueryOptions() { - return queryOptions; + return getInitialConnectionPropertyValue(USER_AGENT); } /** Whether connections created by this {@link ConnectionOptions} return commit stats. */ public boolean isReturnCommitStats() { - return returnCommitStats; + return getInitialConnectionPropertyValue(RETURN_COMMIT_STATS); } /** The max_commit_delay that should be applied to commit operations on this connection. */ public Duration getMaxCommitDelay() { - return maxCommitDelay == null ? null : Duration.ofMillis(maxCommitDelay); + return getInitialConnectionPropertyValue(MAX_COMMIT_DELAY); } boolean usesEmulator() { return Suppliers.memoize( () -> - this.autoConfigEmulator + isAutoConfigEmulator() || !Strings.isNullOrEmpty(System.getenv("SPANNER_EMULATOR_HOST"))) .get(); } @@ -1562,7 +1259,7 @@ boolean usesEmulator() { * emulator instance. */ public boolean isAutoConfigEmulator() { - return autoConfigEmulator; + return getInitialConnectionPropertyValue(AUTO_CONFIG_EMULATOR); } /** @@ -1572,68 +1269,39 @@ public boolean isAutoConfigEmulator() { *

This is no longer needed since version 1.5.23 of the emulator. */ boolean useAutoSavepointsForEmulator() { - return useAutoSavepointsForEmulator; + return getInitialConnectionPropertyValue(USE_AUTO_SAVEPOINTS_FOR_EMULATOR); } public Dialect getDialect() { - return dialect; - } - - /** The {@link RpcPriority} to use for the connection. */ - RpcPriority getRPCPriority() { - return rpcPriority; - } - - DdlInTransactionMode getDdlInTransactionMode() { - return this.ddlInTransactionMode; - } - - /** - * Whether connections created by this {@link ConnectionOptions} should delay the actual start of - * a read/write transaction until the first write operation. - */ - boolean isDelayTransactionStartUntilFirstWrite() { - return delayTransactionStartUntilFirstWrite; - } - - /** - * Whether connections created by this {@link ConnectionOptions} should keep read/write - * transactions alive by executing a SELECT 1 once every 10 seconds if no other statements are - * executed. This option should be used with caution, as enabling it can keep transactions alive - * for a very long time, which will hold on to any locks that have been taken by the transaction. - * This option should typically only be enabled for CLI-type applications or other user-input - * applications that might wait for a longer period of time on user input. - */ - boolean isKeepTransactionAlive() { - return keepTransactionAlive; + return getInitialConnectionPropertyValue(DIALECT); } boolean isTrackConnectionLeaks() { - return this.trackConnectionLeaks; + return getInitialConnectionPropertyValue(TRACK_CONNECTION_LEAKS); } boolean isDataBoostEnabled() { - return this.dataBoostEnabled; + return getInitialConnectionPropertyValue(DATA_BOOST_ENABLED); } boolean isAutoPartitionMode() { - return this.autoPartitionMode; + return getInitialConnectionPropertyValue(AUTO_PARTITION_MODE); } int getMaxPartitions() { - return this.maxPartitions; + return getInitialConnectionPropertyValue(MAX_PARTITIONS); } int getMaxPartitionedParallelism() { - return this.maxPartitionedParallelism; + return getInitialConnectionPropertyValue(MAX_PARTITIONED_PARALLELISM); } Boolean isEnableExtendedTracing() { - return this.enableExtendedTracing; + return getInitialConnectionPropertyValue(ENABLE_EXTENDED_TRACING); } Boolean isEnableApiTracing() { - return this.enableApiTracing; + return getInitialConnectionPropertyValue(ENABLE_API_TRACING); } /** Interceptors that should be executed after each statement */ diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java new file mode 100644 index 00000000000..b18326e015d --- /dev/null +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java @@ -0,0 +1,515 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static com.google.cloud.spanner.connection.ConnectionOptions.AUTOCOMMIT_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.AUTO_PARTITION_MODE_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.CHANNEL_PROVIDER_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.CREDENTIALS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.CREDENTIALS_PROVIDER_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.DATABASE_ROLE_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.DATA_BOOST_ENABLED_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.DDL_IN_TRANSACTION_MODE_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_AUTOCOMMIT; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_AUTO_PARTITION_MODE; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_CHANNEL_PROVIDER; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_CREDENTIALS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_DATABASE_ROLE; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_DATA_BOOST_ENABLED; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_DDL_IN_TRANSACTION_MODE; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_ENABLE_API_TRACING; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_ENABLE_EXTENDED_TRACING; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_ENDPOINT; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_KEEP_TRANSACTION_ALIVE; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_LENIENT; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_MAX_PARTITIONED_PARALLELISM; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_MAX_PARTITIONS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_MAX_SESSIONS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_MIN_SESSIONS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_NUM_CHANNELS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_OAUTH_TOKEN; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_OPTIMIZER_STATISTICS_PACKAGE; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_OPTIMIZER_VERSION; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_READONLY; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_RETRY_ABORTS_INTERNALLY; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_RETURN_COMMIT_STATS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_ROUTE_TO_LEADER; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_RPC_PRIORITY; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_TRACK_CONNECTION_LEAKS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_TRACK_SESSION_LEAKS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_USER_AGENT; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_USE_PLAIN_TEXT; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_USE_VIRTUAL_GRPC_TRANSPORT_THREADS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DEFAULT_USE_VIRTUAL_THREADS; +import static com.google.cloud.spanner.connection.ConnectionOptions.DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.DIALECT_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.ENABLE_API_TRACING_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.ENABLE_EXTENDED_TRACING_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.ENCODED_CREDENTIALS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.ENDPOINT_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.KEEP_TRANSACTION_ALIVE_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.LENIENT_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.MAX_PARTITIONED_PARALLELISM_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.MAX_PARTITIONS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.MAX_SESSIONS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.MIN_SESSIONS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.NUM_CHANNELS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.OAUTH_TOKEN_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.OPTIMIZER_VERSION_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.READONLY_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.RETRY_ABORTS_INTERNALLY_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.ROUTE_TO_LEADER_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.RPC_PRIORITY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.TRACK_CONNECTION_LEAKS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.TRACK_SESSION_LEAKS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.USER_AGENT_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.USE_PLAIN_TEXT_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.USE_VIRTUAL_GRPC_TRANSPORT_THREADS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionOptions.USE_VIRTUAL_THREADS_PROPERTY_NAME; +import static com.google.cloud.spanner.connection.ConnectionProperty.castProperty; + +import com.google.api.gax.core.CredentialsProvider; +import com.google.cloud.spanner.Dialect; +import com.google.cloud.spanner.Options.RpcPriority; +import com.google.cloud.spanner.TimestampBound; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.AutocommitDmlModeConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.BooleanConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.ConnectionStateTypeConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.CredentialsProviderConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.DdlInTransactionModeConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.DialectConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.DurationConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.NonNegativeIntegerConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.ReadOnlyStalenessConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.RpcPriorityConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.SavepointSupportConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.StringValueConverter; +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import com.google.cloud.spanner.connection.DirectedReadOptionsUtil.DirectedReadOptionsConverter; +import com.google.common.collect.ImmutableMap; +import com.google.spanner.v1.DirectedReadOptions; +import java.time.Duration; +import java.util.Map; + +/** + * Utility class that defines all known connection properties. This class will eventually replace + * the list of {@link com.google.cloud.spanner.connection.ConnectionOptions.ConnectionProperty} in + * {@link ConnectionOptions}. + */ +class ConnectionProperties { + private static final ImmutableMap.Builder> + CONNECTION_PROPERTIES_BUILDER = ImmutableMap.builder(); + + static final ConnectionProperty CONNECTION_STATE_TYPE = + create( + "connection_state_type", + "The type of connection state to use for this connection. Can only be set at start up. " + + "If no value is set, then the database dialect default will be used, " + + "which is NON_TRANSACTIONAL for GoogleSQL and TRANSACTIONAL for PostgreSQL.", + null, + ConnectionStateTypeConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty TRACING_PREFIX = + create( + "tracing_prefix", + "The prefix that will be prepended to all OpenTelemetry traces that are " + + "generated by a Connection.", + "CloudSpanner", + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty LENIENT = + create( + LENIENT_PROPERTY_NAME, + "Silently ignore unknown properties in the connection string/properties (true/false)", + DEFAULT_LENIENT, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty ENDPOINT = + create( + ENDPOINT_PROPERTY_NAME, + "The endpoint that the JDBC driver should connect to. " + + "The default is the default Spanner production endpoint when autoConfigEmulator=false, " + + "and the default Spanner emulator endpoint (localhost:9010) when autoConfigEmulator=true. " + + "This property takes precedence over any host name at the start of the connection URL.", + DEFAULT_ENDPOINT, + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty AUTO_CONFIG_EMULATOR = + create( + "autoConfigEmulator", + "Automatically configure the connection to try to connect to the Cloud Spanner emulator (true/false). " + + "The instance and database in the connection string will automatically be created if these do not yet exist on the emulator. " + + "Add dialect=postgresql to the connection string to make sure that the database that is created uses the PostgreSQL dialect.", + false, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty USE_AUTO_SAVEPOINTS_FOR_EMULATOR = + create( + "useAutoSavepointsForEmulator", + "Automatically creates savepoints for each statement in a read/write transaction when using the Emulator. " + + "This is no longer needed when using Emulator version 1.5.23 or higher.", + false, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty USE_PLAIN_TEXT = + create( + USE_PLAIN_TEXT_PROPERTY_NAME, + "Use a plain text communication channel (i.e. non-TLS) for communicating with the server (true/false). Set this value to true for communication with the Cloud Spanner emulator.", + DEFAULT_USE_PLAIN_TEXT, + BooleanConverter.INSTANCE, + Context.STARTUP); + + static final ConnectionProperty CREDENTIALS_URL = + create( + CREDENTIALS_PROPERTY_NAME, + "The location of the credentials file to use for this connection. If neither this property or encoded credentials are set, the connection will use the default Google Cloud credentials for the runtime environment.", + DEFAULT_CREDENTIALS, + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty ENCODED_CREDENTIALS = + create( + ENCODED_CREDENTIALS_PROPERTY_NAME, + "Base64-encoded credentials to use for this connection. If neither this property or a credentials location are set, the connection will use the default Google Cloud credentials for the runtime environment.", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty OAUTH_TOKEN = + create( + OAUTH_TOKEN_PROPERTY_NAME, + "A valid pre-existing OAuth token to use for authentication for this connection. Setting this property will take precedence over any value set for a credentials file.", + DEFAULT_OAUTH_TOKEN, + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty CREDENTIALS_PROVIDER = + create( + CREDENTIALS_PROVIDER_PROPERTY_NAME, + "The class name of the com.google.api.gax.core.CredentialsProvider implementation that should be used to obtain credentials for connections.", + null, + CredentialsProviderConverter.INSTANCE, + Context.STARTUP); + + static final ConnectionProperty USER_AGENT = + create( + USER_AGENT_PROPERTY_NAME, + "The custom user-agent property name to use when communicating with Cloud Spanner. This property is intended for internal library usage, and should not be set by applications.", + DEFAULT_USER_AGENT, + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty DIALECT = + create( + DIALECT_PROPERTY_NAME, + "Sets the dialect to use for new databases that are created by this connection.", + Dialect.GOOGLE_STANDARD_SQL, + DialectConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty TRACK_SESSION_LEAKS = + create( + TRACK_SESSION_LEAKS_PROPERTY_NAME, + "Capture the call stack of the thread that checked out a session of the session pool. This will " + + "pre-create a LeakedSessionException already when a session is checked out. This can be disabled, " + + "for example if a monitoring system logs the pre-created exception. " + + "If disabled, the LeakedSessionException will only be created when an " + + "actual session leak is detected. The stack trace of the exception will " + + "in that case not contain the call stack of when the session was checked out.", + DEFAULT_TRACK_SESSION_LEAKS, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty TRACK_CONNECTION_LEAKS = + create( + TRACK_CONNECTION_LEAKS_PROPERTY_NAME, + "Capture the call stack of the thread that created a connection. This will " + + "pre-create a LeakedConnectionException already when a connection is created. " + + "This can be disabled, for example if a monitoring system logs the pre-created exception. " + + "If disabled, the LeakedConnectionException will only be created when an " + + "actual connection leak is detected. The stack trace of the exception will " + + "in that case not contain the call stack of when the connection was created.", + DEFAULT_TRACK_CONNECTION_LEAKS, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty ROUTE_TO_LEADER = + create( + ROUTE_TO_LEADER_PROPERTY_NAME, + "Should read/write transactions and partitioned DML be routed to leader region (true/false)", + DEFAULT_ROUTE_TO_LEADER, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty USE_VIRTUAL_THREADS = + create( + USE_VIRTUAL_THREADS_PROPERTY_NAME, + "Use a virtual thread instead of a platform thread for each connection (true/false). " + + "This option only has any effect if the application is running on Java 21 or higher. In all other cases, the option is ignored.", + DEFAULT_USE_VIRTUAL_THREADS, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty USE_VIRTUAL_GRPC_TRANSPORT_THREADS = + create( + USE_VIRTUAL_GRPC_TRANSPORT_THREADS_PROPERTY_NAME, + "Use a virtual thread instead of a platform thread for the gRPC executor (true/false). " + + "This option only has any effect if the application is running on Java 21 or higher. In all other cases, the option is ignored.", + DEFAULT_USE_VIRTUAL_GRPC_TRANSPORT_THREADS, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty ENABLE_EXTENDED_TRACING = + create( + ENABLE_EXTENDED_TRACING_PROPERTY_NAME, + "Include the SQL string in the OpenTelemetry traces that are generated " + + "by this connection. The SQL string is added as the standard OpenTelemetry " + + "attribute 'db.statement'.", + DEFAULT_ENABLE_EXTENDED_TRACING, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty ENABLE_API_TRACING = + create( + ENABLE_API_TRACING_PROPERTY_NAME, + "Add OpenTelemetry traces for each individual RPC call. Enable this " + + "to get a detailed view of each RPC that is being executed by your application, " + + "or if you want to debug potential latency problems caused by RPCs that are " + + "being retried.", + DEFAULT_ENABLE_API_TRACING, + BooleanConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty MIN_SESSIONS = + create( + MIN_SESSIONS_PROPERTY_NAME, + "The minimum number of sessions in the backing session pool. The default is 100.", + DEFAULT_MIN_SESSIONS, + NonNegativeIntegerConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty MAX_SESSIONS = + create( + MAX_SESSIONS_PROPERTY_NAME, + "The maximum number of sessions in the backing session pool. The default is 400.", + DEFAULT_MAX_SESSIONS, + NonNegativeIntegerConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty NUM_CHANNELS = + create( + NUM_CHANNELS_PROPERTY_NAME, + "The number of gRPC channels to use to communicate with Cloud Spanner. The default is 4.", + DEFAULT_NUM_CHANNELS, + NonNegativeIntegerConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty CHANNEL_PROVIDER = + create( + CHANNEL_PROVIDER_PROPERTY_NAME, + "The name of the channel provider class. The name must reference an implementation of ExternalChannelProvider. If this property is not set, the connection will use the default grpc channel provider.", + DEFAULT_CHANNEL_PROVIDER, + StringValueConverter.INSTANCE, + Context.STARTUP); + static final ConnectionProperty DATABASE_ROLE = + create( + DATABASE_ROLE_PROPERTY_NAME, + "Sets the database role to use for this connection. The default is privileges assigned to IAM role", + DEFAULT_DATABASE_ROLE, + StringValueConverter.INSTANCE, + Context.STARTUP); + + static final ConnectionProperty AUTOCOMMIT = + create( + AUTOCOMMIT_PROPERTY_NAME, + "Should the connection start in autocommit (true/false)", + DEFAULT_AUTOCOMMIT, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty READONLY = + create( + READONLY_PROPERTY_NAME, + "Should the connection start in read-only mode (true/false)", + DEFAULT_READONLY, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty AUTOCOMMIT_DML_MODE = + create( + "autocommit_dml_mode", + "Should the connection automatically retry Aborted errors (true/false)", + AutocommitDmlMode.TRANSACTIONAL, + AutocommitDmlModeConverter.INSTANCE, + Context.USER); + static final ConnectionProperty RETRY_ABORTS_INTERNALLY = + create( + // TODO: Add support for synonyms for connection properties. + // retryAbortsInternally / retry_aborts_internally is currently not consistent. + // The connection URL property is retryAbortsInternally. The SET statement assumes + // that the property name is retry_aborts_internally. We should support both to be + // backwards compatible, but the standard should be snake_case. + RETRY_ABORTS_INTERNALLY_PROPERTY_NAME, + "Should the connection automatically retry Aborted errors (true/false)", + DEFAULT_RETRY_ABORTS_INTERNALLY, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty RETURN_COMMIT_STATS = + create( + "returnCommitStats", + "Request that Spanner returns commit statistics for read/write transactions (true/false)", + DEFAULT_RETURN_COMMIT_STATS, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE = + create( + DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE_NAME, + "Enabling this option will delay the actual start of a read/write transaction until the first write operation is seen in that transaction. " + + "All reads that happen before the first write in a transaction will instead be executed as if the connection was in auto-commit mode. " + + "Enabling this option will make read/write transactions lose their SERIALIZABLE isolation level. Read operations that are executed after " + + "the first write operation in a read/write transaction will be executed using the read/write transaction. Enabling this mode can reduce locking " + + "and improve performance for applications that can handle the lower transaction isolation semantics.", + DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty KEEP_TRANSACTION_ALIVE = + create( + KEEP_TRANSACTION_ALIVE_PROPERTY_NAME, + "Enabling this option will trigger the connection to keep read/write transactions alive by executing a SELECT 1 query once every 10 seconds " + + "if no other statements are being executed. This option should be used with caution, as it can keep transactions alive and hold on to locks " + + "longer than intended. This option should typically be used for CLI-type application that might wait for user input for a longer period of time.", + DEFAULT_KEEP_TRANSACTION_ALIVE, + BooleanConverter.INSTANCE, + Context.USER); + + static final ConnectionProperty READ_ONLY_STALENESS = + create( + "read_only_staleness", + "The read-only staleness to use for read-only transactions and single-use queries.", + TimestampBound.strong(), + ReadOnlyStalenessConverter.INSTANCE, + Context.USER); + static final ConnectionProperty AUTO_PARTITION_MODE = + create( + AUTO_PARTITION_MODE_PROPERTY_NAME, + "Execute all queries on this connection as partitioned queries. " + + "Executing a query that cannot be partitioned will fail. " + + "Executing a query in a read/write transaction will also fail.", + DEFAULT_AUTO_PARTITION_MODE, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty DATA_BOOST_ENABLED = + create( + DATA_BOOST_ENABLED_PROPERTY_NAME, + "Enable data boost for all partitioned queries that are executed by this connection. " + + "This setting is only used for partitioned queries and is ignored by all other statements.", + DEFAULT_DATA_BOOST_ENABLED, + BooleanConverter.INSTANCE, + Context.USER); + static final ConnectionProperty MAX_PARTITIONS = + create( + MAX_PARTITIONS_PROPERTY_NAME, + "The max partitions hint value to use for partitioned queries. " + + "Use 0 if you do not want to specify a hint.", + DEFAULT_MAX_PARTITIONS, + NonNegativeIntegerConverter.INSTANCE, + Context.USER); + static final ConnectionProperty MAX_PARTITIONED_PARALLELISM = + create( + MAX_PARTITIONED_PARALLELISM_PROPERTY_NAME, + "The max partitions hint value to use for partitioned queries. " + + "Use 0 if you do not want to specify a hint.", + DEFAULT_MAX_PARTITIONED_PARALLELISM, + NonNegativeIntegerConverter.INSTANCE, + Context.USER); + + static final ConnectionProperty DIRECTED_READ = + create( + "directed_read", + "The directed read options to apply to read-only transactions.", + null, + DirectedReadOptionsConverter.INSTANCE, + Context.USER); + static final ConnectionProperty OPTIMIZER_VERSION = + create( + OPTIMIZER_VERSION_PROPERTY_NAME, + "Sets the default query optimizer version to use for this connection.", + DEFAULT_OPTIMIZER_VERSION, + StringValueConverter.INSTANCE, + Context.USER); + static final ConnectionProperty OPTIMIZER_STATISTICS_PACKAGE = + create( + OPTIMIZER_STATISTICS_PACKAGE_PROPERTY_NAME, + "Sets the query optimizer statistics package to use for this connection.", + DEFAULT_OPTIMIZER_STATISTICS_PACKAGE, + StringValueConverter.INSTANCE, + Context.USER); + static final ConnectionProperty RPC_PRIORITY = + create( + RPC_PRIORITY_NAME, + "Sets the priority for all RPC invocations from this connection (HIGH/MEDIUM/LOW). The default is HIGH.", + DEFAULT_RPC_PRIORITY, + RpcPriorityConverter.INSTANCE, + Context.USER); + static final ConnectionProperty SAVEPOINT_SUPPORT = + create( + "savepoint_support", + "Determines the behavior of the connection when savepoints are used.", + SavepointSupport.FAIL_AFTER_ROLLBACK, + SavepointSupportConverter.INSTANCE, + Context.USER); + static final ConnectionProperty DDL_IN_TRANSACTION_MODE = + create( + DDL_IN_TRANSACTION_MODE_PROPERTY_NAME, + "Determines how the connection should handle DDL statements in a read/write transaction.", + DEFAULT_DDL_IN_TRANSACTION_MODE, + DdlInTransactionModeConverter.INSTANCE, + Context.USER); + static final ConnectionProperty MAX_COMMIT_DELAY = + create( + "maxCommitDelay", + "The max delay that Spanner may apply to commit requests to improve throughput.", + null, + DurationConverter.INSTANCE, + Context.USER); + + static final Map> CONNECTION_PROPERTIES = + CONNECTION_PROPERTIES_BUILDER.build(); + + /** Utility method for creating a new core {@link ConnectionProperty}. */ + private static ConnectionProperty create( + String name, + String description, + T defaultValue, + ClientSideStatementValueConverter converter, + Context context) { + ConnectionProperty property = + ConnectionProperty.create(name, description, defaultValue, converter, context); + CONNECTION_PROPERTIES_BUILDER.put(property.getKey(), property); + return property; + } + + /** Parse the connection properties that can be found in the given connection URL. */ + static ImmutableMap> parseValues(String url) { + ImmutableMap.Builder> builder = ImmutableMap.builder(); + for (ConnectionProperty property : CONNECTION_PROPERTIES.values()) { + ConnectionPropertyValue value = parseValue(castProperty(property), url); + if (value != null) { + builder.put(property.getKey(), value); + } + } + return builder.build(); + } + + /** + * Parse and convert the value of the specific connection property from a connection URL (e.g. + * readonly=true). + */ + private static ConnectionPropertyValue parseValue( + ConnectionProperty property, String url) { + String stringValue = ConnectionOptions.parseUriProperty(url, property.getKey()); + return property.convert(stringValue); + } + + /** This class should not be instantiated. */ + private ConnectionProperties() {} +} diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java new file mode 100644 index 00000000000..c203d44203b --- /dev/null +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperty.java @@ -0,0 +1,197 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import com.google.cloud.spanner.ErrorCode; +import com.google.cloud.spanner.SpannerExceptionFactory; +import com.google.common.base.Strings; +import java.util.Locale; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * {@link ConnectionProperty} is a variable for a connection. The total set of connection properties + * is the state of a connection, and determine the behavior of that connection. For example, a + * connection with a {@link ConnectionProperty} READONLY=true and AUTOCOMMIT=false will use + * read-only transactions by default, while a connection with READONLY=false and AUTOCOMMIT=false + * will use read/write transactions. + * + *

Connection properties are stored in a {@link ConnectionState} instance. {@link + * ConnectionState} can be transactional. That is; changes to a connection property during a + * transaction will be undone if the transaction is rolled back. Transactional connection state is + * the default for PostgreSQL-dialect databases. For GoogleSQL-dialect databases, transactional + * connection state is an opt-in. + */ +public class ConnectionProperty { + /** + * Context indicates when a {@link ConnectionProperty} may be set. Each higher-ordinal value + * includes the preceding values, meaning that a {@link ConnectionProperty} with {@link + * Context#USER} can be set both at connection startup and during the connection's lifetime. + */ + enum Context { + /** The property can only be set at startup of the connection. */ + STARTUP, + /** + * The property can be set at startup or by a user during the lifetime of a connection. The + * value is persisted until it is changed again by the user. + */ + USER, + } + + /** Utility method for doing an unchecked cast to a typed {@link ConnectionProperty}. */ + static ConnectionProperty castProperty(ConnectionProperty property) { + //noinspection unchecked + return (ConnectionProperty) property; + } + + /** + * Utility method for creating a key for a {@link ConnectionProperty}. The key of a property is + * always lower-case and consists of '[extension.]name'. + */ + @Nonnull + static String createKey(String extension, @Nonnull String name) { + ConnectionPreconditions.checkArgument( + !Strings.isNullOrEmpty(name), "property name must be a non-empty string"); + return extension == null + ? name.toLowerCase(Locale.ENGLISH) + : extension.toLowerCase(Locale.ENGLISH) + "." + name.toLowerCase(Locale.ENGLISH); + } + + /** Utility method for creating a typed {@link ConnectionProperty}. */ + @Nonnull + static ConnectionProperty create( + @Nonnull String name, + String description, + T defaultValue, + ClientSideStatementValueConverter converter, + Context context) { + return new ConnectionProperty<>( + null, name, description, defaultValue, null, converter, context); + } + + /** + * The 'extension' of this property. This is (currently) only used for PostgreSQL-dialect + * databases. + */ + private final String extension; + + @Nonnull private final String name; + + @Nonnull private final String key; + + @Nonnull private final String description; + + private final T defaultValue; + + private final T[] validValues; + + private final ClientSideStatementValueConverter converter; + + private final Context context; + + ConnectionProperty( + String extension, + @Nonnull String name, + @Nonnull String description, + T defaultValue, + T[] validValues, + ClientSideStatementValueConverter converter, + Context context) { + ConnectionPreconditions.checkArgument( + !Strings.isNullOrEmpty(name), "property name must be a non-empty string"); + ConnectionPreconditions.checkArgument( + !Strings.isNullOrEmpty(description), "property description must be a non-empty string"); + this.extension = extension == null ? null : extension.toLowerCase(Locale.ENGLISH); + this.name = name.toLowerCase(Locale.ENGLISH); + this.description = description; + this.defaultValue = defaultValue; + this.validValues = validValues; + this.converter = converter; + this.context = context; + this.key = createKey(this.extension, this.name); + } + + @Override + public String toString() { + return this.key; + } + + @Override + public int hashCode() { + return this.key.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ConnectionProperty)) { + return false; + } + ConnectionProperty other = (ConnectionProperty) o; + return this.key.equals(other.key); + } + + ConnectionPropertyValue createInitialValue(@Nullable ConnectionPropertyValue initialValue) { + return initialValue == null + ? new ConnectionPropertyValue<>(this, this.defaultValue, this.defaultValue) + : initialValue.copy(); + } + + @Nullable + ConnectionPropertyValue convert(@Nullable String stringValue) { + if (stringValue == null) { + return null; + } + T convertedValue = this.converter.convert(stringValue); + if (convertedValue == null) { + throw SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, "Invalid value for property " + this + ": " + stringValue); + } + return new ConnectionPropertyValue<>(this, convertedValue, convertedValue); + } + + String getKey() { + return this.key; + } + + boolean hasExtension() { + return this.extension != null; + } + + String getExtension() { + return this.extension; + } + + String getName() { + return this.name; + } + + String getDescription() { + return this.description; + } + + T getDefaultValue() { + return this.defaultValue; + } + + T[] getValidValues() { + return this.validValues; + } + + Context getContext() { + return this.context; + } +} diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionPropertyValue.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionPropertyValue.java new file mode 100644 index 00000000000..088a28d9d8a --- /dev/null +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionPropertyValue.java @@ -0,0 +1,80 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import java.util.Objects; + +class ConnectionPropertyValue { + static ConnectionPropertyValue cast(ConnectionPropertyValue value) { + //noinspection unchecked + return (ConnectionPropertyValue) value; + } + + private final ConnectionProperty property; + private final T resetValue; + + private T value; + + ConnectionPropertyValue(ConnectionProperty property, T resetValue, T value) { + this.property = property; + this.resetValue = resetValue; + this.value = value; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof ConnectionPropertyValue)) { + return false; + } + ConnectionPropertyValue other = cast((ConnectionPropertyValue) o); + return Objects.equals(this.property, other.property) + && Objects.equals(this.resetValue, other.resetValue) + && Objects.equals(this.value, other.value); + } + + @Override + public int hashCode() { + return Objects.hash(this.property, this.resetValue, this.value); + } + + ConnectionProperty getProperty() { + return property; + } + + T getResetValue() { + return resetValue; + } + + T getValue() { + return value; + } + + void setValue(T value, Context context) { + ConnectionPreconditions.checkState( + property.getContext().ordinal() >= context.ordinal(), + "Property has context " + + property.getContext() + + " and cannot be set in context " + + context); + this.value = value; + } + + ConnectionPropertyValue copy() { + return new ConnectionPropertyValue<>(this.property, this.resetValue, this.value); + } +} diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionState.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionState.java new file mode 100644 index 00000000000..b732d617c22 --- /dev/null +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionState.java @@ -0,0 +1,282 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static com.google.cloud.spanner.connection.ConnectionProperties.CONNECTION_PROPERTIES; +import static com.google.cloud.spanner.connection.ConnectionProperties.CONNECTION_STATE_TYPE; +import static com.google.cloud.spanner.connection.ConnectionProperty.castProperty; +import static com.google.cloud.spanner.connection.ConnectionPropertyValue.cast; + +import com.google.cloud.spanner.ErrorCode; +import com.google.cloud.spanner.SpannerException; +import com.google.cloud.spanner.SpannerExceptionFactory; +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Suppliers; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.Supplier; +import javax.annotation.Nullable; + +class ConnectionState { + /** The type of connection state that is used. */ + enum Type { + /** + * Transactional connection state will roll back changes to connection properties that have been + * done during a transaction if the transaction is rolled back. + */ + TRANSACTIONAL, + /** + * Non-transactional connection state directly applies connection property changes during + * transactions to the main set of properties. Note that non-transactional connection state does + * support local properties. These are property changes that are only visible during the current + * transaction, and that are lost after committing or rolling back the current transaction. + */ + NON_TRANSACTIONAL, + } + + private final Object lock = new Object(); + + private final Supplier type; + + /** properties contain the current connection properties of a connection. */ + private final Map> properties; + + /** + * transactionProperties are the modified connection properties during a transaction. This is only + * used for {@link ConnectionState} that is marked as {@link Type#TRANSACTIONAL}. + */ + private Map> transactionProperties; + /** localProperties are the modified local properties during a transaction. */ + private Map> localProperties; + + /** Constructs a non-transactional {@link ConnectionState} with the given initial values. */ + ConnectionState(Map> initialValues) { + this(initialValues, Suppliers.ofInstance(Type.NON_TRANSACTIONAL)); + } + + /** + * Constructs a {@link ConnectionState} with the given initial values. The type will be + * transactional or non-transactional based on the value that is returned by the given supplier. + * The type is determined lazily to allow connections to determine the default based on the + * dialect, and the dialect is not known directly when a connection is created. + */ + ConnectionState( + Map> initialValues, + Supplier defaultConnectionStateTypeSupplier) { + this.properties = new HashMap<>(CONNECTION_PROPERTIES.size()); + for (Entry> entry : CONNECTION_PROPERTIES.entrySet()) { + this.properties.put( + entry.getKey(), + entry.getValue().createInitialValue(cast(initialValues.get(entry.getKey())))); + } + // Add any additional non-core values from the options. + for (Entry> entry : initialValues.entrySet()) { + if (!this.properties.containsKey(entry.getKey())) { + setValue( + castProperty(entry.getValue().getProperty()), + cast(entry.getValue()).getValue(), + Context.STARTUP, + /* inTransaction = */ false); + } + } + Type configuredType = getValue(CONNECTION_STATE_TYPE).getValue(); + if (configuredType == null) { + this.type = defaultConnectionStateTypeSupplier; + } else { + this.type = Suppliers.ofInstance(configuredType); + } + } + + @VisibleForTesting + Type getType() { + return this.type.get(); + } + + boolean hasTransactionalChanges() { + synchronized (lock) { + return this.transactionProperties != null || this.localProperties != null; + } + } + + /** + * Returns an unmodifiable map with all the property values of this {@link ConnectionState}. The + * map cannot be modified, but any changes to the current (committed) state will be reflected in + * the map that is returned by this method. + */ + Map> getAllValues() { + synchronized (lock) { + return Collections.unmodifiableMap(this.properties); + } + } + + /** Returns the current value of the specified setting. */ + ConnectionPropertyValue getValue(ConnectionProperty property) { + synchronized (lock) { + return internalGetValue(property, true); + } + } + + /** Returns the current value of the specified setting or null if undefined. */ + @Nullable + ConnectionPropertyValue tryGetValue(ConnectionProperty property) { + synchronized (lock) { + return internalGetValue(property, false); + } + } + + private ConnectionPropertyValue internalGetValue( + ConnectionProperty property, boolean throwForUnknownParam) { + if (localProperties != null && localProperties.containsKey(property.getKey())) { + return cast(localProperties.get(property.getKey())); + } + if (transactionProperties != null && transactionProperties.containsKey(property.getKey())) { + return cast(transactionProperties.get(property.getKey())); + } + if (properties.containsKey(property.getKey())) { + return cast(properties.get(property.getKey())); + } + if (throwForUnknownParam) { + throw unknownParamError(property); + } + return null; + } + + /** + * Sets the value of the specified property. The new value will be persisted if the current + * transaction is committed or directly if the connection state is non-transactional. The value + * will be lost if the transaction is rolled back and the connection state is transactional. + */ + void setValue( + ConnectionProperty property, T value, Context context, boolean inTransaction) { + ConnectionPreconditions.checkState( + property.getContext().ordinal() >= context.ordinal(), + "Property has context " + + property.getContext() + + " and cannot be set in context " + + context); + synchronized (lock) { + if (!inTransaction + || getType() == Type.NON_TRANSACTIONAL + || context.ordinal() < Context.USER.ordinal()) { + internalSetValue(property, value, properties, context); + return; + } + + if (transactionProperties == null) { + transactionProperties = new HashMap<>(); + } + internalSetValue(property, value, transactionProperties, context); + // Remove the setting from the local settings if it's there, as the new transaction setting is + // the one that should be used. + if (localProperties != null) { + localProperties.remove(property.getKey()); + } + } + } + + /** + * Sets the value of the specified setting for the current transaction. This value is lost when + * the transaction is committed or rolled back. This can be used to temporarily set a value only + * during a transaction, for example if a user wants to disable internal transaction retries only + * for a single transaction. + */ + void setLocalValue(ConnectionProperty property, T value) { + ConnectionPreconditions.checkState( + property.getContext().ordinal() >= Context.USER.ordinal(), + "setLocalValue is only supported for properties with context USER or higher."); + synchronized (lock) { + if (localProperties == null) { + localProperties = new HashMap<>(); + } + // Note that setting a local setting does not remove it from the transaction settings. This + // means that a commit will persist the setting in transactionSettings. + internalSetValue(property, value, localProperties, Context.USER); + } + } + + /** + * Resets the value of the specified property. The new value will be persisted if the current + * transaction is committed or directly if the connection state is non-transactional. The value + * will be lost if the transaction is rolled back and the connection state is transactional. + */ + void resetValue(ConnectionProperty property, Context context, boolean inTransaction) { + synchronized (lock) { + ConnectionPropertyValue currentValue = getValue(property); + if (currentValue == null) { + setValue(property, null, context, inTransaction); + } else { + setValue(property, currentValue.getResetValue(), context, inTransaction); + } + } + } + + /** Persists the new value for a property to the given map of properties. */ + private void internalSetValue( + ConnectionProperty property, + T value, + Map> currentProperties, + Context context) { + ConnectionPropertyValue newValue = cast(currentProperties.get(property.getKey())); + if (newValue == null) { + ConnectionPropertyValue existingValue = cast(properties.get(property.getKey())); + if (existingValue == null) { + if (!property.hasExtension()) { + throw unknownParamError(property); + } + newValue = new ConnectionPropertyValue(property, null, null); + } else { + newValue = existingValue.copy(); + } + } + newValue.setValue(value, context); + currentProperties.put(property.getKey(), newValue); + } + + /** Creates an exception for an unknown connection property. */ + static SpannerException unknownParamError(ConnectionProperty property) { + return SpannerExceptionFactory.newSpannerException( + ErrorCode.INVALID_ARGUMENT, + String.format("unrecognized configuration property \"%s\"", property)); + } + + /** + * Commits the current transaction and persists any changes to the settings (except local + * changes). + */ + void commit() { + synchronized (lock) { + if (transactionProperties != null) { + for (ConnectionPropertyValue value : transactionProperties.values()) { + properties.put(value.getProperty().getKey(), value); + } + } + this.localProperties = null; + this.transactionProperties = null; + } + } + + /** Rolls back the current transaction and abandons any pending changes to the settings. */ + void rollback() { + synchronized (lock) { + this.localProperties = null; + this.transactionProperties = null; + } + } +} diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DdlBatch.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DdlBatch.java index 4c8a0542696..6ae28822473 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DdlBatch.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DdlBatch.java @@ -45,6 +45,7 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.Callable; +import javax.annotation.Nonnull; /** * {@link UnitOfWork} that is used when a DDL batch is started. These batches only accept DDL @@ -298,13 +299,15 @@ public void abortBatch() { } @Override - public ApiFuture commitAsync(CallType callType) { + public ApiFuture commitAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.FAILED_PRECONDITION, "Commit is not allowed for DDL batches."); } @Override - public ApiFuture rollbackAsync(CallType callType) { + public ApiFuture rollbackAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.FAILED_PRECONDITION, "Rollback is not allowed for DDL batches."); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectedReadOptionsUtil.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectedReadOptionsUtil.java index 8b1f8a90199..8b346a08f3d 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectedReadOptionsUtil.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DirectedReadOptionsUtil.java @@ -23,6 +23,25 @@ import com.google.spanner.v1.DirectedReadOptions; public class DirectedReadOptionsUtil { + static class DirectedReadOptionsConverter + implements ClientSideStatementValueConverter { + static DirectedReadOptionsConverter INSTANCE = new DirectedReadOptionsConverter(); + + @Override + public Class getParameterClass() { + return DirectedReadOptions.class; + } + + @Override + public DirectedReadOptions convert(String value) { + try { + return parse(value); + } catch (Throwable ignore) { + // ClientSideStatementValueConverters should return null if the value cannot be converted. + return null; + } + } + } /** * Generates a valid JSON string for the given {@link DirectedReadOptions} that can be used with diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DmlBatch.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DmlBatch.java index fde3c609cb3..ea7732a7c0a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DmlBatch.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/DmlBatch.java @@ -36,6 +36,7 @@ import io.opentelemetry.context.Scope; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; /** * {@link UnitOfWork} that is used when a DML batch is started. These batches only accept DML @@ -257,13 +258,15 @@ public void abortBatch() { } @Override - public ApiFuture commitAsync(CallType callType) { + public ApiFuture commitAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.FAILED_PRECONDITION, "Commit is not allowed for DML batches."); } @Override - public ApiFuture rollbackAsync(CallType callType) { + public ApiFuture rollbackAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.FAILED_PRECONDITION, "Rollback is not allowed for DML batches."); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadOnlyTransaction.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadOnlyTransaction.java index ea4a11a4cd1..357503cb17f 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadOnlyTransaction.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadOnlyTransaction.java @@ -39,6 +39,7 @@ import com.google.spanner.v1.SpannerGrpc; import io.opentelemetry.context.Scope; import java.util.concurrent.Callable; +import javax.annotation.Nonnull; /** * Transaction that is used when a {@link Connection} is in read-only mode or when the transaction @@ -241,20 +242,30 @@ public ApiFuture writeAsync(CallType callType, Iterable mutation } @Override - public ApiFuture commitAsync(CallType callType) { + public ApiFuture commitAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { try (Scope ignore = span.makeCurrent()) { ApiFuture result = closeTransactions(); + callback.onSuccess(); this.state = UnitOfWorkState.COMMITTED; return result; + } catch (Throwable throwable) { + callback.onFailure(); + throw throwable; } } @Override - public ApiFuture rollbackAsync(CallType callType) { + public ApiFuture rollbackAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { try (Scope ignore = span.makeCurrent()) { ApiFuture result = closeTransactions(); + callback.onSuccess(); this.state = UnitOfWorkState.ROLLED_BACK; return result; + } catch (Throwable throwable) { + callback.onFailure(); + throw throwable; } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java index d047857d6ad..6a83142b175 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ReadWriteTransaction.java @@ -78,6 +78,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; +import javax.annotation.Nonnull; /** * Transaction that is used when a {@link Connection} is normal read/write mode (i.e. not autocommit @@ -861,7 +862,8 @@ public Void call() { }; @Override - public ApiFuture commitAsync(CallType callType) { + public ApiFuture commitAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { try (Scope ignore = span.makeCurrent()) { checkOrCreateValidTransaction(COMMIT_STATEMENT, callType); cancelScheduledKeepAlivePing(); @@ -871,11 +873,11 @@ public ApiFuture commitAsync(CallType callType) { // Check if this transaction actually needs to commit anything. if (txContextFuture == null) { // No actual transaction was started by this read/write transaction, which also means that - // we - // don't have to commit anything. + // we don't have to commit anything. commitResponseFuture.set( new CommitResponse( Timestamp.fromProto(com.google.protobuf.Timestamp.getDefaultInstance()))); + callback.onSuccess(); state = UnitOfWorkState.COMMITTED; res = SettableApiFuture.create(); ((SettableApiFuture) res).set(null); @@ -887,17 +889,21 @@ public ApiFuture commitAsync(CallType callType) { () -> { checkTimedOut(); try { - return runWithRetry( - () -> { - getStatementExecutor() - .invokeInterceptors( - COMMIT_STATEMENT, - StatementExecutionStep.EXECUTE_STATEMENT, - ReadWriteTransaction.this); - return commitCallable.call(); - }); + Void result = + runWithRetry( + () -> { + getStatementExecutor() + .invokeInterceptors( + COMMIT_STATEMENT, + StatementExecutionStep.EXECUTE_STATEMENT, + ReadWriteTransaction.this); + return commitCallable.call(); + }); + callback.onSuccess(); + return result; } catch (Throwable t) { commitResponseFuture.setException(t); + callback.onFailure(); state = UnitOfWorkState.COMMIT_FAILED; try { txManager.close(); @@ -917,9 +923,12 @@ public ApiFuture commitAsync(CallType callType) { () -> { checkTimedOut(); try { - return commitCallable.call(); + Void result = commitCallable.call(); + callback.onSuccess(); + return result; } catch (Throwable t) { commitResponseFuture.setException(t); + callback.onFailure(); state = UnitOfWorkState.COMMIT_FAILED; try { txManager.close(); @@ -1220,9 +1229,14 @@ public Void call() { }; @Override - public ApiFuture rollbackAsync(CallType callType) { + public ApiFuture rollbackAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { try (Scope ignore = span.makeCurrent()) { + callback.onSuccess(); return rollbackAsync(callType, true); + } catch (Throwable throwable) { + callback.onFailure(); + throw throwable; } } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java index 44f20ccdbd8..53a1bb03b10 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SingleUseTransaction.java @@ -57,6 +57,7 @@ import java.time.Duration; import java.util.Arrays; import java.util.concurrent.Callable; +import javax.annotation.Nonnull; /** * Transaction that is used when a {@link Connection} is in autocommit mode. Each method on this @@ -682,13 +683,15 @@ public ApiFuture writeAsync(CallType callType, final Iterable mu } @Override - public ApiFuture commitAsync(CallType callType) { + public ApiFuture commitAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.FAILED_PRECONDITION, "Commit is not supported for single-use transactions"); } @Override - public ApiFuture rollbackAsync(CallType callType) { + public ApiFuture rollbackAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.FAILED_PRECONDITION, "Rollback is not supported for single-use transactions"); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/UnitOfWork.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/UnitOfWork.java index 9a5e9197245..ffa93d486e1 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/UnitOfWork.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/UnitOfWork.java @@ -66,6 +66,24 @@ public boolean isActive() { } } + /** + * Callback for end-of-transaction methods. This is used to commit or rollback connection state + * after an async commit/rollback of a database transaction. + */ + interface EndTransactionCallback { + /** + * This method will be called if the end-of-transaction method (commit or rollback) finished + * successfully, but before the {@link ApiFuture} that is returned by the method is done. + */ + void onSuccess(); + + /** + * This method will be called if the end-of-transaction method (commit or rollback) failed, but + * before the {@link ApiFuture} that is returned by the method is done. + */ + void onFailure(); + } + /** Cancel the currently running statement (if any and the statement may be cancelled). */ void cancel(); @@ -90,9 +108,10 @@ public boolean isActive() { * a {@link Type#BATCH}. * * @param callType Indicates whether the top-level call is a sync or async call. + * @param callback Callback that should be called when the commit succeeded or failed. * @return An {@link ApiFuture} that is done when the commit has finished. */ - ApiFuture commitAsync(CallType callType); + ApiFuture commitAsync(@Nonnull CallType callType, @Nonnull EndTransactionCallback callback); /** * Rollbacks any changes in this unit of work. For read-only transactions, this only closes the @@ -100,9 +119,11 @@ public boolean isActive() { * Type#BATCH}. * * @param callType Indicates whether the top-level call is a sync or async call. + * @param callback Callback that should be called when the rollback succeeded or failed. * @return An {@link ApiFuture} that is done when the rollback has finished. */ - ApiFuture rollbackAsync(CallType callType); + ApiFuture rollbackAsync( + @Nonnull CallType callType, @Nonnull EndTransactionCallback callback); /** @see Connection#savepoint(String) */ void savepoint(@Nonnull String name, @Nonnull Dialect dialect); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionImplTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionImplTest.java index 299205bafc6..f118a77edbc 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionImplTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionImplTest.java @@ -78,6 +78,7 @@ import com.google.cloud.spanner.connection.StatementResult.ResultType; import com.google.cloud.spanner.connection.UnitOfWork.CallType; import com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.io.ByteStreams; import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata; @@ -209,6 +210,7 @@ private static ResultSet createSelect1MockResultSet() { when(mockResultSet.next()).thenReturn(true, false); when(mockResultSet.getLong(0)).thenReturn(1L); when(mockResultSet.getLong("TEST")).thenReturn(1L); + when(mockResultSet.getType()).thenReturn(Type.struct()); when(mockResultSet.getColumnType(0)).thenReturn(Type.int64()); when(mockResultSet.getColumnType("TEST")).thenReturn(Type.int64()); return mockResultSet; @@ -1524,6 +1526,7 @@ public void testAddRemoveTransactionRetryListener() { @Test public void testMergeQueryOptions() { ConnectionOptions connectionOptions = mock(ConnectionOptions.class); + when(connectionOptions.getInitialConnectionPropertyValues()).thenReturn(ImmutableMap.of()); SpannerPool spannerPool = mock(SpannerPool.class); DdlClient ddlClient = mock(DdlClient.class); DatabaseClient dbClient = mock(DatabaseClient.class); @@ -1633,6 +1636,7 @@ UnitOfWork getCurrentUnitOfWorkOrStartNewUnitOfWork(boolean isInternalMetadataQu public void testStatementTagAlwaysAllowed() { ConnectionOptions connectionOptions = mock(ConnectionOptions.class); when(connectionOptions.isAutocommit()).thenReturn(true); + when(connectionOptions.getInitialConnectionPropertyValues()).thenReturn(ImmutableMap.of()); SpannerPool spannerPool = mock(SpannerPool.class); DdlClient ddlClient = mock(DdlClient.class); DatabaseClient dbClient = mock(DatabaseClient.class); @@ -1677,6 +1681,7 @@ UnitOfWork getCurrentUnitOfWorkOrStartNewUnitOfWork(boolean isInternalMetadataQu public void testTransactionTagAllowedInTransaction() { ConnectionOptions connectionOptions = mock(ConnectionOptions.class); when(connectionOptions.isAutocommit()).thenReturn(false); + when(connectionOptions.getInitialConnectionPropertyValues()).thenReturn(ImmutableMap.of()); SpannerPool spannerPool = mock(SpannerPool.class); DdlClient ddlClient = mock(DdlClient.class); DatabaseClient dbClient = mock(DatabaseClient.class); @@ -1719,6 +1724,7 @@ connectionOptions, spannerPool, ddlClient, dbClient, mock(BatchClient.class))) { public void testTransactionTagNotAllowedWithoutTransaction() { ConnectionOptions connectionOptions = mock(ConnectionOptions.class); when(connectionOptions.isAutocommit()).thenReturn(true); + when(connectionOptions.getInitialConnectionPropertyValues()).thenReturn(ImmutableMap.of()); SpannerPool spannerPool = mock(SpannerPool.class); DdlClient ddlClient = mock(DdlClient.class); DatabaseClient dbClient = mock(DatabaseClient.class); @@ -1741,6 +1747,7 @@ connectionOptions, spannerPool, ddlClient, dbClient, mock(BatchClient.class))) { public void testTransactionTagNotAllowedAfterTransactionStarted() { ConnectionOptions connectionOptions = mock(ConnectionOptions.class); when(connectionOptions.isAutocommit()).thenReturn(false); + when(connectionOptions.getInitialConnectionPropertyValues()).thenReturn(ImmutableMap.of()); SpannerPool spannerPool = mock(SpannerPool.class); DdlClient ddlClient = mock(DdlClient.class); DatabaseClient dbClient = mock(DatabaseClient.class); @@ -1751,7 +1758,7 @@ public void testTransactionTagNotAllowedAfterTransactionStarted() { when(unitOfWork.executeQueryAsync( any(), any(ParsedStatement.class), any(AnalyzeMode.class), Mockito.any())) .thenReturn(ApiFutures.immediateFuture(mock(ResultSet.class))); - when(unitOfWork.rollbackAsync(any())).thenReturn(ApiFutures.immediateFuture(null)); + when(unitOfWork.rollbackAsync(any(), any())).thenReturn(ApiFutures.immediateFuture(null)); try (ConnectionImpl connection = new ConnectionImpl( connectionOptions, spannerPool, ddlClient, dbClient, mock(BatchClient.class)) { @@ -1881,37 +1888,37 @@ public void testSetRetryAbortsInternally() { .build())) { assertFalse("Read-only should be disabled by default", connection.isReadOnly()); assertTrue("Autocommit should be enabled by default", connection.isAutocommit()); - assertFalse( - "Retry aborts internally should be disabled by default on test connections", + assertTrue( + "Retry aborts internally should be enabled by default on test connections", connection.isRetryAbortsInternally()); // It should be possible to change this value also when in auto-commit mode. - connection.setRetryAbortsInternally(true); - assertTrue(connection.isRetryAbortsInternally()); + connection.setRetryAbortsInternally(false); + assertFalse(connection.isRetryAbortsInternally()); // It should be possible to change this value also when in transactional mode, as long as // there is no active transaction. connection.setAutocommit(false); - connection.setRetryAbortsInternally(false); - assertFalse(connection.isRetryAbortsInternally()); + connection.setRetryAbortsInternally(true); + assertTrue(connection.isRetryAbortsInternally()); // It should be possible to change the value when in read-only mode. connection.setReadOnly(true); - connection.setRetryAbortsInternally(true); - assertTrue(connection.isRetryAbortsInternally()); + connection.setRetryAbortsInternally(false); + assertFalse(connection.isRetryAbortsInternally()); // It should not be possible to change the value when there is an active transaction. connection.setReadOnly(false); connection.setAutocommit(false); connection.execute(Statement.of(SELECT)); - assertThrows(SpannerException.class, () -> connection.setRetryAbortsInternally(false)); + assertThrows(SpannerException.class, () -> connection.setRetryAbortsInternally(true)); // Verify that the value did not change. - assertTrue(connection.isRetryAbortsInternally()); + assertFalse(connection.isRetryAbortsInternally()); // Rolling back the connection should allow us to set the property again. connection.rollback(); - connection.setRetryAbortsInternally(false); - assertFalse(connection.isRetryAbortsInternally()); + connection.setRetryAbortsInternally(true); + assertTrue(connection.isRetryAbortsInternally()); } } @@ -1934,6 +1941,7 @@ private void assertThrowResultNotAllowed( public void testProtoDescriptorsAlwaysAllowed() { ConnectionOptions connectionOptions = mock(ConnectionOptions.class); when(connectionOptions.isAutocommit()).thenReturn(true); + when(connectionOptions.getInitialConnectionPropertyValues()).thenReturn(ImmutableMap.of()); SpannerPool spannerPool = mock(SpannerPool.class); DdlClient ddlClient = mock(DdlClient.class); DatabaseClient dbClient = mock(DatabaseClient.class); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyTest.java new file mode 100644 index 00000000000..0888f61cf90 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyTest.java @@ -0,0 +1,301 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static com.google.cloud.spanner.connection.ConnectionProperty.create; +import static com.google.cloud.spanner.connection.ConnectionProperty.createKey; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThrows; + +import com.google.cloud.spanner.SpannerException; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.NonNegativeIntegerConverter; +import com.google.cloud.spanner.connection.ClientSideStatementValueConverters.StringValueConverter; +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import java.util.Objects; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class ConnectionPropertyTest { + + @Test + public void testCreateKey() { + assertEquals("my_property", createKey(/* extension = */ null, "my_property")); + assertEquals("my_property", createKey(/* extension = */ null, "My_Property")); + assertEquals("my_property", createKey(/* extension = */ null, "MY_PROPERTY")); + assertEquals("my_extension.my_property", createKey("my_extension", "my_property")); + assertEquals("my_extension.my_property", createKey("My_Extension", "My_Property")); + assertEquals("my_extension.my_property", createKey("MY_EXTENSION", "MY_PROPERTY")); + + //noinspection DataFlowIssue + assertThrows(SpannerException.class, () -> createKey("my_extension", /* name = */ null)); + assertThrows(SpannerException.class, () -> createKey("my_extension", "")); + } + + @Test + public void testCreate() { + ConnectionProperty property = + create( + "my_property", + "Description of my_property", + "default_value", + StringValueConverter.INSTANCE, + Context.USER); + assertEquals("my_property", property.getName()); + assertEquals("Description of my_property", property.getDescription()); + assertEquals("default_value", property.getDefaultValue()); + assertEquals("my_value", Objects.requireNonNull(property.convert("my_value")).getValue()); + assertEquals(property.getContext(), Context.USER); + assertEquals("my_property", property.getKey()); + + ConnectionProperty startupProperty = + create( + "STARTUP_PROPERTY", + "Description of STARTUP_PROPERTY", + 1, + NonNegativeIntegerConverter.INSTANCE, + Context.STARTUP); + // The name is folded to lower-case. + assertEquals("startup_property", startupProperty.getName()); + assertEquals("Description of STARTUP_PROPERTY", startupProperty.getDescription()); + assertEquals(Integer.valueOf(1), startupProperty.getDefaultValue()); + assertEquals( + Integer.valueOf(2), Objects.requireNonNull(startupProperty.convert("2")).getValue()); + assertEquals(startupProperty.getContext(), Context.STARTUP); + assertEquals("startup_property", startupProperty.getKey()); + } + + @Test + public void testEquals() { + ConnectionProperty property1 = + new ConnectionProperty<>( + /* extension = */ null, + "my_property", + "Description of property1", + "default_value_1", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + ConnectionProperty property2 = + new ConnectionProperty<>( + /* extension = */ null, + "my_property", + "Description of property2", + "default_value_2", + null, + StringValueConverter.INSTANCE, + Context.USER); + ConnectionProperty property3 = + new ConnectionProperty<>( + "my_extension", + "my_property", + "Description of property3", + "default_value_3", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + ConnectionProperty property4 = + new ConnectionProperty<>( + "my_extension", + "my_property", + "Description of property4", + "default_value_4", + null, + StringValueConverter.INSTANCE, + Context.USER); + ConnectionProperty property5 = + new ConnectionProperty<>( + /* extension = */ null, + "my_other_property", + "Description of property5", + "default_value_5", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + ConnectionProperty property6 = + new ConnectionProperty<>( + "my_extension", + "my_other_property", + "Description of property6", + "default_value_6", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + ConnectionProperty property7 = + new ConnectionProperty<>( + /* extension = */ null, + "MY_PROPERTY", + "Description of property7", + "default_value_7", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + ConnectionProperty property8 = + new ConnectionProperty<>( + "MY_EXTENSION", + "my_property", + "Description of property8", + "default_value_8", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + ConnectionProperty property9 = + new ConnectionProperty<>( + "my_extension", + "MY_PROPERTY", + "Description of property9", + "default_value_9", + null, + StringValueConverter.INSTANCE, + Context.STARTUP); + + // Equality is based only on the key. + // The key is the lower case combination of extension and name. + // If extension is null, then only the name is the key. + + // property1 = my_property + assertEquals(property1, property2); + assertNotEquals(property1, property3); + assertNotEquals(property1, property4); + assertNotEquals(property1, property5); + assertNotEquals(property1, property6); + assertEquals(property1, property7); + assertNotEquals(property1, property8); + assertNotEquals(property1, property9); + + // property2 = my_property + assertEquals(property2, property1); + assertNotEquals(property2, property3); + assertNotEquals(property2, property4); + assertNotEquals(property2, property5); + assertNotEquals(property2, property6); + assertEquals(property2, property7); + assertNotEquals(property2, property8); + assertNotEquals(property2, property9); + + // property3 = my_extension.my_property + assertNotEquals(property3, property1); + assertNotEquals(property3, property2); + assertEquals(property3, property4); + assertNotEquals(property3, property5); + assertNotEquals(property3, property6); + assertNotEquals(property3, property7); + assertEquals(property3, property8); + assertEquals(property3, property9); + + // property4 = my_extension.my_property + assertNotEquals(property4, property1); + assertNotEquals(property4, property2); + assertEquals(property4, property3); + assertNotEquals(property4, property5); + assertNotEquals(property4, property6); + assertNotEquals(property4, property7); + assertEquals(property4, property8); + assertEquals(property4, property9); + + // property5 = my_other_property + assertNotEquals(property5, property1); + assertNotEquals(property5, property2); + assertNotEquals(property5, property3); + assertNotEquals(property5, property4); + assertNotEquals(property5, property6); + assertNotEquals(property5, property7); + assertNotEquals(property5, property8); + assertNotEquals(property5, property9); + + // property6 = my_extension.my_other_property + assertNotEquals(property6, property1); + assertNotEquals(property6, property2); + assertNotEquals(property6, property3); + assertNotEquals(property6, property4); + assertNotEquals(property6, property5); + assertNotEquals(property6, property7); + assertNotEquals(property6, property8); + assertNotEquals(property6, property9); + + // property7 = MY_PROPERTY (same as property1 and property2) + assertEquals(property7, property1); + assertEquals(property7, property2); + assertNotEquals(property7, property3); + assertNotEquals(property7, property4); + assertNotEquals(property7, property5); + assertNotEquals(property7, property6); + assertNotEquals(property7, property8); + assertNotEquals(property7, property9); + + // property8 = MY_EXTENSION.my_property (same as property4) + assertNotEquals(property8, property1); + assertNotEquals(property8, property2); + assertEquals(property8, property3); + assertEquals(property8, property4); + assertNotEquals(property8, property5); + assertNotEquals(property8, property6); + assertNotEquals(property8, property7); + assertEquals(property8, property9); + + // property9 = my_extension.MY_PROPERTY (same as property4 and property8) + assertNotEquals(property9, property1); + assertNotEquals(property9, property2); + assertEquals(property9, property3); + assertEquals(property9, property4); + assertNotEquals(property9, property5); + assertNotEquals(property9, property6); + assertNotEquals(property9, property7); + assertEquals(property9, property8); + } + + @Test + public void testConvert() { + ConnectionProperty property = + create( + "my_property", + "Description of my_property", + 1, + NonNegativeIntegerConverter.INSTANCE, + Context.STARTUP); + assertEquals(Integer.valueOf(100), Objects.requireNonNull(property.convert("100")).getValue()); + assertThrows(SpannerException.class, () -> property.convert("foo")); + assertThrows(SpannerException.class, () -> property.convert("-100")); + } + + @Test + public void testCreateInitialValue() { + ConnectionProperty property = + create( + "my_property", + "Description of my_property", + "default_value", + StringValueConverter.INSTANCE, + Context.USER); + + ConnectionPropertyValue initialValue = property.createInitialValue(null); + assertEquals(property.getDefaultValue(), initialValue.getValue()); + assertEquals(property.getDefaultValue(), initialValue.getResetValue()); + assertSame(initialValue.getProperty(), property); + + ConnectionPropertyValue startupValue = + new ConnectionPropertyValue<>(property, "other_value", "other_value"); + ConnectionPropertyValue initialValueWithStartupValue = + property.createInitialValue(startupValue); + assertEquals("other_value", initialValueWithStartupValue.getValue()); + assertEquals("other_value", initialValueWithStartupValue.getResetValue()); + assertSame(initialValueWithStartupValue.getProperty(), property); + } +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyValueTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyValueTest.java new file mode 100644 index 00000000000..d4f795185e4 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionPropertyValueTest.java @@ -0,0 +1,100 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTOCOMMIT_DML_MODE; +import static com.google.cloud.spanner.connection.ConnectionProperties.CONNECTION_STATE_TYPE; +import static com.google.cloud.spanner.connection.ConnectionProperties.READONLY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertThrows; + +import com.google.cloud.spanner.SpannerException; +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import com.google.cloud.spanner.connection.ConnectionState.Type; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class ConnectionPropertyValueTest { + + @Test + public void testSetValue() { + // This value can be set at any time. + ConnectionPropertyValue value = READONLY.createInitialValue(null); + assertEquals(READONLY.getDefaultValue(), value.getValue()); + + value.setValue(Boolean.FALSE, Context.STARTUP); + assertEquals(Boolean.FALSE, value.getValue()); + + value.setValue(Boolean.TRUE, Context.USER); + assertEquals(Boolean.TRUE, value.getValue()); + + value.setValue(Boolean.FALSE, Context.USER); + assertEquals(Boolean.FALSE, value.getValue()); + + // This value may only be set outside transactions. + ConnectionPropertyValue outsideTransactionOnlyValue = + AUTOCOMMIT_DML_MODE.createInitialValue(null); + assertEquals(AUTOCOMMIT_DML_MODE.getDefaultValue(), outsideTransactionOnlyValue.getValue()); + + outsideTransactionOnlyValue.setValue(AutocommitDmlMode.PARTITIONED_NON_ATOMIC, Context.STARTUP); + assertEquals(AutocommitDmlMode.PARTITIONED_NON_ATOMIC, outsideTransactionOnlyValue.getValue()); + + outsideTransactionOnlyValue.setValue(AutocommitDmlMode.TRANSACTIONAL, Context.USER); + assertEquals(AutocommitDmlMode.TRANSACTIONAL, outsideTransactionOnlyValue.getValue()); + + // This value may only be set at startup. + ConnectionPropertyValue startupOnlyValue = + CONNECTION_STATE_TYPE.createInitialValue(null); + assertEquals(CONNECTION_STATE_TYPE.getDefaultValue(), startupOnlyValue.getValue()); + + startupOnlyValue.setValue(Type.TRANSACTIONAL, Context.STARTUP); + assertEquals(Type.TRANSACTIONAL, startupOnlyValue.getValue()); + + // This property may not be set after startup.. + assertThrows( + SpannerException.class, + () -> startupOnlyValue.setValue(Type.NON_TRANSACTIONAL, Context.USER)); + // The value should not have changed. + assertEquals(Type.TRANSACTIONAL, startupOnlyValue.getValue()); + + // This property may not be set in a transaction. + assertThrows( + SpannerException.class, + () -> startupOnlyValue.setValue(Type.NON_TRANSACTIONAL, Context.USER)); + // The value should not have changed. + assertEquals(Type.TRANSACTIONAL, startupOnlyValue.getValue()); + } + + @Test + public void testCopy() { + ConnectionPropertyValue value = + new ConnectionPropertyValue<>( + /* property = */ AUTOCOMMIT_DML_MODE, + /* resetValue = */ AutocommitDmlMode.PARTITIONED_NON_ATOMIC, + /* value = */ AutocommitDmlMode.TRANSACTIONAL); + ConnectionPropertyValue copy = value.copy(); + + assertEquals(value, copy); + assertNotSame(value, copy); + assertEquals(value.getProperty(), copy.getProperty()); + assertEquals(value.getValue(), copy.getValue()); + assertEquals(value.getResetValue(), copy.getResetValue()); + } +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateMockServerTest.java new file mode 100644 index 00000000000..ea79a7132bf --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateMockServerTest.java @@ -0,0 +1,231 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static com.google.cloud.spanner.connection.ConnectionProperties.CONNECTION_STATE_TYPE; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import com.google.cloud.spanner.Dialect; +import com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult; +import com.google.cloud.spanner.connection.ConnectionState.Type; +import com.google.cloud.spanner.connection.ITAbstractSpannerTest.ITConnection; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class ConnectionStateMockServerTest extends AbstractMockServerTest { + + @Parameters(name = "dialect = {0})") + public static Object[] data() { + return Dialect.values(); + } + + @Parameter public Dialect dialect; + + private Dialect currentDialect; + + @BeforeClass + public static void enableTransactionalConnectionStateForPostgreSQL() { + System.setProperty( + ConnectionOptions.ENABLE_TRANSACTIONAL_CONNECTION_STATE_FOR_POSTGRESQL_PROPERTY, "true"); + } + + @AfterClass + public static void disableTransactionalConnectionStateForPostgreSQL() { + System.clearProperty( + ConnectionOptions.ENABLE_TRANSACTIONAL_CONNECTION_STATE_FOR_POSTGRESQL_PROPERTY); + } + + @Before + public void setupDialect() { + if (currentDialect != dialect) { + // Reset the dialect result. + SpannerPool.closeSpannerPool(); + mockSpanner.putStatementResult(StatementResult.detectDialectResult(dialect)); + currentDialect = dialect; + } + } + + @After + public void clearRequests() { + mockSpanner.clearRequests(); + } + + protected String getBaseUrl() { + return String.format( + "cloudspanner://localhost:%d/projects/proj/instances/inst/databases/db?usePlainText=true", + getPort()); + } + + ITConnection createConnection(ConnectionState.Type type) { + return createConnection(";" + CONNECTION_STATE_TYPE.getKey() + "=" + type.name()); + } + + @Test + public void testConnectionStateType() { + try (Connection connection = createConnection()) { + // The default ConnectionState.Type should depend on the dialect. + assertEquals( + dialect == Dialect.POSTGRESQL ? Type.TRANSACTIONAL : Type.NON_TRANSACTIONAL, + ((ConnectionImpl) connection).getConnectionStateType()); + } + // It should be possible to override the default ConnectionState.Type, irrespective of the + // database dialect. + try (Connection connection = createConnection(Type.TRANSACTIONAL)) { + assertEquals(Type.TRANSACTIONAL, ((ConnectionImpl) connection).getConnectionStateType()); + } + try (Connection connection = createConnection(Type.NON_TRANSACTIONAL)) { + assertEquals(Type.NON_TRANSACTIONAL, ((ConnectionImpl) connection).getConnectionStateType()); + } + } + + @Test + public void testAutocommitPersistsConnectionState() { + try (Connection connection = createConnection(";autocommit=true")) { + assertTrue(connection.isAutocommit()); + + assertEquals(AutocommitDmlMode.TRANSACTIONAL, connection.getAutocommitDmlMode()); + connection.setAutocommitDmlMode(AutocommitDmlMode.PARTITIONED_NON_ATOMIC); + assertEquals(AutocommitDmlMode.PARTITIONED_NON_ATOMIC, connection.getAutocommitDmlMode()); + } + } + + @Test + public void testNonTransactionalState_commitsAutomatically() { + try (Connection connection = + createConnection(";connection_state_type=non_transactional;autocommit=false")) { + assertEquals(((ConnectionImpl) connection).getConnectionStateType(), Type.NON_TRANSACTIONAL); + assertFalse(connection.isAutocommit()); + + // Verify the initial default value. + assertFalse(connection.isReturnCommitStats()); + + // Change the value and read it back in the same transaction. + connection.setReturnCommitStats(true); + assertTrue(connection.isReturnCommitStats()); + + // Rolling back should not have any impact on the connection state, as the connection state is + // non-transactional. + connection.rollback(); + assertTrue(connection.isReturnCommitStats()); + + // Verify that the behavior is the same with autocommit=true and a temporary transaction. + assertTrue(connection.isReturnCommitStats()); + connection.setAutocommit(true); + connection.beginTransaction(); + connection.setReturnCommitStats(false); + assertFalse(connection.isReturnCommitStats()); + connection.rollback(); + assertFalse(connection.isReturnCommitStats()); + } + } + + @Test + public void testTransactionalState_rollBacksConnectionState() { + try (Connection connection = + createConnection(";connection_state_type=transactional;autocommit=false")) { + assertEquals(((ConnectionImpl) connection).getConnectionStateType(), Type.TRANSACTIONAL); + assertFalse(connection.isAutocommit()); + + // Verify the initial default value. + assertFalse(connection.isReturnCommitStats()); + + // Change the value and read it back in the same transaction. + connection.setReturnCommitStats(true); + assertTrue(connection.isReturnCommitStats()); + + // Rolling back will undo the connection state change. + connection.rollback(); + assertFalse(connection.isReturnCommitStats()); + + // Verify that the behavior is the same with autocommit=true and a temporary transaction. + assertFalse(connection.isReturnCommitStats()); + connection.setAutocommit(true); + connection.beginTransaction(); + connection.setReturnCommitStats(true); + assertTrue(connection.isReturnCommitStats()); + connection.rollback(); + assertFalse(connection.isReturnCommitStats()); + } + } + + @Test + public void testTransactionalState_commitsConnectionState() { + try (Connection connection = + createConnection(";connection_state_type=transactional;autocommit=false")) { + assertEquals(((ConnectionImpl) connection).getConnectionStateType(), Type.TRANSACTIONAL); + assertFalse(connection.isAutocommit()); + + // Verify the initial default value. + assertFalse(connection.isReturnCommitStats()); + + // Change the value and read it back in the same transaction. + connection.setReturnCommitStats(true); + assertTrue(connection.isReturnCommitStats()); + + // Committing will persist the connection state change. + connection.commit(); + assertTrue(connection.isReturnCommitStats()); + + // Verify that the behavior is the same with autocommit=true and a temporary transaction. + assertTrue(connection.isReturnCommitStats()); + connection.setAutocommit(true); + connection.beginTransaction(); + connection.setReturnCommitStats(false); + assertFalse(connection.isReturnCommitStats()); + connection.commit(); + assertFalse(connection.isReturnCommitStats()); + } + } + + @Test + public void testLocalChangeIsLostAfterTransaction() { + // SET LOCAL ... has the same effect regardless of connection state type. + for (ConnectionState.Type type : Type.values()) { + try (ConnectionImpl connection = (ConnectionImpl) createConnection()) { + assertTrue(connection.isAutocommit()); + + for (boolean commit : new boolean[] {true, false}) { + // Verify the initial default value. + assertFalse(connection.isReturnCommitStats()); + + connection.beginTransaction(); + // Change the value and read it back in the same transaction. + connection.setReturnCommitStats(true, /* local = */ true); + assertTrue(connection.isReturnCommitStats()); + // Both rolling back and committing will undo the connection state change. + if (commit) { + connection.commit(); + } else { + connection.rollback(); + } + // The local change should now be undone. + assertFalse(connection.isReturnCommitStats()); + } + } + } + } +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateTest.java new file mode 100644 index 00000000000..7d613a3eef9 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionStateTest.java @@ -0,0 +1,267 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import static com.google.cloud.spanner.connection.ConnectionProperties.AUTOCOMMIT_DML_MODE; +import static com.google.cloud.spanner.connection.ConnectionProperties.CONNECTION_STATE_TYPE; +import static com.google.cloud.spanner.connection.ConnectionProperties.READONLY; +import static com.google.cloud.spanner.connection.ConnectionProperties.RETRY_ABORTS_INTERNALLY; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; + +import com.google.cloud.NoCredentials; +import com.google.cloud.spanner.ErrorCode; +import com.google.cloud.spanner.SpannerException; +import com.google.cloud.spanner.connection.ConnectionProperty.Context; +import com.google.cloud.spanner.connection.ConnectionState.Type; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class ConnectionStateTest { + + @Parameters(name = "connectionStateType = {0}") + public static Object[] data() { + return ConnectionState.Type.values(); + } + + @SuppressWarnings("ClassEscapesDefinedScope") + @Parameter + public ConnectionState.Type connectionStateType; + + ConnectionState getNonTransactionalState() { + return new ConnectionState( + createConnectionOptionsBuilder().build().getInitialConnectionPropertyValues()); + } + + ConnectionState getTransactionalState() { + return new ConnectionState( + createConnectionOptionsBuilder() + .setConnectionPropertyValue(CONNECTION_STATE_TYPE, Type.TRANSACTIONAL) + .build() + .getInitialConnectionPropertyValues()); + } + + ConnectionOptions.Builder createConnectionOptionsBuilder() { + return ConnectionOptions.newBuilder() + .setUri("cloudspanner:/projects/p/instances/i/databases/d") + .setCredentials(NoCredentials.getInstance()); + } + + ConnectionState getConnectionState() { + return connectionStateType == Type.TRANSACTIONAL + ? getTransactionalState() + : getNonTransactionalState(); + } + + @Test + public void testSetOutsideTransaction() { + ConnectionState state = getConnectionState(); + assertEquals(connectionStateType, state.getType()); + + assertEquals(false, state.getValue(READONLY).getValue()); + state.setValue(READONLY, true, Context.USER, /* inTransaction = */ false); + assertEquals(true, state.getValue(READONLY).getValue()); + } + + @Test + public void testSetToNullOutsideTransaction() { + ConnectionState state = getConnectionState(); + assertEquals(AutocommitDmlMode.TRANSACTIONAL, state.getValue(AUTOCOMMIT_DML_MODE).getValue()); + state.setValue(AUTOCOMMIT_DML_MODE, null, Context.USER, /* inTransaction = */ false); + assertNull(state.getValue(AUTOCOMMIT_DML_MODE).getValue()); + } + + @Test + public void testSetInTransactionCommit() { + ConnectionState state = getConnectionState(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, false, Context.USER, /* inTransaction = */ true); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Verify that the change is persisted if the transaction is committed. + state.commit(); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testSetInTransactionRollback() { + ConnectionState state = getConnectionState(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, false, Context.USER, /* inTransaction = */ true); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Verify that the change is rolled back if the transaction is rolled back and the connection + // state is transactional. + state.rollback(); + // The value should rolled back to true if the state is transactional. + // The value should (still) be false if the state is non-transactional. + boolean expectedValue = connectionStateType == Type.TRANSACTIONAL; + assertEquals(expectedValue, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testResetInTransactionCommit() { + ConnectionState state = getConnectionState(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, false, Context.USER, /* inTransaction = */ true); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.commit(); + + // Reset the value to the default (true). + state.resetValue(RETRY_ABORTS_INTERNALLY, Context.USER, /* inTransaction = */ true); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Verify that the change is persisted if the transaction is committed. + state.commit(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testResetInTransactionRollback() { + ConnectionState state = getConnectionState(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, false, Context.USER, /* inTransaction = */ true); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.commit(); + + // Reset the value to the default (true). + state.resetValue(RETRY_ABORTS_INTERNALLY, Context.USER, /* inTransaction = */ true); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Verify that the change is rolled back if the transaction is rolled back and the connection + // state is transactional. + state.rollback(); + // The value should rolled back to false if the state is transactional. + // The value should (still) be true if the state is non-transactional. + boolean expectedValue = connectionStateType != Type.TRANSACTIONAL; + assertEquals(expectedValue, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testSetLocal() { + ConnectionState state = getConnectionState(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setLocalValue(RETRY_ABORTS_INTERNALLY, false); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Verify that the change is no longer visible once the transaction has ended, even if the + // transaction was committed. + state.commit(); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testSetLocalForStartupProperty() { + ConnectionState state = getConnectionState(); + SpannerException exception = + assertThrows( + SpannerException.class, + () -> state.setLocalValue(CONNECTION_STATE_TYPE, Type.TRANSACTIONAL)); + assertEquals(ErrorCode.FAILED_PRECONDITION, exception.getErrorCode()); + } + + @Test + public void testSetInTransactionForStartupProperty() { + ConnectionState state = getConnectionState(); + SpannerException exception = + assertThrows( + SpannerException.class, + () -> + state.setValue( + CONNECTION_STATE_TYPE, + Type.TRANSACTIONAL, + Context.USER, + /* inTransaction = */ true)); + assertEquals(ErrorCode.FAILED_PRECONDITION, exception.getErrorCode()); + } + + @Test + public void testSetStartupOnlyProperty() { + ConnectionState state = getConnectionState(); + SpannerException exception = + assertThrows( + SpannerException.class, + () -> + state.setValue( + CONNECTION_STATE_TYPE, + Type.TRANSACTIONAL, + Context.USER, + /* inTransaction = */ false)); + assertEquals(ErrorCode.FAILED_PRECONDITION, exception.getErrorCode()); + } + + @Test + public void testReset() { + ConnectionState state = getConnectionState(); + // The default should be true. + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, false, Context.USER, /* inTransaction = */ false); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Resetting the property should reset it to the default value. + state.resetValue(RETRY_ABORTS_INTERNALLY, Context.USER, /* inTransaction = */ false); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testResetInTransaction() { + ConnectionState state = getConnectionState(); + // The default should be true. + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, false, Context.USER, /* inTransaction = */ true); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.commit(); + + // Resetting the property should reset it to the default value. + state.resetValue(RETRY_ABORTS_INTERNALLY, Context.USER, /* inTransaction = */ true); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } + + @Test + public void testResetStartupOnlyProperty() { + ConnectionState state = getConnectionState(); + SpannerException exception = + assertThrows( + SpannerException.class, + () -> + state.resetValue(CONNECTION_STATE_TYPE, Context.USER, /* inTransaction = */ false)); + assertEquals(ErrorCode.FAILED_PRECONDITION, exception.getErrorCode()); + } + + @Test + public void testInitialValueInConnectionUrl() { + ConnectionOptions options = + ConnectionOptions.newBuilder() + .setUri("cloudspanner:/projects/p/instances/i/databases/d?retryAbortsInternally=false") + .setCredentials(NoCredentials.getInstance()) + .build(); + ConnectionState state = new ConnectionState(options.getInitialConnectionPropertyValues()); + + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + state.setValue(RETRY_ABORTS_INTERNALLY, true, Context.USER, /* inTransaction = */ false); + assertEquals(true, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + + // Resetting the property should reset it to the value that was set in the connection URL. + state.resetValue(RETRY_ABORTS_INTERNALLY, Context.USER, /* inTransaction = */ false); + assertEquals(false, state.getValue(RETRY_ABORTS_INTERNALLY).getValue()); + } +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/CredentialsProviderTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/CredentialsProviderTest.java index 944e4adeb2d..9e2979e1aaf 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/CredentialsProviderTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/CredentialsProviderTest.java @@ -21,9 +21,11 @@ import com.google.api.gax.core.CredentialsProvider; import com.google.auth.Credentials; +import com.google.auth.oauth2.AccessToken; import com.google.auth.oauth2.OAuth2Credentials; import io.grpc.ManagedChannelBuilder; import java.io.ObjectStreamException; +import java.util.Date; import java.util.concurrent.atomic.AtomicInteger; import org.junit.BeforeClass; import org.junit.Test; @@ -50,6 +52,14 @@ private Object readResolve() throws ObjectStreamException { return this; } + @Override + public AccessToken refreshAccessToken() { + return AccessToken.newBuilder() + .setTokenValue("foo") + .setExpirationTime(new Date(Long.MAX_VALUE)) + .build(); + } + public boolean equals(Object obj) { if (!(obj instanceof TestCredentials)) { return false; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DdlBatchTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DdlBatchTest.java index b6a12567101..93ae60891fb 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DdlBatchTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DdlBatchTest.java @@ -610,7 +610,7 @@ public void testCancel() { public void testCommit() { DdlBatch batch = createSubject(); try { - batch.commitAsync(CallType.SYNC); + batch.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE); fail("expected FAILED_PRECONDITION"); } catch (SpannerException e) { assertEquals(ErrorCode.FAILED_PRECONDITION, e.getErrorCode()); @@ -621,7 +621,7 @@ public void testCommit() { public void testRollback() { DdlBatch batch = createSubject(); try { - batch.rollbackAsync(CallType.SYNC); + batch.rollbackAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE); fail("expected FAILED_PRECONDITION"); } catch (SpannerException e) { assertEquals(ErrorCode.FAILED_PRECONDITION, e.getErrorCode()); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DmlBatchTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DmlBatchTest.java index d71376df40f..629ae41daf4 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DmlBatchTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DmlBatchTest.java @@ -195,7 +195,7 @@ public void testGetStateAndIsActive() { public void testCommit() { DmlBatch batch = createSubject(); try { - batch.commitAsync(CallType.SYNC); + batch.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE); fail("Expected exception"); } catch (SpannerException e) { assertEquals(ErrorCode.FAILED_PRECONDITION, e.getErrorCode()); @@ -206,7 +206,7 @@ public void testCommit() { public void testRollback() { DmlBatch batch = createSubject(); try { - batch.rollbackAsync(CallType.SYNC); + batch.rollbackAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE); fail("Expected exception"); } catch (SpannerException e) { assertEquals(ErrorCode.FAILED_PRECONDITION, e.getErrorCode()); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/NoopEndTransactionCallback.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/NoopEndTransactionCallback.java new file mode 100644 index 00000000000..6145d9770b5 --- /dev/null +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/NoopEndTransactionCallback.java @@ -0,0 +1,31 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.spanner.connection; + +import com.google.cloud.spanner.connection.UnitOfWork.EndTransactionCallback; + +class NoopEndTransactionCallback implements EndTransactionCallback { + static final NoopEndTransactionCallback INSTANCE = new NoopEndTransactionCallback(); + + private NoopEndTransactionCallback() {} + + @Override + public void onSuccess() {} + + @Override + public void onFailure() {} +} diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/QueryOptionsTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/QueryOptionsTest.java index 627e8c7acc9..6d5d4106638 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/QueryOptionsTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/QueryOptionsTest.java @@ -30,7 +30,7 @@ public class QueryOptionsTest extends AbstractMockServerTest { @Test public void testUseOptimizerVersionFromConnectionUrl() { - try (Connection connection = createConnection("?optimizerVersion=10")) { + try (Connection connection = createConnection(";optimizerVersion=10")) { Repeat.twice( () -> { executeSelect1AndConsumeResults(connection); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadOnlyTransactionTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadOnlyTransactionTest.java index 752b467b484..e243fbd620a 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadOnlyTransactionTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadOnlyTransactionTest.java @@ -245,7 +245,7 @@ public void testAbortBatch() { @Test public void testGetCommitTimestamp() { ReadOnlyTransaction transaction = createSubject(); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat(transaction.getState(), is(UnitOfWorkState.COMMITTED)); try { transaction.getCommitTimestamp(); @@ -258,7 +258,7 @@ public void testGetCommitTimestamp() { @Test public void testGetCommitResponse() { ReadOnlyTransaction transaction = createSubject(); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); try { transaction.getCommitResponse(); fail("expected FAILED_PRECONDITION"); @@ -270,7 +270,7 @@ public void testGetCommitResponse() { @Test public void testGetCommitResponseOrNull() { ReadOnlyTransaction transaction = createSubject(); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertNull(transaction.getCommitResponseOrNull()); } @@ -430,7 +430,7 @@ public void testState() { transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.COMMITTED))); @@ -449,7 +449,7 @@ public void testState() { is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.COMMITTED))); @@ -461,7 +461,7 @@ public void testState() { transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.rollbackAsync(CallType.SYNC)); + get(transaction.rollbackAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.ROLLED_BACK))); @@ -479,7 +479,7 @@ public void testState() { transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.rollbackAsync(CallType.SYNC)); + get(transaction.rollbackAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.ROLLED_BACK))); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadWriteTransactionTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadWriteTransactionTest.java index 136680b8a06..9fbb5b5bf16 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadWriteTransactionTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadWriteTransactionTest.java @@ -308,7 +308,7 @@ public void testGetCommitTimestampAfterCommit() { ReadWriteTransaction transaction = createSubject(); assertThat(get(transaction.executeUpdateAsync(CallType.SYNC, parsedStatement)), is(1L)); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat(transaction.getCommitTimestamp(), is(notNullValue())); } @@ -354,7 +354,7 @@ public void testState() { is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.COMMITTED))); @@ -366,7 +366,7 @@ public void testState() { transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.rollbackAsync(CallType.SYNC)); + get(transaction.rollbackAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.ROLLED_BACK))); @@ -379,7 +379,7 @@ public void testState() { is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); try { - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); } catch (SpannerException e) { // ignore } @@ -395,7 +395,7 @@ public void testState() { is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); try { - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); } catch (AbortedException e) { // ignore } @@ -411,7 +411,7 @@ public void testState() { transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.STARTED))); assertThat(transaction.isActive(), is(true)); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertThat( transaction.getState(), is(equalTo(com.google.cloud.spanner.connection.UnitOfWork.UnitOfWorkState.COMMITTED))); @@ -483,7 +483,7 @@ public void testRetry() { subject.executeUpdateAsync(CallType.SYNC, update2); boolean expectedException = false; try { - get(subject.commitAsync(CallType.SYNC)); + get(subject.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); } catch (SpannerException e) { if (results == RetryResults.DIFFERENT && e.getErrorCode() == ErrorCode.ABORTED) { // expected @@ -826,7 +826,7 @@ public void testGetCommitResponseAfterCommit() { ReadWriteTransaction transaction = createSubject(); get(transaction.executeUpdateAsync(CallType.SYNC, parsedStatement)); - get(transaction.commitAsync(CallType.SYNC)); + get(transaction.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE)); assertNotNull(transaction.getCommitResponse()); assertNotNull(transaction.getCommitResponseOrNull()); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SingleUseTransactionTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SingleUseTransactionTest.java index 1fd6d6bd7e2..6edf46b5623 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SingleUseTransactionTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SingleUseTransactionTest.java @@ -516,7 +516,7 @@ private List getTestTimestampBounds() { public void testCommit() { SingleUseTransaction subject = createSubject(); try { - subject.commitAsync(CallType.SYNC); + subject.commitAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE); fail("missing expected exception"); } catch (SpannerException e) { assertThat(e.getErrorCode()).isEqualTo(ErrorCode.FAILED_PRECONDITION); @@ -527,7 +527,7 @@ public void testCommit() { public void testRollback() { SingleUseTransaction subject = createSubject(); try { - subject.rollbackAsync(CallType.SYNC); + subject.rollbackAsync(CallType.SYNC, NoopEndTransactionCallback.INSTANCE); fail("missing expected exception"); } catch (SpannerException e) { assertThat(e.getErrorCode()).isEqualTo(ErrorCode.FAILED_PRECONDITION); From 79453f9985eda10631cd29ae58c0cedf234c2e18 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Fri, 11 Oct 2024 07:58:26 +0200 Subject: [PATCH 09/10] deps: update dependency com.google.cloud:google-cloud-trace to v2.52.0 (#3393) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-trace](https://redirect.github.com/googleapis/google-cloud-java) | `2.51.0` -> `2.52.0` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.cloud:google-cloud-trace/2.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.google.cloud:google-cloud-trace/2.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.google.cloud:google-cloud-trace/2.51.0/2.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.cloud:google-cloud-trace/2.51.0/2.52.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/java-spanner). --- samples/install-without-bom/pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 44dc66baaed..855dfb2245c 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -23,7 +23,7 @@ 1.8 UTF-8 0.31.1 - 2.51.0 + 2.52.0 3.52.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 62fc8b9c715..4ac6a5f093b 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -23,7 +23,7 @@ 1.8 UTF-8 0.31.1 - 2.51.0 + 2.52.0 3.52.0 From a1433bb8b8b253b08fbcf9f6ec5b3c2f5bb40089 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:16:00 +0530 Subject: [PATCH 10/10] chore(main): release 6.78.0 (#3379) * chore(main): release 6.78.0 * chore: generate libraries at Fri Oct 11 05:59:09 UTC 2024 --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: cloud-java-bot --- CHANGELOG.md | 17 ++++++++++++++++ README.md | 8 +++----- benchmarks/pom.xml | 2 +- google-cloud-spanner-bom/pom.xml | 18 ++++++++--------- google-cloud-spanner-executor/pom.xml | 4 ++-- google-cloud-spanner/pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- grpc-google-cloud-spanner-executor-v1/pom.xml | 4 ++-- grpc-google-cloud-spanner-v1/pom.xml | 4 ++-- pom.xml | 20 +++++++++---------- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- .../pom.xml | 4 ++-- proto-google-cloud-spanner-v1/pom.xml | 4 ++-- samples/snapshot/pom.xml | 2 +- versions.txt | 20 +++++++++---------- 17 files changed, 71 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9de3cd28feb..b7e2901228f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [6.78.0](https://github.com/googleapis/java-spanner/compare/v6.77.0...v6.78.0) (2024-10-11) + + +### Features + +* Define ReplicaComputeCapacity and AsymmetricAutoscalingOption ([f46a6b3](https://github.com/googleapis/java-spanner/commit/f46a6b34383fe45d63b2db912389b26067f3a853)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.47.0 ([139a715](https://github.com/googleapis/java-spanner/commit/139a715d3f617b20a00b0cf4f5819e5a61a87c96)) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-trace to v2.52.0 ([#3393](https://github.com/googleapis/java-spanner/issues/3393)) ([79453f9](https://github.com/googleapis/java-spanner/commit/79453f9985eda10631cd29ae58c0cedf234c2e18)) + ## [6.77.0](https://github.com/googleapis/java-spanner/compare/v6.76.0...v6.77.0) (2024-10-02) diff --git a/README.md b/README.md index c83cd4fbb79..4f12f6e18e0 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: If you are using Maven without the BOM, add this to your dependencies: - ```xml @@ -57,15 +56,14 @@ 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.77.0' +implementation 'com.google.cloud:google-cloud-spanner:6.78.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.77.0" +libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.78.0" ``` - ## Authentication @@ -721,7 +719,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [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-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.77.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.78.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 50c4ed1b270..2f2ef2283ce 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -24,7 +24,7 @@ com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/google-cloud-spanner-bom/pom.xml b/google-cloud-spanner-bom/pom.xml index b177613d13b..7df8db7b015 100644 --- a/google-cloud-spanner-bom/pom.xml +++ b/google-cloud-spanner-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-spanner-bom - 6.77.1-SNAPSHOT + 6.78.0 pom com.google.cloud @@ -53,43 +53,43 @@ com.google.cloud google-cloud-spanner - 6.77.1-SNAPSHOT + 6.78.0 com.google.cloud google-cloud-spanner test-jar - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/google-cloud-spanner-executor/pom.xml b/google-cloud-spanner-executor/pom.xml index 7c7000bc4c0..5e12a8a7cff 100644 --- a/google-cloud-spanner-executor/pom.xml +++ b/google-cloud-spanner-executor/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.google.cloud google-cloud-spanner-executor - 6.77.1-SNAPSHOT + 6.78.0 jar Google Cloud Spanner Executor com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/google-cloud-spanner/pom.xml b/google-cloud-spanner/pom.xml index fc23777b5a6..de67770b65f 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.77.1-SNAPSHOT + 6.78.0 jar Google Cloud Spanner https://github.com/googleapis/java-spanner @@ -11,7 +11,7 @@ com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 google-cloud-spanner diff --git a/grpc-google-cloud-spanner-admin-database-v1/pom.xml b/grpc-google-cloud-spanner-admin-database-v1/pom.xml index 89081db175e..139164441fe 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.77.1-SNAPSHOT + 6.78.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.77.1-SNAPSHOT + 6.78.0 diff --git a/grpc-google-cloud-spanner-admin-instance-v1/pom.xml b/grpc-google-cloud-spanner-admin-instance-v1/pom.xml index 3f3576a49e8..de02449d086 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.77.1-SNAPSHOT + 6.78.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.77.1-SNAPSHOT + 6.78.0 diff --git a/grpc-google-cloud-spanner-executor-v1/pom.xml b/grpc-google-cloud-spanner-executor-v1/pom.xml index b9175ffda1c..d055456d5e2 100644 --- a/grpc-google-cloud-spanner-executor-v1/pom.xml +++ b/grpc-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.77.1-SNAPSHOT + 6.78.0 grpc-google-cloud-spanner-executor-v1 GRPC library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/grpc-google-cloud-spanner-v1/pom.xml b/grpc-google-cloud-spanner-v1/pom.xml index b4f16518fe2..9d8a9b18c5a 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.77.1-SNAPSHOT + 6.78.0 grpc-google-cloud-spanner-v1 GRPC library for grpc-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/pom.xml b/pom.xml index 4cc325c9d3b..7ff9ddc6956 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-spanner-parent pom - 6.77.1-SNAPSHOT + 6.78.0 Google Cloud Spanner Parent https://github.com/googleapis/java-spanner @@ -61,47 +61,47 @@ com.google.api.grpc proto-google-cloud-spanner-admin-instance-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-executor-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc proto-google-cloud-spanner-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc proto-google-cloud-spanner-admin-database-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-admin-instance-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.api.grpc grpc-google-cloud-spanner-admin-database-v1 - 6.77.1-SNAPSHOT + 6.78.0 com.google.cloud google-cloud-spanner - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/proto-google-cloud-spanner-admin-database-v1/pom.xml b/proto-google-cloud-spanner-admin-database-v1/pom.xml index 64b28a1948b..40e21d4a5d9 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.77.1-SNAPSHOT + 6.78.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.77.1-SNAPSHOT + 6.78.0 diff --git a/proto-google-cloud-spanner-admin-instance-v1/pom.xml b/proto-google-cloud-spanner-admin-instance-v1/pom.xml index 3f30ef21953..42c7ed5f662 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.77.1-SNAPSHOT + 6.78.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.77.1-SNAPSHOT + 6.78.0 diff --git a/proto-google-cloud-spanner-executor-v1/pom.xml b/proto-google-cloud-spanner-executor-v1/pom.xml index 83e9fdf29af..a915db9ad7d 100644 --- a/proto-google-cloud-spanner-executor-v1/pom.xml +++ b/proto-google-cloud-spanner-executor-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-spanner-executor-v1 - 6.77.1-SNAPSHOT + 6.78.0 proto-google-cloud-spanner-executor-v1 Proto library for google-cloud-spanner com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/proto-google-cloud-spanner-v1/pom.xml b/proto-google-cloud-spanner-v1/pom.xml index e10b388ef3d..dd9ad8b00e1 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.77.1-SNAPSHOT + 6.78.0 proto-google-cloud-spanner-v1 PROTO library for proto-google-cloud-spanner-v1 com.google.cloud google-cloud-spanner-parent - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 4ac6a5f093b..0db3b705218 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,7 +32,7 @@ com.google.cloud google-cloud-spanner - 6.77.1-SNAPSHOT + 6.78.0 diff --git a/versions.txt b/versions.txt index 95ac3133128..0dbdb06eb4f 100644 --- a/versions.txt +++ b/versions.txt @@ -1,13 +1,13 @@ # Format: # module:released-version:current-version -proto-google-cloud-spanner-admin-instance-v1:6.77.0:6.77.1-SNAPSHOT -proto-google-cloud-spanner-v1:6.77.0:6.77.1-SNAPSHOT -proto-google-cloud-spanner-admin-database-v1:6.77.0:6.77.1-SNAPSHOT -grpc-google-cloud-spanner-v1:6.77.0:6.77.1-SNAPSHOT -grpc-google-cloud-spanner-admin-instance-v1:6.77.0:6.77.1-SNAPSHOT -grpc-google-cloud-spanner-admin-database-v1:6.77.0:6.77.1-SNAPSHOT -google-cloud-spanner:6.77.0:6.77.1-SNAPSHOT -google-cloud-spanner-executor:6.77.0:6.77.1-SNAPSHOT -proto-google-cloud-spanner-executor-v1:6.77.0:6.77.1-SNAPSHOT -grpc-google-cloud-spanner-executor-v1:6.77.0:6.77.1-SNAPSHOT +proto-google-cloud-spanner-admin-instance-v1:6.78.0:6.78.0 +proto-google-cloud-spanner-v1:6.78.0:6.78.0 +proto-google-cloud-spanner-admin-database-v1:6.78.0:6.78.0 +grpc-google-cloud-spanner-v1:6.78.0:6.78.0 +grpc-google-cloud-spanner-admin-instance-v1:6.78.0:6.78.0 +grpc-google-cloud-spanner-admin-database-v1:6.78.0:6.78.0 +google-cloud-spanner:6.78.0:6.78.0 +google-cloud-spanner-executor:6.78.0:6.78.0 +proto-google-cloud-spanner-executor-v1:6.78.0:6.78.0 +grpc-google-cloud-spanner-executor-v1:6.78.0:6.78.0