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: [Spanner] support excludeTxnFromChangeStreams option #7749

Merged
merged 10 commits into from
Nov 6, 2024

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Oct 15, 2024

Ensures excludeTxnFromChangeStreams is configurable for the following methods, and adds tests:

  • Database::runTransaction
  • Database::executePartitionedUpdate
  • Operation::transaction
  • Operation::execute
  • Operation::executeUpdate
  • Database::batchUpdate

Additionally, ensures excludeTxnFromChangeStreams is NOT configurable for the following methods, and adds tests:

  • Transaction::executeUpdate

Database::runTransaction

$database->runTransaction(function (Transaction $t) use ($sql) {
        // Run a query
    }, [
        'transactionOptions' => ['excludeTxnFromChangeStreams' => true]
    ]);

Database::executePartitionedUpdate

$database->executePartitionedUpdate($sql, [
    'transactionOptions' => ['excludeTxnFromChangeStreams' => true]
]);

Operation::transaction

$transaction = $operation->transaction($this->session, [
    'transactionOptions' => ['excludeTxnFromChangeStreams' => true]
]);

Operation::execute

$operation->execute($this->session, $sql, [
   'transaction' => ['begin' => ['excludeTxnFromChangeStreams' => true]]
]);

Operation::executeUpdate

$operation->executeUpdate($this->session, $transaction, $sql, [
   'transaction' => ['begin' => ['excludeTxnFromChangeStreams' => true]]
]);

Database::batchWrite

$database->batchWrite($mutationGroups, [
    'excludeTxnFromChangeStreams' => true
]);

Transaction::executeUpdate

Attempting to call Transaction::executeUpdate with the following options will throw an exception:

// The following throws a `Google\ApiCore\ValidationException`:
$transaction->executeUpdate($sql, [
   'transaction' => ['begin' => ['excludeTxnFromChangeStreams' => true]]
]);

@bshaffer bshaffer marked this pull request as ready for review October 17, 2024 23:06
@bshaffer bshaffer requested review from a team as code owners October 17, 2024 23:06
@bshaffer bshaffer added the next release PRs to be included in the next release label Oct 29, 2024
Copy link

@ShuranZhang ShuranZhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@bshaffer bshaffer merged commit b369460 into main Nov 6, 2024
26 checks passed
@bshaffer bshaffer deleted the spanner-change-streams-txn-exclusion branch November 6, 2024 19:49
@bshaffer bshaffer changed the title feat: support excludeTxnFromChangeStreams option feat: [Spanner] support excludeTxnFromChangeStreams option Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next release PRs to be included in the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants