Skip to content

feat(spanner): support max_commit_delay in Spanner transactions #2854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into max-commit-delay-rahul
  • Loading branch information
nginsberg-google committed Jan 30, 2024
commit 697592a45b0609941aad7d5a91c8549808c09f9a
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,18 @@ public boolean getReturnCommitStats() {
public static final int MAX_COMMIT_DELAY_FIELD_NUMBER = 8;
private com.google.protobuf.Duration maxCommitDelay_;
/**
* <code>.google.protobuf.Duration max_commit_delay = 8;</code>
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>.google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @return Whether the maxCommitDelay field is set.
*/
Expand All @@ -390,7 +401,18 @@ public boolean hasMaxCommitDelay() {
return maxCommitDelay_ != null;
}
/**
* <code>.google.protobuf.Duration max_commit_delay = 8;</code>
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>.google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @return The maxCommitDelay.
*/
Expand All @@ -400,7 +422,20 @@ public com.google.protobuf.Duration getMaxCommitDelay() {
? com.google.protobuf.Duration.getDefaultInstance()
: maxCommitDelay_;
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>.google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
@java.lang.Override
public com.google.protobuf.DurationOrBuilder getMaxCommitDelayOrBuilder() {
return maxCommitDelay_ == null
Expand Down Expand Up @@ -1965,15 +2000,39 @@ public Builder clearReturnCommitStats() {
com.google.protobuf.DurationOrBuilder>
maxCommitDelayBuilder_;
/**
* <code>.google.protobuf.Duration max_commit_delay = 8;</code>
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @return Whether the maxCommitDelay field is set.
*/
public boolean hasMaxCommitDelay() {
return ((bitField0_ & 0x00000020) != 0);
}
/**
* <code>.google.protobuf.Duration max_commit_delay = 8;</code>
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*
* @return The maxCommitDelay.
*/
Expand All @@ -1986,7 +2045,21 @@ public com.google.protobuf.Duration getMaxCommitDelay() {
return maxCommitDelayBuilder_.getMessage();
}
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
public Builder setMaxCommitDelay(com.google.protobuf.Duration value) {
if (maxCommitDelayBuilder_ == null) {
if (value == null) {
Expand All @@ -2000,7 +2073,21 @@ public Builder setMaxCommitDelay(com.google.protobuf.Duration value) {
onChanged();
return this;
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
public Builder setMaxCommitDelay(com.google.protobuf.Duration.Builder builderForValue) {
if (maxCommitDelayBuilder_ == null) {
maxCommitDelay_ = builderForValue.build();
Expand All @@ -2011,7 +2098,21 @@ public Builder setMaxCommitDelay(com.google.protobuf.Duration.Builder builderFor
onChanged();
return this;
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
public Builder mergeMaxCommitDelay(com.google.protobuf.Duration value) {
if (maxCommitDelayBuilder_ == null) {
if (((bitField0_ & 0x00000020) != 0)
Expand All @@ -2028,7 +2129,21 @@ public Builder mergeMaxCommitDelay(com.google.protobuf.Duration value) {
onChanged();
return this;
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
public Builder clearMaxCommitDelay() {
bitField0_ = (bitField0_ & ~0x00000020);
maxCommitDelay_ = null;
Expand All @@ -2039,13 +2154,41 @@ public Builder clearMaxCommitDelay() {
onChanged();
return this;
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
public com.google.protobuf.Duration.Builder getMaxCommitDelayBuilder() {
bitField0_ |= 0x00000020;
onChanged();
return getMaxCommitDelayFieldBuilder().getBuilder();
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
public com.google.protobuf.DurationOrBuilder getMaxCommitDelayOrBuilder() {
if (maxCommitDelayBuilder_ != null) {
return maxCommitDelayBuilder_.getMessageOrBuilder();
Expand All @@ -2055,7 +2198,21 @@ public com.google.protobuf.DurationOrBuilder getMaxCommitDelayOrBuilder() {
: maxCommitDelay_;
}
}
/** <code>.google.protobuf.Duration max_commit_delay = 8;</code> */
/**
*
*
* <pre>
* Optional. The amount of latency this request is willing to incur in order
* to improve throughput. If this field is not set, Spanner assumes requests
* are relatively latency sensitive and automatically determines an
* appropriate delay time. You can specify a batching delay value between 0
* and 500 ms.
* </pre>
*
* <code>
* .google.protobuf.Duration max_commit_delay = 8 [(.google.api.field_behavior) = OPTIONAL];
* </code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.protobuf.Duration,
com.google.protobuf.Duration.Builder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "is.com/Session\022<\n\007options\030\002 \001(\0132%.google"
+ ".spanner.v1.TransactionOptionsB\004\342A\001\002\022:\n\017"
+ "request_options\030\003 \001(\0132!.google.spanner.v"
+ "1.RequestOptions\"\371\002\n\rCommitRequest\0228\n\007se"
+ "ssion\030\001 \001(\tB\'\342A\001\002\372A \n\036spanner.googleapis"
+ ".com/Session\022\030\n\016transaction_id\030\002 \001(\014H\000\022G"
+ "\n\026single_use_transaction\030\003 \001(\0132%.google."
Expand Down Expand Up @@ -422,6 +421,110 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
+ "er.googleapis.com/Database\022<projects/{pr"
+ "oject}/instances/{instance}/databases/{d"
+ "atabase}P\000b\006proto3"
=======
+ "\033\n\023return_commit_stats\030\005 \001(\010\0229\n\020max_comm"
+ "it_delay\030\010 \001(\0132\031.google.protobuf.Duratio"
+ "nB\004\342A\001\001\022:\n\017request_options\030\006 \001(\0132!.googl"
+ "e.spanner.v1.RequestOptionsB\r\n\013transacti"
+ "on\"i\n\017RollbackRequest\0228\n\007session\030\001 \001(\tB\'"
+ "\342A\001\002\372A \n\036spanner.googleapis.com/Session\022"
+ "\034\n\016transaction_id\030\002 \001(\014B\004\342A\001\002\"\243\002\n\021BatchW"
+ "riteRequest\0228\n\007session\030\001 \001(\tB\'\342A\001\002\372A \n\036s"
+ "panner.googleapis.com/Session\022:\n\017request"
+ "_options\030\003 \001(\0132!.google.spanner.v1.Reque"
+ "stOptions\022Q\n\017mutation_groups\030\004 \003(\01322.goo"
+ "gle.spanner.v1.BatchWriteRequest.Mutatio"
+ "nGroupB\004\342A\001\002\032E\n\rMutationGroup\0224\n\tmutatio"
+ "ns\030\001 \003(\0132\033.google.spanner.v1.MutationB\004\342"
+ "A\001\002\"\177\n\022BatchWriteResponse\022\017\n\007indexes\030\001 \003"
+ "(\005\022\"\n\006status\030\002 \001(\0132\022.google.rpc.Status\0224"
+ "\n\020commit_timestamp\030\003 \001(\0132\032.google.protob"
+ "uf.Timestamp2\213\030\n\007Spanner\022\246\001\n\rCreateSessi"
+ "on\022\'.google.spanner.v1.CreateSessionRequ"
+ "est\032\032.google.spanner.v1.Session\"P\332A\010data"
+ "base\202\323\344\223\002?\":/v1/{database=projects/*/ins"
+ "tances/*/databases/*}/sessions:\001*\022\340\001\n\023Ba"
+ "tchCreateSessions\022-.google.spanner.v1.Ba"
+ "tchCreateSessionsRequest\032..google.spanne"
+ "r.v1.BatchCreateSessionsResponse\"j\332A\026dat"
+ "abase,session_count\202\323\344\223\002K\"F/v1/{database"
+ "=projects/*/instances/*/databases/*}/ses"
+ "sions:batchCreate:\001*\022\227\001\n\nGetSession\022$.go"
+ "ogle.spanner.v1.GetSessionRequest\032\032.goog"
+ "le.spanner.v1.Session\"G\332A\004name\202\323\344\223\002:\0228/v"
+ "1/{name=projects/*/instances/*/databases"
+ "/*/sessions/*}\022\256\001\n\014ListSessions\022&.google"
+ ".spanner.v1.ListSessionsRequest\032\'.google"
+ ".spanner.v1.ListSessionsResponse\"M\332A\010dat"
+ "abase\202\323\344\223\002<\022:/v1/{database=projects/*/in"
+ "stances/*/databases/*}/sessions\022\231\001\n\rDele"
+ "teSession\022\'.google.spanner.v1.DeleteSess"
+ "ionRequest\032\026.google.protobuf.Empty\"G\332A\004n"
+ "ame\202\323\344\223\002:*8/v1/{name=projects/*/instance"
+ "s/*/databases/*/sessions/*}\022\243\001\n\nExecuteS"
+ "ql\022$.google.spanner.v1.ExecuteSqlRequest"
+ "\032\034.google.spanner.v1.ResultSet\"Q\202\323\344\223\002K\"F"
+ "/v1/{session=projects/*/instances/*/data"
+ "bases/*/sessions/*}:executeSql:\001*\022\276\001\n\023Ex"
+ "ecuteStreamingSql\022$.google.spanner.v1.Ex"
+ "ecuteSqlRequest\032#.google.spanner.v1.Part"
+ "ialResultSet\"Z\202\323\344\223\002T\"O/v1/{session=proje"
+ "cts/*/instances/*/databases/*/sessions/*"
+ "}:executeStreamingSql:\001*0\001\022\300\001\n\017ExecuteBa"
+ "tchDml\022).google.spanner.v1.ExecuteBatchD"
+ "mlRequest\032*.google.spanner.v1.ExecuteBat"
+ "chDmlResponse\"V\202\323\344\223\002P\"K/v1/{session=proj"
+ "ects/*/instances/*/databases/*/sessions/"
+ "*}:executeBatchDml:\001*\022\221\001\n\004Read\022\036.google."
+ "spanner.v1.ReadRequest\032\034.google.spanner."
+ "v1.ResultSet\"K\202\323\344\223\002E\"@/v1/{session=proje"
+ "cts/*/instances/*/databases/*/sessions/*"
+ "}:read:\001*\022\254\001\n\rStreamingRead\022\036.google.spa"
+ "nner.v1.ReadRequest\032#.google.spanner.v1."
+ "PartialResultSet\"T\202\323\344\223\002N\"I/v1/{session=p"
+ "rojects/*/instances/*/databases/*/sessio"
+ "ns/*}:streamingRead:\001*0\001\022\311\001\n\020BeginTransa"
+ "ction\022*.google.spanner.v1.BeginTransacti"
+ "onRequest\032\036.google.spanner.v1.Transactio"
+ "n\"i\332A\017session,options\202\323\344\223\002Q\"L/v1/{sessio"
+ "n=projects/*/instances/*/databases/*/ses"
+ "sions/*}:beginTransaction:\001*\022\353\001\n\006Commit\022"
+ " .google.spanner.v1.CommitRequest\032!.goog"
+ "le.spanner.v1.CommitResponse\"\233\001\332A sessio"
+ "n,transaction_id,mutations\332A(session,sin"
+ "gle_use_transaction,mutations\202\323\344\223\002G\"B/v1"
+ "/{session=projects/*/instances/*/databas"
+ "es/*/sessions/*}:commit:\001*\022\260\001\n\010Rollback\022"
+ "\".google.spanner.v1.RollbackRequest\032\026.go"
+ "ogle.protobuf.Empty\"h\332A\026session,transact"
+ "ion_id\202\323\344\223\002I\"D/v1/{session=projects/*/in"
+ "stances/*/databases/*/sessions/*}:rollba"
+ "ck:\001*\022\267\001\n\016PartitionQuery\022(.google.spanne"
+ "r.v1.PartitionQueryRequest\032$.google.span"
+ "ner.v1.PartitionResponse\"U\202\323\344\223\002O\"J/v1/{s"
+ "ession=projects/*/instances/*/databases/"
+ "*/sessions/*}:partitionQuery:\001*\022\264\001\n\rPart"
+ "itionRead\022\'.google.spanner.v1.PartitionR"
+ "eadRequest\032$.google.spanner.v1.Partition"
+ "Response\"T\202\323\344\223\002N\"I/v1/{session=projects/"
+ "*/instances/*/databases/*/sessions/*}:pa"
+ "rtitionRead:\001*\022\310\001\n\nBatchWrite\022$.google.s"
+ "panner.v1.BatchWriteRequest\032%.google.spa"
+ "nner.v1.BatchWriteResponse\"k\332A\027session,m"
+ "utation_groups\202\323\344\223\002K\"F/v1/{session=proje"
+ "cts/*/instances/*/databases/*/sessions/*"
+ "}:batchWrite:\001*0\001\032w\312A\026spanner.googleapis"
+ ".com\322A[https://www.googleapis.com/auth/c"
+ "loud-platform,https://www.googleapis.com"
+ "/auth/spanner.dataB\221\002\n\025com.google.spanne"
+ "r.v1B\014SpannerProtoP\001Z5cloud.google.com/g"
+ "o/spanner/apiv1/spannerpb;spannerpb\252\002\027Go"
+ "ogle.Cloud.Spanner.V1\312\002\027Google\\Cloud\\Spa"
+ "nner\\V1\352\002\032Google::Cloud::Spanner::V1\352A_\n"
+ "\037spanner.googleapis.com/Database\022<projec"
+ "ts/{project}/instances/{instance}/databa"
+ "ses/{database}P\000b\006proto3"
>>>>>>> main
};
descriptor =
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,13 @@ message CommitRequest {
// Default value is `false`.
bool return_commit_stats = 5;

google.protobuf.Duration max_commit_delay = 8;
// Optional. The amount of latency this request is willing to incur in order
// to improve throughput. If this field is not set, Spanner assumes requests
// are relatively latency sensitive and automatically determines an
// appropriate delay time. You can specify a batching delay value between 0
// and 500 ms.
google.protobuf.Duration max_commit_delay = 8
[(google.api.field_behavior) = OPTIONAL];

// Common options for this request.
RequestOptions request_options = 6;
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.