Skip to content
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

feat: Update TransactionOptions to include new option exclude_txn_from_change_streams #1998

Merged
merged 5 commits into from Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.