google-cloud-spanner 2.34.0 → 2.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f2092db61c2ca6c7797176db72845ee4889255ed94d641d27ea8b5ac42f62b7
|
|
4
|
+
data.tar.gz: 3430361284c44739652f9ca1785a902cfccafc813e9b7833df854f0836df98c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4edac28e59ec12727331f7810325de889c71154d28a3fb1dc155ec8d92f2f3b0a5a3e1168cc7a7949befd72bb13da25194107041021872778486ea8744a49c00
|
|
7
|
+
data.tar.gz: '018fba01b2d4dd8b16483a4a752c7768e8f512637973bdaf080cf7da8e14e20db8cae51ca0843de1b51dffdadfc4c0e5867bbbd94402d12cc8ecb9373416e1fa'
|
data/CHANGELOG.md
CHANGED
|
@@ -2227,11 +2227,11 @@ module Google
|
|
|
2227
2227
|
request_options, tag_type: :transaction_tag
|
|
2228
2228
|
|
|
2229
2229
|
@pool.with_session do |session|
|
|
2230
|
+
transaction_tag = request_options[:transaction_tag] if request_options
|
|
2230
2231
|
tx = session.create_empty_transaction \
|
|
2231
|
-
exclude_txn_from_change_streams: exclude_txn_from_change_streams,
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
end
|
|
2232
|
+
exclude_txn_from_change_streams: exclude_txn_from_change_streams,
|
|
2233
|
+
read_lock_mode: read_lock_mode,
|
|
2234
|
+
transaction_tag: transaction_tag
|
|
2235
2235
|
|
|
2236
2236
|
begin
|
|
2237
2237
|
Thread.current[IS_TRANSACTION_RUNNING_KEY] = true
|
|
@@ -2289,11 +2289,9 @@ module Google
|
|
|
2289
2289
|
tx = session.create_empty_transaction(
|
|
2290
2290
|
exclude_txn_from_change_streams: exclude_txn_from_change_streams,
|
|
2291
2291
|
previous_transaction_id: previous_transaction_id,
|
|
2292
|
-
read_lock_mode: read_lock_mode
|
|
2292
|
+
read_lock_mode: read_lock_mode,
|
|
2293
|
+
transaction_tag: transaction_tag
|
|
2293
2294
|
)
|
|
2294
|
-
if request_options
|
|
2295
|
-
tx.transaction_tag = request_options[:transaction_tag]
|
|
2296
|
-
end
|
|
2297
2295
|
retry
|
|
2298
2296
|
rescue StandardError => e
|
|
2299
2297
|
# Rollback transaction when handling unexpected error
|
|
@@ -1488,17 +1488,24 @@ module Google
|
|
|
1488
1488
|
# @param exclude_txn_from_change_streams [::Boolean] Optional. Defaults to `false`.
|
|
1489
1489
|
# When `exclude_txn_from_change_streams` is set to `true`, it prevents read
|
|
1490
1490
|
# or write transactions from being tracked in change streams.
|
|
1491
|
+
# @param request_options [::Hash, nil] Optional. Common request options.
|
|
1492
|
+
# Example option: `:priority`.
|
|
1491
1493
|
# @private
|
|
1492
1494
|
# @return [::Google::Cloud::Spanner::Transaction]
|
|
1493
|
-
def create_transaction exclude_txn_from_change_streams: false, read_lock_mode: nil
|
|
1495
|
+
def create_transaction exclude_txn_from_change_streams: false, read_lock_mode: nil,
|
|
1496
|
+
request_options: nil
|
|
1494
1497
|
route_to_leader = LARHeaders.begin_transaction true
|
|
1498
|
+
request_options = Convert.to_request_options request_options, tag_type: :transaction_tag
|
|
1499
|
+
transaction_tag = request_options[:transaction_tag] if request_options
|
|
1495
1500
|
tx_grpc = service.begin_transaction path,
|
|
1496
1501
|
route_to_leader: route_to_leader,
|
|
1497
1502
|
exclude_txn_from_change_streams: exclude_txn_from_change_streams,
|
|
1503
|
+
request_options: request_options,
|
|
1498
1504
|
read_lock_mode: read_lock_mode
|
|
1499
1505
|
Transaction.from_grpc \
|
|
1500
1506
|
tx_grpc, self,
|
|
1501
|
-
exclude_txn_from_change_streams: exclude_txn_from_change_streams, read_lock_mode: read_lock_mode
|
|
1507
|
+
exclude_txn_from_change_streams: exclude_txn_from_change_streams, read_lock_mode: read_lock_mode,
|
|
1508
|
+
transaction_tag: transaction_tag
|
|
1502
1509
|
end
|
|
1503
1510
|
|
|
1504
1511
|
# Creates a new empty transaction wrapper without a server-side object.
|
|
@@ -1512,12 +1519,15 @@ module Google
|
|
|
1512
1519
|
# An id of the previous transaction, if this new transaction wrapper is being created
|
|
1513
1520
|
# as a part of a retry. Previous transaction id should be added to TransactionOptions
|
|
1514
1521
|
# of a new ReadWrite transaction when retry is attempted.
|
|
1522
|
+
# @param transaction_tag [::String, nil] Optional.
|
|
1523
|
+
# A tag used for statistics collection about this transaction.
|
|
1515
1524
|
# @private
|
|
1516
1525
|
# @return [::Google::Cloud::Spanner::Transaction] The new *empty-wrapper* transaction object.
|
|
1517
1526
|
def create_empty_transaction exclude_txn_from_change_streams: false, previous_transaction_id: nil,
|
|
1518
|
-
read_lock_mode: nil
|
|
1527
|
+
read_lock_mode: nil, transaction_tag: nil
|
|
1519
1528
|
Transaction.from_grpc nil, self, exclude_txn_from_change_streams: exclude_txn_from_change_streams,
|
|
1520
|
-
previous_transaction_id: previous_transaction_id, read_lock_mode: read_lock_mode
|
|
1529
|
+
previous_transaction_id: previous_transaction_id, read_lock_mode: read_lock_mode,
|
|
1530
|
+
transaction_tag: transaction_tag
|
|
1521
1531
|
end
|
|
1522
1532
|
|
|
1523
1533
|
# If the session is non-multiplexed, keeps the session alive by executing `"SELECT 1"`.
|
|
@@ -124,13 +124,17 @@ module Google
|
|
|
124
124
|
# An id of the previous transaction, if this new transaction wrapper is being created
|
|
125
125
|
# as a part of a retry. Previous transaction id should be added to TransactionOptions
|
|
126
126
|
# of a new ReadWrite transaction when retry is attempted.
|
|
127
|
+
# @param transaction_tag [::String, nil] Optional.
|
|
128
|
+
# A tag used for statistics collection about this transaction.
|
|
127
129
|
# @private
|
|
128
130
|
# @return [::Google::Cloud::Spanner::Transaction]
|
|
129
|
-
def initialize grpc, session, exclude_txn_from_change_streams, previous_transaction_id: nil,
|
|
131
|
+
def initialize grpc, session, exclude_txn_from_change_streams, previous_transaction_id: nil,
|
|
132
|
+
read_lock_mode: nil, transaction_tag: nil
|
|
130
133
|
@grpc = grpc
|
|
131
134
|
@session = session
|
|
132
135
|
@exclude_txn_from_change_streams = exclude_txn_from_change_streams
|
|
133
136
|
@read_lock_mode = read_lock_mode
|
|
137
|
+
@transaction_tag = transaction_tag
|
|
134
138
|
|
|
135
139
|
# throwing away empty strings for simplicity
|
|
136
140
|
unless previous_transaction_id.nil? || previous_transaction_id.empty?
|
|
@@ -1253,12 +1257,14 @@ module Google
|
|
|
1253
1257
|
# An id of the previous transaction, if this new transaction wrapper is being created
|
|
1254
1258
|
# as a part of a retry. Previous transaction id should be added to TransactionOptions
|
|
1255
1259
|
# of a new ReadWrite transaction when retry is attempted.
|
|
1260
|
+
# @param transaction_tag [::String, nil] Optional.
|
|
1261
|
+
# A tag used for statistics collection about this transaction.
|
|
1256
1262
|
# @private
|
|
1257
1263
|
# @return [::Google::Cloud::Spanner::Transaction]
|
|
1258
1264
|
def self.from_grpc grpc, session, exclude_txn_from_change_streams: false, previous_transaction_id: nil,
|
|
1259
|
-
read_lock_mode: nil
|
|
1265
|
+
read_lock_mode: nil, transaction_tag: nil
|
|
1260
1266
|
new grpc, session, exclude_txn_from_change_streams, previous_transaction_id: previous_transaction_id,
|
|
1261
|
-
read_lock_mode: read_lock_mode
|
|
1267
|
+
read_lock_mode: read_lock_mode, transaction_tag: transaction_tag
|
|
1262
1268
|
end
|
|
1263
1269
|
|
|
1264
1270
|
##
|
|
@@ -1297,6 +1303,7 @@ read_lock_mode: read_lock_mode
|
|
|
1297
1303
|
return if existing_transaction?
|
|
1298
1304
|
ensure_session!
|
|
1299
1305
|
route_to_leader = LARHeaders.begin_transaction true
|
|
1306
|
+
request_options = build_request_options request_options
|
|
1300
1307
|
|
|
1301
1308
|
# TODO: [virost@, 2025-10] fix this so it uses tx_selector
|
|
1302
1309
|
# instead of re-creating it within `Service#begin_transaction`
|
|
@@ -1377,7 +1384,7 @@ read_lock_mode: read_lock_mode
|
|
|
1377
1384
|
|
|
1378
1385
|
##
|
|
1379
1386
|
# @private Build request options. If transaction tag is set
|
|
1380
|
-
# then add
|
|
1387
|
+
# then add it to the request options.
|
|
1381
1388
|
def build_request_options options
|
|
1382
1389
|
options = Convert.to_request_options options, tag_type: :request_tag
|
|
1383
1390
|
|