Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Spanner/src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,12 +444,14 @@ public function commit(array $options = []): Timestamp
'requestOptions' => $this->requestOptions,
'transactionOptions' => $this->transactionOptions,
'singleUse' => $this->transactionSelector['singleUse'] ?? null,
'tag' => $this->tag ?? null,
]);
if (!empty($mutations)) {
// Set the mutation key if we have mutations but do not have a precommit token
$mutationKey = $mutations[array_rand($mutations)];
$operationTransactionOptions['mutationKey'] = $mutationKey;
}

// Execute the beginTransaction RPC.
$transaction = $this->operation->transaction($this->session, $operationTransactionOptions);
// Set the transaction ID of the current transaction.
Expand Down
Loading