Skip to content

Commit

Permalink
feat: Update transaction.proto to include different lock modes (#1723)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 481838475

Source-Link: https://togithub.com/googleapis/googleapis/commit/922f1f33bb239addc9816fbbecbf15376e03a4aa

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/bf32c6e413d4d7fd3c99b725fab653eb983d9dd6
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmYzMmM2ZTQxM2Q0ZDdmZDNjOTliNzI1ZmFiNjUzZWI5ODNkOWRkNiJ9

feat: Update result_set.proto to return undeclared parameters in ExecuteSql API
PiperOrigin-RevId: 480025979

Source-Link: https://togithub.com/googleapis/googleapis/commit/cb6fbe8784479b22af38c09a5039d8983e894566

Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/bf166b89d2a6aa3510374387af0f45e4828dea03
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmYxNjZiODlkMmE2YWEzNTEwMzc0Mzg3YWYwZjQ1ZTQ4MjhkZWEwMyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Oct 21, 2022
1 parent ee12356 commit eaa445e
Show file tree
Hide file tree
Showing 5 changed files with 185 additions and 14 deletions.
12 changes: 12 additions & 0 deletions protos/google/spanner/v1/result_set.proto
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,18 @@ message ResultSetMetadata {
// If the read or SQL query began a transaction as a side-effect, the
// information about the new transaction is yielded here.
Transaction transaction = 2;

// A SQL query can be parameterized. In PLAN mode, these parameters can be
// undeclared. This indicates the field names and types for those undeclared
// parameters in the SQL query. For example, a SQL query like `"SELECT * FROM
// Users where UserId = @userId and UserName = @userName "` could return a
// `undeclared_parameters` value like:
//
// "fields": [
// { "name": "UserId", "type": { "code": "INT64" } },
// { "name": "UserName", "type": { "code": "STRING" } },
// ]
StructType undeclared_parameters = 3;
}

// Additional statistics about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet].
Expand Down
49 changes: 39 additions & 10 deletions protos/google/spanner/v1/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
//
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.
Expand All @@ -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;
}
}
22 changes: 22 additions & 0 deletions protos/protos.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 93 additions & 3 deletions protos/protos.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eaa445e

Please sign in to comment.