Skip to content

Commit 19f137c

Browse files
gcf-owl-bot[bot]alkatrivediharshachintasurbhigarg92
authored
feat(spanner): Add support for Cloud Spanner Default Backup Schedules (#2135)
* feat: add INTERVAL API PiperOrigin-RevId: 680405503 Source-Link: googleapis/googleapis@2c9fb37 Source-Link: googleapis/googleapis-gen@317c7d1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzE3YzdkMWIxYjgwMWZlNjYzZjg3YmZkMGJhZTU0ZmQ2NTI2ZGU4NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: update comment for PROFILE QueryMode feat: add new QueryMode enum values (WITH_STATS, WITH_PLAN_AND_STATS) PiperOrigin-RevId: 680628448 Source-Link: googleapis/googleapis@72a5151 Source-Link: googleapis/googleapis-gen@146c3e8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTQ2YzNlOGRhODc3Mzg4MDQ3MDliN2YzZDI2NGE4ZTMzYWUzOGQ3MSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Define ReplicaComputeCapacity and AsymmetricAutoscalingOption docs: A comment for field `node_count` in message `spanner.admin.instance.v1.Instance` is changed docs: A comment for field `processing_units` in message `spanner.admin.instance.v1.Instance` is changed PiperOrigin-RevId: 681615472 Source-Link: googleapis/googleapis@dd47718 Source-Link: googleapis/googleapis-gen@7f0f9b7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2YwZjliNzQ2NmNiNTE3NzY5YjU0OWM1ZTJjMmI5MTI0OTI4NjJmMiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: protos for R/W transaction support on multiplexed sessions PiperOrigin-RevId: 683879049 Source-Link: googleapis/googleapis@2b6b93b Source-Link: googleapis/googleapis-gen@2f0c933 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmYwYzkzM2IwMDMxNjRkNWNkMTIwNTA1YTk4Yzg3Yzk1ODg4ZDk4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat(spanner): Add support for Cloud Spanner Default Backup Schedules PiperOrigin-RevId: 688946300 Source-Link: googleapis/googleapis@b11e6b0 Source-Link: googleapis/googleapis-gen@f93f56b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjkzZjU2YjIxZmYwMWU0OTk5NzdjNGRkNTQ2ODljY2UxYjdjZjUzMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * test case fix --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: alkatrivedi <58396306+alkatrivedi@users.noreply.github.com> Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com> Co-authored-by: surbhigarg92 <surbhigarg.92@gmail.com>
1 parent 60035b7 commit 19f137c

File tree

13 files changed

+7517
-4874
lines changed

13 files changed

+7517
-4874
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ system-test/*key.json
1212
.DS_Store
1313
package-lock.json
1414
__pycache__
15-
.vscode

protos/google/spanner/admin/instance/v1/common.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package google.spanner.admin.instance.v1;
1818

19+
import "google/api/field_behavior.proto";
1920
import "google/protobuf/timestamp.proto";
2021

2122
option csharp_namespace = "Google.Cloud.Spanner.Admin.Instance.V1";
@@ -54,3 +55,9 @@ enum FulfillmentPeriod {
5455
// to complete.
5556
FULFILLMENT_PERIOD_EXTENDED = 2;
5657
}
58+
59+
// ReplicaSelection identifies replicas with common properties.
60+
message ReplicaSelection {
61+
// Required. Name of the location of the replicas (e.g., "us-central1").
62+
string location = 1 [(google.api.field_behavior) = REQUIRED];
63+
}

protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto

Lines changed: 139 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,34 @@ message InstanceConfig {
803803
State state = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
804804
}
805805

806+
// ReplicaComputeCapacity describes the amount of server resources that are
807+
// allocated to each replica identified by the replica selection.
808+
message ReplicaComputeCapacity {
809+
// Required. Identifies replicas by specified properties.
810+
// All replicas in the selection have the same amount of compute capacity.
811+
ReplicaSelection replica_selection = 1
812+
[(google.api.field_behavior) = REQUIRED];
813+
814+
// Compute capacity allocated to each replica identified by the specified
815+
// selection.
816+
// The unit is selected based on the unit used to specify the instance size
817+
// for non-autoscaling instances, or the unit used in autoscaling limit for
818+
// autoscaling instances.
819+
oneof compute_capacity {
820+
// The number of nodes allocated to each replica.
821+
//
822+
// This may be zero in API responses for instances that are not yet in
823+
// state `READY`.
824+
int32 node_count = 2;
825+
826+
// The number of processing units allocated to each replica.
827+
//
828+
// This may be zero in API responses for instances that are not yet in
829+
// state `READY`.
830+
int32 processing_units = 3;
831+
}
832+
}
833+
806834
// Autoscaling configuration for an instance.
807835
message AutoscalingConfig {
808836
// The autoscaling limits for the instance. Users can define the minimum and
@@ -854,13 +882,56 @@ message AutoscalingConfig {
854882
[(google.api.field_behavior) = REQUIRED];
855883
}
856884

885+
// AsymmetricAutoscalingOption specifies the scaling of replicas identified by
886+
// the given selection.
887+
message AsymmetricAutoscalingOption {
888+
// Overrides the top-level autoscaling configuration for the replicas
889+
// identified by `replica_selection`. All fields in this message are
890+
// optional. Any unspecified fields will use the corresponding values from
891+
// the top-level autoscaling configuration.
892+
message AutoscalingConfigOverrides {
893+
// Optional. If specified, overrides the min/max limit in the top-level
894+
// autoscaling configuration for the selected replicas.
895+
AutoscalingLimits autoscaling_limits = 1
896+
[(google.api.field_behavior) = OPTIONAL];
897+
898+
// Optional. If specified, overrides the autoscaling target
899+
// high_priority_cpu_utilization_percent in the top-level autoscaling
900+
// configuration for the selected replicas.
901+
int32 autoscaling_target_high_priority_cpu_utilization_percent = 2
902+
[(google.api.field_behavior) = OPTIONAL];
903+
}
904+
905+
// Required. Selects the replicas to which this AsymmetricAutoscalingOption
906+
// applies. Only read-only replicas are supported.
907+
ReplicaSelection replica_selection = 1
908+
[(google.api.field_behavior) = REQUIRED];
909+
910+
// Optional. Overrides applied to the top-level autoscaling configuration
911+
// for the selected replicas.
912+
AutoscalingConfigOverrides overrides = 2
913+
[(google.api.field_behavior) = OPTIONAL];
914+
}
915+
857916
// Required. Autoscaling limits for an instance.
858917
AutoscalingLimits autoscaling_limits = 1
859918
[(google.api.field_behavior) = REQUIRED];
860919

861920
// Required. The autoscaling targets for an instance.
862921
AutoscalingTargets autoscaling_targets = 2
863922
[(google.api.field_behavior) = REQUIRED];
923+
924+
// Optional. Optional asymmetric autoscaling options.
925+
// Replicas matching the replica selection criteria will be autoscaled
926+
// independently from other replicas. The autoscaler will scale the replicas
927+
// based on the utilization of replicas identified by the replica selection.
928+
// Replica selections should not overlap with each other.
929+
//
930+
// Other replicas (those do not match any replica selection) will be
931+
// autoscaled together and will have the same compute capacity allocated to
932+
// them.
933+
repeated AsymmetricAutoscalingOption asymmetric_autoscaling_options = 3
934+
[(google.api.field_behavior) = OPTIONAL];
864935
}
865936

866937
// An isolated set of Cloud Spanner resources on which databases can be hosted.
@@ -901,6 +972,24 @@ message Instance {
901972
ENTERPRISE_PLUS = 3;
902973
}
903974

975+
// Indicates the default backup behavior for new databases within the
976+
// instance.
977+
enum DefaultBackupScheduleType {
978+
// Not specified.
979+
DEFAULT_BACKUP_SCHEDULE_TYPE_UNSPECIFIED = 0;
980+
981+
// No default backup schedule will be created automatically on creation of a
982+
// database within the instance.
983+
NONE = 1;
984+
985+
// A default backup schedule will be created automatically on creation of a
986+
// database within the instance. The default backup schedule creates a full
987+
// backup every 24 hours and retains the backup for a period of 7 days. Once
988+
// created, the default backup schedule can be edited/deleted similar to any
989+
// other backup schedule.
990+
AUTOMATIC = 2;
991+
}
992+
904993
// Required. A unique identifier for the instance, which cannot be changed
905994
// after the instance is created. Values are of the form
906995
// `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
@@ -922,34 +1011,56 @@ message Instance {
9221011
// Must be unique per project and between 4 and 30 characters in length.
9231012
string display_name = 3 [(google.api.field_behavior) = REQUIRED];
9241013

925-
// The number of nodes allocated to this instance. At most one of either
926-
// node_count or processing_units should be present in the message.
1014+
// The number of nodes allocated to this instance. At most, one of either
1015+
// `node_count` or `processing_units` should be present in the message.
9271016
//
928-
// Users can set the node_count field to specify the target number of nodes
1017+
// Users can set the `node_count` field to specify the target number of nodes
9291018
// allocated to the instance.
9301019
//
931-
// This may be zero in API responses for instances that are not yet in state
932-
// `READY`.
1020+
// If autoscaling is enabled, `node_count` is treated as an `OUTPUT_ONLY`
1021+
// field and reflects the current number of nodes allocated to the instance.
9331022
//
934-
// See [the
935-
// documentation](https://cloud.google.com/spanner/docs/compute-capacity)
936-
// for more information about nodes and processing units.
1023+
// This might be zero in API responses for instances that are not yet in the
1024+
// `READY` state.
1025+
//
1026+
// If the instance has varying node count across replicas (achieved by
1027+
// setting asymmetric_autoscaling_options in autoscaling config), the
1028+
// node_count here is the maximum node count across all replicas.
1029+
//
1030+
// For more information, see
1031+
// [Compute capacity, nodes, and processing
1032+
// units](https://cloud.google.com/spanner/docs/compute-capacity).
9371033
int32 node_count = 5;
9381034

939-
// The number of processing units allocated to this instance. At most one of
940-
// processing_units or node_count should be present in the message.
1035+
// The number of processing units allocated to this instance. At most, one of
1036+
// either `processing_units` or `node_count` should be present in the message.
9411037
//
942-
// Users can set the processing_units field to specify the target number of
1038+
// Users can set the `processing_units` field to specify the target number of
9431039
// processing units allocated to the instance.
9441040
//
945-
// This may be zero in API responses for instances that are not yet in state
946-
// `READY`.
1041+
// If autoscaling is enabled, `processing_units` is treated as an
1042+
// `OUTPUT_ONLY` field and reflects the current number of processing units
1043+
// allocated to the instance.
9471044
//
948-
// See [the
949-
// documentation](https://cloud.google.com/spanner/docs/compute-capacity)
950-
// for more information about nodes and processing units.
1045+
// This might be zero in API responses for instances that are not yet in the
1046+
// `READY` state.
1047+
//
1048+
// If the instance has varying processing units per replica
1049+
// (achieved by setting asymmetric_autoscaling_options in autoscaling config),
1050+
// the processing_units here is the maximum processing units across all
1051+
// replicas.
1052+
//
1053+
// For more information, see
1054+
// [Compute capacity, nodes and processing
1055+
// units](https://cloud.google.com/spanner/docs/compute-capacity).
9511056
int32 processing_units = 9;
9521057

1058+
// Output only. Lists the compute capacity per ReplicaSelection. A replica
1059+
// selection identifies a set of replicas with common properties. Replicas
1060+
// identified by a ReplicaSelection are scaled with the same compute capacity.
1061+
repeated ReplicaComputeCapacity replica_compute_capacity = 19
1062+
[(google.api.field_behavior) = OUTPUT_ONLY];
1063+
9531064
// Optional. The autoscaling configuration. Autoscaling is enabled if this
9541065
// field is set. When autoscaling is enabled, node_count and processing_units
9551066
// are treated as OUTPUT_ONLY fields and reflect the current compute capacity
@@ -1000,6 +1111,18 @@ message Instance {
10001111

10011112
// Optional. The `Edition` of the current instance.
10021113
Edition edition = 20 [(google.api.field_behavior) = OPTIONAL];
1114+
1115+
// Optional. Controls the default backup behavior for new databases within the
1116+
// instance.
1117+
//
1118+
// Note that `AUTOMATIC` is not permitted for free instances, as backups and
1119+
// backup schedules are not allowed for free instances.
1120+
//
1121+
// In the `GetInstance` or `ListInstances` response, if the value of
1122+
// default_backup_schedule_type is unset or NONE, no default backup
1123+
// schedule will be created for new databases within the instance.
1124+
DefaultBackupScheduleType default_backup_schedule_type = 23
1125+
[(google.api.field_behavior) = OPTIONAL];
10031126
}
10041127

10051128
// The request for

protos/google/spanner/v1/commit_response.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.spanner.v1;
1818

1919
import "google/protobuf/timestamp.proto";
20+
import "google/spanner/v1/transaction.proto";
2021

2122
option csharp_namespace = "Google.Cloud.Spanner.V1";
2223
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
@@ -47,4 +48,12 @@ message CommitResponse {
4748
// For more information, see
4849
// [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats].
4950
CommitStats commit_stats = 2;
51+
52+
// Clients should examine and retry the commit if any of the following
53+
// reasons are populated.
54+
oneof MultiplexedSessionRetry {
55+
// If specified, transaction has not committed yet.
56+
// Clients must retry the commit with the new precommit token.
57+
MultiplexedSessionPrecommitToken precommit_token = 4;
58+
}
5059
}

protos/google/spanner/v1/result_set.proto

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package google.spanner.v1;
1818

19+
import "google/api/field_behavior.proto";
1920
import "google/protobuf/struct.proto";
2021
import "google/spanner/v1/query_plan.proto";
2122
import "google/spanner/v1/transaction.proto";
@@ -53,6 +54,16 @@ message ResultSet {
5354
// Other fields may or may not be populated, based on the
5455
// [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode].
5556
ResultSetStats stats = 3;
57+
58+
// Optional. A precommit token will be included if the read-write transaction
59+
// is on a multiplexed session.
60+
// The precommit token with the highest sequence number from this transaction
61+
// attempt should be passed to the
62+
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
63+
// This feature is not yet supported and will result in an UNIMPLEMENTED
64+
// error.
65+
MultiplexedSessionPrecommitToken precommit_token = 5
66+
[(google.api.field_behavior) = OPTIONAL];
5667
}
5768

5869
// Partial results from a streaming read or SQL query. Streaming reads and
@@ -157,6 +168,16 @@ message PartialResultSet {
157168
// This field will also be present in the last response for DML
158169
// statements.
159170
ResultSetStats stats = 5;
171+
172+
// Optional. A precommit token will be included if the read-write transaction
173+
// is on a multiplexed session.
174+
// The precommit token with the highest sequence number from this transaction
175+
// attempt should be passed to the
176+
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
177+
// This feature is not yet supported and will result in an UNIMPLEMENTED
178+
// error.
179+
MultiplexedSessionPrecommitToken precommit_token = 8
180+
[(google.api.field_behavior) = OPTIONAL];
160181
}
161182

162183
// Metadata about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet].

protos/google/spanner/v1/spanner.proto

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,19 @@ message ExecuteSqlRequest {
628628
// execution statistics information.
629629
PLAN = 1;
630630

631-
// This mode returns both the query plan and the execution statistics along
632-
// with the results.
631+
// This mode returns the query plan, overall execution statistics,
632+
// operator level execution statistics along with the results. This has a
633+
// performance overhead compared to the other modes. It is not recommended
634+
// to use this mode for production traffic.
633635
PROFILE = 2;
636+
637+
// This mode returns the overall (but not operator-level) execution
638+
// statistics along with the results.
639+
WITH_STATS = 3;
640+
641+
// This mode returns the query plan, overall (but not operator-level)
642+
// execution statistics along with the results.
643+
WITH_PLAN_AND_STATS = 4;
634644
}
635645

636646
// Query optimizer configuration.
@@ -899,6 +909,16 @@ message ExecuteBatchDmlResponse {
899909
// If all DML statements are executed successfully, the status is `OK`.
900910
// Otherwise, the error status of the first failed statement.
901911
google.rpc.Status status = 2;
912+
913+
// Optional. A precommit token will be included if the read-write transaction
914+
// is on a multiplexed session.
915+
// The precommit token with the highest sequence number from this transaction
916+
// attempt should be passed to the
917+
// [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
918+
// This feature is not yet supported and will result in an UNIMPLEMENTED
919+
// error.
920+
MultiplexedSessionPrecommitToken precommit_token = 3
921+
[(google.api.field_behavior) = OPTIONAL];
902922
}
903923

904924
// Options for a PartitionQueryRequest and
@@ -1215,6 +1235,14 @@ message BeginTransactionRequest {
12151235
// transaction, set it on the reads and writes that are part of this
12161236
// transaction instead.
12171237
RequestOptions request_options = 3;
1238+
1239+
// Optional. Required for read-write transactions on a multiplexed session
1240+
// that commit mutations but do not perform any reads or queries. Clients
1241+
// should randomly select one of the mutations from the mutation set and send
1242+
// it as a part of this request.
1243+
// This feature is not yet supported and will result in an UNIMPLEMENTED
1244+
// error.
1245+
Mutation mutation_key = 4 [(google.api.field_behavior) = OPTIONAL];
12181246
}
12191247

12201248
// The request for [Commit][google.spanner.v1.Spanner.Commit].
@@ -1262,6 +1290,15 @@ message CommitRequest {
12621290

12631291
// Common options for this request.
12641292
RequestOptions request_options = 6;
1293+
1294+
// Optional. If the read-write transaction was executed on a multiplexed
1295+
// session, the precommit token with the highest sequence number received in
1296+
// this transaction attempt, should be included here. Failing to do so will
1297+
// result in a FailedPrecondition error.
1298+
// This feature is not yet supported and will result in an UNIMPLEMENTED
1299+
// error.
1300+
MultiplexedSessionPrecommitToken precommit_token = 9
1301+
[(google.api.field_behavior) = OPTIONAL];
12651302
}
12661303

12671304
// The request for [Rollback][google.spanner.v1.Spanner.Rollback].

0 commit comments

Comments
 (0)