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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

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!

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