@@ -20,6 +20,7 @@ import "google/api/annotations.proto";
2020import "google/api/client.proto" ;
2121import "google/api/field_behavior.proto" ;
2222import "google/api/resource.proto" ;
23+ import "google/protobuf/duration.proto" ;
2324import "google/protobuf/empty.proto" ;
2425import "google/protobuf/struct.proto" ;
2526import "google/protobuf/timestamp.proto" ;
@@ -219,6 +220,12 @@ service Spanner {
219220 // transactions. However, it can also happen for a variety of other
220221 // reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
221222 // the transaction from the beginning, re-using the same session.
223+ //
224+ // On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
225+ // for example, if the client job experiences a 1+ hour networking failure.
226+ // At that point, Cloud Spanner has lost track of the transaction outcome and
227+ // we recommend that you perform another read from the database to see the
228+ // state of things as they are now.
222229 rpc Commit (CommitRequest ) returns (CommitResponse ) {
223230 option (google.api.http ) = {
224231 post : "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:commit"
@@ -331,9 +338,8 @@ message Session {
331338 pattern : "projects/{project}/instances/{instance}/databases/{database}/sessions/{session}"
332339 };
333340
334- // The name of the session. This is always system-assigned; values provided
335- // when creating a session are ignored.
336- string name = 1 ;
341+ // Output only. The name of the session. This is always system-assigned.
342+ string name = 1 [(google.api.field_behavior ) = OUTPUT_ONLY ];
337343
338344 // The labels for the session.
339345 //
@@ -347,11 +353,11 @@ message Session {
347353 map <string , string > labels = 2 ;
348354
349355 // Output only. The timestamp when the session is created.
350- google.protobuf.Timestamp create_time = 3 ;
356+ google.protobuf.Timestamp create_time = 3 [ (google.api .field_behavior ) = OUTPUT_ONLY ] ;
351357
352358 // Output only. The approximate timestamp when the session is last used. It is
353359 // typically earlier than the actual last use time.
354- google.protobuf.Timestamp approximate_last_use_time = 4 ;
360+ google.protobuf.Timestamp approximate_last_use_time = 4 [ (google.api .field_behavior ) = OUTPUT_ONLY ] ;
355361}
356362
357363// The request for [GetSession][google.spanner.v1.Spanner.GetSession].
@@ -438,6 +444,9 @@ message ExecuteSqlRequest {
438444 // SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
439445 // with an invalid optimizer version will fail with a syntax error
440446 // (`INVALID_ARGUMENT`) status.
447+ // See
448+ // https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer
449+ // for more information on managing the query optimizer.
441450 //
442451 // The `optimizer_version` statement hint has precedence over this setting.
443452 string optimizer_version = 1 ;
@@ -483,8 +492,9 @@ message ExecuteSqlRequest {
483492 // Parameter names and values that bind to placeholders in the SQL string.
484493 //
485494 // A parameter placeholder consists of the `@` character followed by the
486- // parameter name (for example, `@firstName`). Parameter names can contain
487- // letters, numbers, and underscores.
495+ // parameter name (for example, `@firstName`). Parameter names must conform
496+ // to the naming requirements of identifiers as specified at
497+ // https://cloud.google.com/spanner/docs/lexical#identifiers.
488498 //
489499 // Parameters can appear anywhere that a literal value is expected. The same
490500 // parameter name can be used more than once, for example:
@@ -884,12 +894,34 @@ message CommitRequest {
884894 // mutations are applied atomically, in the order they appear in
885895 // this list.
886896 repeated Mutation mutations = 4 ;
897+
898+ // If `true`, then statistics related to the transaction will be included in
899+ // the [CommitResponse][google.spanner.v1.CommitResponse.commit_stats]. Default value is
900+ // `false`.
901+ bool return_commit_stats = 5 ;
887902}
888903
889904// The response for [Commit][google.spanner.v1.Spanner.Commit].
890905message CommitResponse {
906+ // Additional statistics about a commit.
907+ message CommitStats {
908+ // The total number of mutations for the transaction. Knowing the
909+ // `mutation_count` value can help you maximize the number of mutations
910+ // in a transaction and minimize the number of API round trips. You can
911+ // also monitor this value to prevent transactions from exceeding the system
912+ // [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data).
913+ // If the number of mutations exceeds the limit, the server returns
914+ // [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT).
915+ int64 mutation_count = 1 ;
916+ }
917+
891918 // The Cloud Spanner timestamp at which the transaction committed.
892919 google.protobuf.Timestamp commit_timestamp = 1 ;
920+
921+ // The statistics about this Commit. Not returned by default.
922+ // For more information, see
923+ // [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats].
924+ CommitStats commit_stats = 2 ;
893925}
894926
895927// The request for [Rollback][google.spanner.v1.Spanner.Rollback].
0 commit comments