Skip to content

Commit 14ff41c

Browse files
authored
Merge branch 'main' into multiplexed-session-support-read-only
2 parents 43d48df + e4d389a commit 14ff41c

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)