Skip to content

Commit 6598bb8

Browse files
Google APIscopybara-github
authored andcommitted
feat: add RPC Priority request options
PiperOrigin-RevId: 364449524
1 parent 2124b62 commit 6598bb8

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

google/spanner/v1/spanner.proto

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,42 @@ message DeleteSessionRequest {
425425
];
426426
}
427427

428+
// Common request options for various APIs.
429+
message RequestOptions {
430+
// The relative priority for requests. Note that priority is not applicable
431+
// for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
432+
//
433+
// The priority acts as a hint to the Cloud Spanner scheduler and does not
434+
// guarantee priority or order of execution. For example:
435+
//
436+
// * Some parts of a write operation always execute at `PRIORITY_HIGH`,
437+
// regardless of the specified priority. This may cause you to see an
438+
// increase in high priority workload even when executing a low priority
439+
// request. This can also potentially cause a priority inversion where a
440+
// lower priority request will be fulfilled ahead of a higher priority
441+
// request.
442+
// * If a transaction contains multiple operations with different priorities,
443+
// Cloud Spanner does not guarantee to process the higher priority
444+
// operations first. There may be other constraints to satisfy, such as
445+
// order of operations.
446+
enum Priority {
447+
// `PRIORITY_UNSPECIFIED` is equivalent to `PRIORITY_HIGH`.
448+
PRIORITY_UNSPECIFIED = 0;
449+
450+
// This specifies that the request is low priority.
451+
PRIORITY_LOW = 1;
452+
453+
// This specifies that the request is medium priority.
454+
PRIORITY_MEDIUM = 2;
455+
456+
// This specifies that the request is high priority.
457+
PRIORITY_HIGH = 3;
458+
}
459+
460+
// Priority for the request.
461+
Priority priority = 1;
462+
}
463+
428464
// The request for [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
429465
// [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].
430466
message ExecuteSqlRequest {
@@ -576,6 +612,9 @@ message ExecuteSqlRequest {
576612

577613
// Query optimizer configuration to use for the given query.
578614
QueryOptions query_options = 10;
615+
616+
// Common options for this request.
617+
RequestOptions request_options = 11;
579618
}
580619

581620
// The request for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].
@@ -642,6 +681,9 @@ message ExecuteBatchDmlRequest {
642681
// sequence number, the transaction may be aborted. Replays of previously
643682
// handled requests will yield the same response as the first execution.
644683
int64 seqno = 4 [(google.api.field_behavior) = REQUIRED];
684+
685+
// Common options for this request.
686+
RequestOptions request_options = 5;
645687
}
646688

647689
// The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
@@ -876,6 +918,9 @@ message ReadRequest {
876918
// match for the values of fields common to this message and the
877919
// PartitionReadRequest message used to create this partition_token.
878920
bytes partition_token = 10;
921+
922+
// Common options for this request.
923+
RequestOptions request_options = 11;
879924
}
880925

881926
// The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].
@@ -890,6 +935,13 @@ message BeginTransactionRequest {
890935

891936
// Required. Options for the new transaction.
892937
TransactionOptions options = 2 [(google.api.field_behavior) = REQUIRED];
938+
939+
// Common options for this request.
940+
// Priority is ignored for this request. Setting the priority in this
941+
// request_options struct will not do anything. To set the priority for a
942+
// transaction, set it on the reads and writes that are part of this
943+
// transaction instead.
944+
RequestOptions request_options = 3;
893945
}
894946

895947
// The request for [Commit][google.spanner.v1.Spanner.Commit].
@@ -928,6 +980,9 @@ message CommitRequest {
928980
// the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. Default value is
929981
// `false`.
930982
bool return_commit_stats = 5;
983+
984+
// Common options for this request.
985+
RequestOptions request_options = 6;
931986
}
932987

933988
// The response for [Commit][google.spanner.v1.Spanner.Commit].

0 commit comments

Comments
 (0)