diff --git a/google/spanner/v1/transaction.proto b/google/spanner/v1/transaction.proto index 3577f797cbf41..49ab5cf5235aa 100644 --- a/google/spanner/v1/transaction.proto +++ b/google/spanner/v1/transaction.proto @@ -56,7 +56,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // // Queries on change streams must be performed with the snapshot read-only // transaction mode, specifying a strong read. Please see -// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong] for more details. +// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong] +// for more details. // // 3. Partitioned DML. This type of transaction is used to execute // a single Partitioned DML statement. Partitioned DML partitions @@ -192,7 +193,8 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // Queries on change streams (see below for more details) must also specify // the strong read timestamp bound. // -// See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. +// See +// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. // // Exact staleness: // @@ -213,7 +215,9 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // equivalent boundedly stale concurrency modes. On the other hand, // boundedly stale reads usually return fresher results. // -// See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and +// See +// [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] +// and // [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness]. // // Bounded staleness: @@ -243,7 +247,9 @@ option ruby_package = "Google::Cloud::Spanner::V1"; // which rows will be read, it can only be used with single-use // read-only transactions. // -// See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and +// See +// [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] +// and // [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp]. // // Old read timestamps and garbage collection: @@ -349,14 +355,34 @@ message TransactionOptions { // Message type to initiate a read-write transaction. Currently this // transaction type has no options. message ReadWrite { + // `ReadLockMode` is used to set the read lock mode for read-write + // transactions. + enum ReadLockMode { + // Default value. + // + // If the value is not specified, the pessimistic read lock is used. + READ_LOCK_MODE_UNSPECIFIED = 0; - } + // Pessimistic lock mode. + // + // Read locks are acquired immediately on read. + PESSIMISTIC = 1; - // Message type to initiate a Partitioned DML transaction. - message PartitionedDml { + // Optimistic lock mode. + // + // Locks for reads within the transaction are not acquired on read. + // Instead the locks are acquired on a commit to validate that + // read/queried data has not changed since the transaction started. + OPTIMISTIC = 2; + } + // Read lock mode for the transaction. + ReadLockMode read_lock_mode = 1; } + // Message type to initiate a Partitioned DML transaction. + message PartitionedDml {} + // Message type to initiate a read-only transaction. message ReadOnly { // How to choose the timestamp for the read-only transaction. @@ -421,7 +447,8 @@ message TransactionOptions { } // If true, the Cloud Spanner-selected read timestamp is included in - // the [Transaction][google.spanner.v1.Transaction] message that describes the transaction. + // the [Transaction][google.spanner.v1.Transaction] message that describes + // the transaction. bool return_read_timestamp = 6; } @@ -475,7 +502,8 @@ message Transaction { // [Read][google.spanner.v1.Spanner.Read] or // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs. // -// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more information about transactions. +// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more +// information about transactions. message TransactionSelector { // If no fields are set, the default is a single use transaction // with strong concurrency. @@ -490,7 +518,8 @@ message TransactionSelector { // Begin a new transaction and execute this read or SQL query in // it. The transaction ID of the new transaction is returned in - // [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], which is a [Transaction][google.spanner.v1.Transaction]. + // [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], + // which is a [Transaction][google.spanner.v1.Transaction]. TransactionOptions begin = 3; } }