Skip to content

Commit 0eeb1be

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add Send and Ack mutations for Queues
feat: Add QueryAdvisorResult for query plan docs: Update description for the BatchCreateSessionsRequest and Session docs: Update description for the IsolationLevel PiperOrigin-RevId: 832425466
1 parent 04085e5 commit 0eeb1be

File tree

4 files changed

+76
-8
lines changed

4 files changed

+76
-8
lines changed

google/spanner/v1/mutation.proto

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package google.spanner.v1;
1818

1919
import "google/api/field_behavior.proto";
2020
import "google/protobuf/struct.proto";
21+
import "google/protobuf/timestamp.proto";
2122
import "google/spanner/v1/keys.proto";
2223

2324
option csharp_namespace = "Google.Cloud.Spanner.V1";
@@ -75,6 +76,40 @@ message Mutation {
7576
KeySet key_set = 2 [(google.api.field_behavior) = REQUIRED];
7677
}
7778

79+
// Arguments to [send][google.spanner.v1.Mutation.send] operations.
80+
message Send {
81+
// Required. The queue to which the message will be sent.
82+
string queue = 1 [(google.api.field_behavior) = REQUIRED];
83+
84+
// Required. The primary key of the message to be sent.
85+
google.protobuf.ListValue key = 2 [(google.api.field_behavior) = REQUIRED];
86+
87+
// The time at which Spanner will begin attempting to deliver the message.
88+
// If `deliver_time` is not set, Spanner will deliver the message
89+
// immediately. If `deliver_time` is in the past, Spanner will replace it
90+
// with a value closer to the current time.
91+
google.protobuf.Timestamp deliver_time = 3;
92+
93+
// The payload of the message.
94+
google.protobuf.Value payload = 4;
95+
}
96+
97+
// Arguments to [ack][google.spanner.v1.Mutation.ack] operations.
98+
message Ack {
99+
// Required. The queue where the message to be acked is stored.
100+
string queue = 1 [(google.api.field_behavior) = REQUIRED];
101+
102+
// Required. The primary key of the message to be acked.
103+
google.protobuf.ListValue key = 2 [(google.api.field_behavior) = REQUIRED];
104+
105+
// By default, an attempt to ack a message that does not exist will fail
106+
// with a `NOT_FOUND` error. With `ignore_not_found` set to true, the ack
107+
// will succeed even if the message does not exist. This is useful for
108+
// unconditionally acking a message, even if it is missing or has already
109+
// been acked.
110+
bool ignore_not_found = 3;
111+
}
112+
78113
// Required. The operation to perform.
79114
oneof operation {
80115
// Insert new rows in a table. If any of the rows already exist,
@@ -111,5 +146,11 @@ message Mutation {
111146
// Delete rows from a table. Succeeds whether or not the named
112147
// rows were present.
113148
Delete delete = 5;
149+
150+
// Send a message to a queue.
151+
Send send = 6;
152+
153+
// Ack a message from a queue.
154+
Ack ack = 7;
114155
}
115156
}

google/spanner/v1/query_plan.proto

Lines changed: 25 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

2122
option csharp_namespace = "Google.Cloud.Spanner.V1";
@@ -122,10 +123,34 @@ message PlanNode {
122123
google.protobuf.Struct execution_stats = 7;
123124
}
124125

126+
// Output of query advisor analysis.
127+
message QueryAdvisorResult {
128+
// Recommendation to add new indexes to run queries more efficiently.
129+
message IndexAdvice {
130+
// Optional. DDL statements to add new indexes that will improve the query.
131+
repeated string ddl = 1 [(google.api.field_behavior) = OPTIONAL];
132+
133+
// Optional. Estimated latency improvement factor. For example if the query
134+
// currently takes 500 ms to run and the estimated latency with new indexes
135+
// is 100 ms this field will be 5.
136+
double improvement_factor = 2 [(google.api.field_behavior) = OPTIONAL];
137+
}
138+
139+
// Optional. Index Recommendation for a query. This is an optional field and
140+
// the recommendation will only be available when the recommendation
141+
// guarantees significant improvement in query performance.
142+
repeated IndexAdvice index_advice = 1
143+
[(google.api.field_behavior) = OPTIONAL];
144+
}
145+
125146
// Contains an ordered list of nodes appearing in the query plan.
126147
message QueryPlan {
127148
// The nodes in the query plan. Plan nodes are returned in pre-order starting
128149
// with the plan root. Each [PlanNode][google.spanner.v1.PlanNode]'s `id`
129150
// corresponds to its index in `plan_nodes`.
130151
repeated PlanNode plan_nodes = 1;
152+
153+
// Optional. The advise/recommendations for a query. Currently this field will
154+
// be serving index recommendations for a query.
155+
QueryAdvisorResult query_advice = 2 [(google.api.field_behavior) = OPTIONAL];
131156
}

google/spanner/v1/spanner.proto

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,10 @@ message BatchCreateSessionsRequest {
360360
// Parameters to apply to each created session.
361361
Session session_template = 2;
362362

363-
// Required. The number of sessions to be created in this batch call.
364-
// The API can return fewer than the requested number of sessions. If a
365-
// specific number of sessions are desired, the client can make additional
366-
// calls to `BatchCreateSessions` (adjusting
363+
// Required. The number of sessions to be created in this batch call. At least
364+
// one session is created. The API can return fewer than the requested number
365+
// of sessions. If a specific number of sessions are desired, the client can
366+
// make additional calls to `BatchCreateSessions` (adjusting
367367
// [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count]
368368
// as necessary).
369369
int32 session_count = 3 [(google.api.field_behavior) = REQUIRED];
@@ -412,8 +412,8 @@ message Session {
412412
string creator_role = 5;
413413

414414
// Optional. If `true`, specifies a multiplexed session. Use a multiplexed
415-
// session for multiple, concurrent read-only operations. Don't use them for
416-
// read-write transactions, partitioned reads, or partitioned queries. Use
415+
// session for multiple, concurrent operations including any combination of
416+
// read-only and read-write transactions. Use
417417
// [`sessions.create`][google.spanner.v1.Spanner.CreateSession] to create
418418
// multiplexed sessions. Don't use
419419
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions] to

google/spanner/v1/transaction.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ message TransactionOptions {
153153
bool return_read_timestamp = 6;
154154
}
155155

156-
// `IsolationLevel` is used when setting `isolation_level` for a transaction.
156+
// `IsolationLevel` is used when setting the [isolation
157+
// level](https://cloud.google.com/spanner/docs/isolation-levels) for a
158+
// transaction.
157159
enum IsolationLevel {
158160
// Default value.
159161
//
@@ -178,7 +180,7 @@ message TransactionOptions {
178180
// `SERIALIZABLE` transactions, only write-write conflicts are detected in
179181
// snapshot transactions.
180182
//
181-
// This isolation level does not support Read-only and Partitioned DML
183+
// This isolation level does not support read-only and partitioned DML
182184
// transactions.
183185
//
184186
// When `REPEATABLE_READ` is specified on a read-write transaction, the

0 commit comments

Comments
 (0)