googleapis / google-cloud-php

Google Cloud Client Library for PHP
https://cloud.google.com/php/docs/reference
Apache License 2.0
1.1k stars 436 forks source link

feat: [Spanner] support excludeTxnFromChangeStreams option #7749

Closed bshaffer closed 2 weeks ago

bshaffer commented 1 month ago

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

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

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]]
]);