Skip to content

Commit e4d389a

Browse files
feat(spanner): A new enum IsolationLevel is added (#2225)
- [ ] Regenerate this pull request now. feat(spanner): A new field `isolation_level` is added to message `.google.spanner.v1.TransactionOptions` docs(spanner): A comment for enum value `READ_LOCK_MODE_UNSPECIFIED` in enum `ReadLockMode` is changed docs(spanner): A comment for enum value `PESSIMISTIC` in enum `ReadLockMode` is changed docs(spanner): A comment for enum value `OPTIMISTIC` in enum `ReadLockMode` is changed PiperOrigin-RevId: 729265828 Source-Link: https://togithub.com/googleapis/googleapis/commit/516ab0ae2f7477526ebf2472a28bf5dc191412a7 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/ccd095926c893f40148ed9a9ba2276a8d15cf8d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2NkMDk1OTI2Yzg5M2Y0MDE0OGVkOWE5YmEyMjc2YThkMTVjZjhkOSJ9 BEGIN_NESTED_COMMIT feat(spanner): Add instance partitions field in backup proto PiperOrigin-RevId: 726160420 Source-Link: https://togithub.com/googleapis/googleapis/commit/1185fe543e0cd1392ebd6ce6a330139186959a94 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/d1ab008828297ba1bc5e0d79678f725f955833d7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDFhYjAwODgyODI5N2JhMWJjNWUwZDc5Njc4ZjcyNWY5NTU4MzNkNyJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT fix: finalize fixing typings for headers in generator PiperOrigin-RevId: 723563760 Source-Link: https://togithub.com/googleapis/googleapis/commit/2f843e2dfbaae2fb9c341b22d209d61fb637a808 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/cd0f9c6fe1dd77c552ef766e6047f8dcfd3bcc2e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2QwZjljNmZlMWRkNzdjNTUyZWY3NjZlNjA0N2Y4ZGNmZDNiY2MyZSJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT fix: fix typings for headers in generator PiperOrigin-RevId: 723181578 Source-Link: https://togithub.com/googleapis/googleapis/commit/c7b69f411c722a1cdb836b0efe27fabb656e7c59 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/d1bc1acd74296422a5cb6e0c4016c8c48e998538 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDFiYzFhY2Q3NDI5NjQyMmE1Y2I2ZTBjNDAxNmM4YzQ4ZTk5ODUzOCJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: add AddSplitPoints API PiperOrigin-RevId: 721248606 Source-Link: https://togithub.com/googleapis/googleapis/commit/d57f2c114b2d1d3db7fa71a1333d72129f8fd1ae Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/c2418f305f5002010264d2533fbcb7a900353499 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzI0MThmMzA1ZjUwMDIwMTAyNjRkMjUzM2ZiY2I3YTkwMDM1MzQ5OSJ9 END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: paging changes for bigquery fix: add x-goog-request params to headers for LRO-polling methods fix: remove extra protos in ESM & capture ESM in headers docs: update comments for a Nodejs stream object PiperOrigin-RevId: 721038181 Source-Link: https://togithub.com/googleapis/googleapis/commit/331a41aa9b3a0631abe4e1eb5dae67ab9c8bb043 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/e81b4c5b5208895f663a24048615a59d5636f415 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTgxYjRjNWI1MjA4ODk1ZjY2M2EyNDA0ODYxNWE1OWQ1NjM2ZjQxNSJ9 END_NESTED_COMMIT
1 parent 2cc44cf commit e4d389a

14 files changed

+2662
-269
lines changed

protos/google/spanner/admin/database/v1/backup.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ message Backup {
207207
// retained by the backup system.
208208
google.protobuf.Timestamp oldest_version_time = 18
209209
[(google.api.field_behavior) = OUTPUT_ONLY];
210+
211+
// Output only. The instance partition(s) storing the backup.
212+
//
213+
// This is the same as the list of the instance partition(s) that the database
214+
// had footprint in at the backup's `version_time`.
215+
repeated BackupInstancePartition instance_partitions = 19
216+
[(google.api.field_behavior) = OUTPUT_ONLY];
210217
}
211218

212219
// The request for
@@ -755,3 +762,12 @@ message FullBackupSpec {}
755762
// successive incremental backups. The first backup created for an
756763
// incremental backup chain is always a full backup.
757764
message IncrementalBackupSpec {}
765+
766+
// Instance partition information for the backup.
767+
message BackupInstancePartition {
768+
// A unique identifier for the instance partition. Values are of the form
769+
// `projects/<project>/instances/<instance>/instancePartitions/<instance_partition_id>`
770+
string instance_partition = 1 [(google.api.resource_reference) = {
771+
type: "spanner.googleapis.com/InstancePartition"
772+
}];
773+
}

protos/google/spanner/admin/database/v1/spanner_database_admin.proto

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import "google/iam/v1/policy.proto";
2525
import "google/longrunning/operations.proto";
2626
import "google/protobuf/empty.proto";
2727
import "google/protobuf/field_mask.proto";
28+
import "google/protobuf/struct.proto";
2829
import "google/protobuf/timestamp.proto";
2930
import "google/spanner/admin/database/v1/backup.proto";
3031
import "google/spanner/admin/database/v1/backup_schedule.proto";
@@ -41,6 +42,10 @@ option (google.api.resource_definition) = {
4142
type: "spanner.googleapis.com/Instance"
4243
pattern: "projects/{project}/instances/{instance}"
4344
};
45+
option (google.api.resource_definition) = {
46+
type: "spanner.googleapis.com/InstancePartition"
47+
pattern: "projects/{project}/instances/{instance}/instancePartitions/{instance_partition}"
48+
};
4449

4550
// Cloud Spanner Database Admin API
4651
//
@@ -425,6 +430,15 @@ service DatabaseAdmin {
425430
option (google.api.method_signature) = "parent";
426431
}
427432

433+
// Adds split points to specified tables, indexes of a database.
434+
rpc AddSplitPoints(AddSplitPointsRequest) returns (AddSplitPointsResponse) {
435+
option (google.api.http) = {
436+
post: "/v1/{database=projects/*/instances/*/databases/*}:addSplitPoints"
437+
body: "*"
438+
};
439+
option (google.api.method_signature) = "database,split_points";
440+
}
441+
428442
// Creates a new backup schedule.
429443
rpc CreateBackupSchedule(CreateBackupScheduleRequest)
430444
returns (BackupSchedule) {
@@ -1207,3 +1221,59 @@ message ListDatabaseRolesResponse {
12071221
// call to fetch more of the matching roles.
12081222
string next_page_token = 2;
12091223
}
1224+
1225+
// The request for
1226+
// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
1227+
message AddSplitPointsRequest {
1228+
// Required. The database on whose tables/indexes split points are to be
1229+
// added. Values are of the form
1230+
// `projects/<project>/instances/<instance>/databases/<database>`.
1231+
string database = 1 [
1232+
(google.api.field_behavior) = REQUIRED,
1233+
(google.api.resource_reference) = {
1234+
type: "spanner.googleapis.com/Database"
1235+
}
1236+
];
1237+
1238+
// Required. The split points to add.
1239+
repeated SplitPoints split_points = 2
1240+
[(google.api.field_behavior) = REQUIRED];
1241+
1242+
// Optional. A user-supplied tag associated with the split points.
1243+
// For example, "intital_data_load", "special_event_1".
1244+
// Defaults to "CloudAddSplitPointsAPI" if not specified.
1245+
// The length of the tag must not exceed 50 characters,else will be trimmed.
1246+
// Only valid UTF8 characters are allowed.
1247+
string initiator = 3 [(google.api.field_behavior) = OPTIONAL];
1248+
}
1249+
1250+
// The response for
1251+
// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
1252+
message AddSplitPointsResponse {}
1253+
1254+
// The split points of a table/index.
1255+
message SplitPoints {
1256+
// A split key.
1257+
message Key {
1258+
// Required. The column values making up the split key.
1259+
google.protobuf.ListValue key_parts = 1
1260+
[(google.api.field_behavior) = REQUIRED];
1261+
}
1262+
1263+
// The table to split.
1264+
string table = 1;
1265+
1266+
// The index to split.
1267+
// If specified, the `table` field must refer to the index's base table.
1268+
string index = 2;
1269+
1270+
// Required. The list of split keys, i.e., the split boundaries.
1271+
repeated Key keys = 3 [(google.api.field_behavior) = REQUIRED];
1272+
1273+
// Optional. The expiration timestamp of the split points.
1274+
// A timestamp in the past means immediate expiration.
1275+
// The maximum value can be 30 days in the future.
1276+
// Defaults to 10 days in the future if not specified.
1277+
google.protobuf.Timestamp expire_time = 5
1278+
[(google.api.field_behavior) = OPTIONAL];
1279+
}

protos/google/spanner/v1/transaction.proto

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,19 +361,31 @@ message TransactionOptions {
361361
enum ReadLockMode {
362362
// Default value.
363363
//
364-
// If the value is not specified, the pessimistic read lock is used.
364+
// * If isolation level is `REPEATABLE_READ`, then it is an error to
365+
// specify `read_lock_mode`. Locking semantics default to `OPTIMISTIC`.
366+
// No validation checks are done for reads, except for:
367+
// 1. reads done as part of queries that use `SELECT FOR UPDATE`
368+
// 2. reads done as part of statements with a `LOCK_SCANNED_RANGES`
369+
// hint
370+
// 3. reads done as part of DML statements
371+
// to validate that the data that was served at the snapshot time is
372+
// unchanged at commit time.
373+
// * At all other isolation levels, if `read_lock_mode` is the default
374+
// value, then pessimistic read lock is used.
365375
READ_LOCK_MODE_UNSPECIFIED = 0;
366376

367377
// Pessimistic lock mode.
368378
//
369379
// Read locks are acquired immediately on read.
380+
// Semantics described only applies to `SERIALIZABLE` isolation.
370381
PESSIMISTIC = 1;
371382

372383
// Optimistic lock mode.
373384
//
374385
// Locks for reads within the transaction are not acquired on read.
375386
// Instead the locks are acquired on a commit to validate that
376387
// read/queried data has not changed since the transaction started.
388+
// Semantics described only applies to `SERIALIZABLE` isolation.
377389
OPTIMISTIC = 2;
378390
}
379391

@@ -461,6 +473,38 @@ message TransactionOptions {
461473
bool return_read_timestamp = 6;
462474
}
463475

476+
// `IsolationLevel` is used when setting `isolation_level` for a transaction.
477+
enum IsolationLevel {
478+
// Default value.
479+
//
480+
// If the value is not specified, the `SERIALIZABLE` isolation level is
481+
// used.
482+
ISOLATION_LEVEL_UNSPECIFIED = 0;
483+
484+
// All transactions appear as if they executed in a serial order, even if
485+
// some of the reads, writes, and other operations of distinct transactions
486+
// actually occurred in parallel. Spanner assigns commit timestamps that
487+
// reflect the order of committed transactions to implement this property.
488+
// Spanner offers a stronger guarantee than serializability called external
489+
// consistency. For further details, please refer to
490+
// https://cloud.google.com/spanner/docs/true-time-external-consistency#serializability.
491+
SERIALIZABLE = 1;
492+
493+
// All reads performed during the transaction observe a consistent snapshot
494+
// of the database, and the transaction will only successfully commit in the
495+
// absence of conflicts between its updates and any concurrent updates that
496+
// have occurred since that snapshot. Consequently, in contrast to
497+
// `SERIALIZABLE` transactions, only write-write conflicts are detected in
498+
// snapshot transactions.
499+
//
500+
// This isolation level does not support Read-only and Partitioned DML
501+
// transactions.
502+
//
503+
// When `REPEATABLE_READ` is specified on a read-write transaction, the
504+
// locking semantics default to `OPTIMISTIC`.
505+
REPEATABLE_READ = 2;
506+
}
507+
464508
// Required. The type of transaction.
465509
oneof mode {
466510
// Transaction may write.
@@ -500,6 +544,9 @@ message TransactionOptions {
500544
// partitioned-dml transactions, otherwise the API will return an
501545
// `INVALID_ARGUMENT` error.
502546
bool exclude_txn_from_change_streams = 5;
547+
548+
// Isolation level for the transaction.
549+
IsolationLevel isolation_level = 6;
503550
}
504551

505552
// A transaction.

0 commit comments

Comments
 (0)