Skip to content

Commit

Permalink
feat: Update TransactionOptions to include new option exclude_txn_fro…
Browse files Browse the repository at this point in the history
…m_change_streams (#1998)

* feat(spanner): add field for multiplexed session in spanner.proto
docs: update comments

PiperOrigin-RevId: 607015598

Source-Link: googleapis/googleapis@8e8a37d

Source-Link: googleapis/googleapis-gen@0b51730
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGI1MTczMDhkY2MzOTBkMGI4MjFmOGE1ZDk4MmNiY2E5ZTU2NDAxMCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Update TransactionOptions to include new option exclude_txn_from_change_streams

PiperOrigin-RevId: 607807587

Source-Link: googleapis/googleapis@d8af2d6

Source-Link: googleapis/googleapis-gen@601de71
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjAxZGU3MTdmMWUzNDJmZWFkYTdlMDFmNWRhNTI1NDY1YTU4OTBkOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sri Harsha CH <57220027+harshachinta@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 22, 2024
1 parent ee88d04 commit 937a7a1
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 6 deletions.
34 changes: 29 additions & 5 deletions protos/google/spanner/v1/spanner.proto
Expand Up @@ -402,6 +402,15 @@ message Session {

// The database role which created this session.
string creator_role = 5;

// Optional. If true, specifies a multiplexed session. A multiplexed session
// may be used for multiple, concurrent read-only operations but can not be
// used for read-write transactions, partitioned reads, or partitioned
// queries. Multiplexed sessions can be created via
// [CreateSession][google.spanner.v1.Spanner.CreateSession] but not via
// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
// Multiplexed sessions may not be deleted nor listed.
bool multiplexed = 6 [(google.api.field_behavior) = OPTIONAL];
}

// The request for [GetSession][google.spanner.v1.Spanner.GetSession].
Expand Down Expand Up @@ -546,7 +555,7 @@ message DirectedReadOptions {
// * `location:us-east1` --> The "us-east1" replica(s) of any available type
// will be used to process the request.
// * `type:READ_ONLY` --> The "READ_ONLY" type replica(s) in nearest
// . available location will be used to process the
// available location will be used to process the
// request.
// * `location:us-east1 type:READ_ONLY` --> The "READ_ONLY" type replica(s)
// in location "us-east1" will be used to process
Expand Down Expand Up @@ -590,8 +599,7 @@ message DirectedReadOptions {
repeated ReplicaSelection replica_selections = 1;
}

// Required. Replicas indicates the order in which replicas should be
// considered. At most one of either include_replicas or exclude_replicas
// Required. At most one of either include_replicas or exclude_replicas
// should be present in the message.
oneof replicas {
// Include_replicas indicates the order of replicas (as they appear in
Expand All @@ -601,8 +609,9 @@ message DirectedReadOptions {
// may fail due to `DEADLINE_EXCEEDED` errors.
IncludeReplicas include_replicas = 1;

// Exclude_replicas indicates that should be excluded from serving
// requests. Spanner will not route requests to the replicas in this list.
// Exclude_replicas indicates that specified replicas should be excluded
// from serving requests. Spanner will not route requests to the replicas
// in this list.
ExcludeReplicas exclude_replicas = 2;
}
}
Expand Down Expand Up @@ -1211,6 +1220,21 @@ message BatchWriteRequest {
// Required. The groups of mutations to be applied.
repeated MutationGroup mutation_groups = 4
[(google.api.field_behavior) = REQUIRED];

// Optional. When `exclude_txn_from_change_streams` is set to `true`:
// * Mutations from all transactions in this batch write operation will not
// be recorded in change streams with DDL option `allow_txn_exclusion=true`
// that are tracking columns modified by these transactions.
// * Mutations from all transactions in this batch write operation will be
// recorded in change streams with DDL option `allow_txn_exclusion=false or
// not set` that are tracking columns modified by these transactions.
//
// When `exclude_txn_from_change_streams` is set to `false` or not set,
// mutations from all transactions in this batch write operation will be
// recorded in all change streams that are tracking columns modified by these
// transactions.
bool exclude_txn_from_change_streams = 5
[(google.api.field_behavior) = OPTIONAL];
}

// The result of applying a batch of mutations.
Expand Down
18 changes: 17 additions & 1 deletion protos/google/spanner/v1/transaction.proto
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -475,6 +475,22 @@ message TransactionOptions {
// on the `session` resource.
ReadOnly read_only = 2;
}

// When `exclude_txn_from_change_streams` is set to `true`:
// * Mutations from this transaction will not be recorded in change streams
// with DDL option `allow_txn_exclusion=true` that are tracking columns
// modified by these transactions.
// * Mutations from this transaction will be recorded in change streams with
// DDL option `allow_txn_exclusion=false or not set` that are tracking
// columns modified by these transactions.
//
// When `exclude_txn_from_change_streams` is set to `false` or not set,
// mutations from this transaction will be recorded in all change streams that
// are tracking columns modified by these transactions.
// `exclude_txn_from_change_streams` may only be specified for read-write or
// partitioned-dml transactions, otherwise the API will return an
// `INVALID_ARGUMENT` error.
bool exclude_txn_from_change_streams = 5;
}

// A transaction.
Expand Down
18 changes: 18 additions & 0 deletions protos/protos.d.ts

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

0 comments on commit 937a7a1

Please sign in to comment.