From 2a9e44328acda310db2d0d65d32ad82d77a9fcb0 Mon Sep 17 00:00:00 2001 From: alkatrivedi <58396306+alkatrivedi@users.noreply.github.com> Date: Sat, 6 Jul 2024 12:17:28 +0000 Subject: [PATCH] feat: add support for change streams transaction exclusion option for Batch Write (#2070) * feat: change stream transaction exclusion option for Batch Write * refactor --- src/database.ts | 1 + src/transaction.ts | 1 + test/database.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/database.ts b/src/database.ts index 4e9844cc4..f89b65839 100644 --- a/src/database.ts +++ b/src/database.ts @@ -3289,6 +3289,7 @@ class Database extends common.GrpcServiceObject { session: session!.formattedName_!, mutationGroups: mutationGroups.map(mg => mg.proto()), requestOptions: options?.requestOptions, + excludeTxnFromChangeStream: options?.excludeTxnFromChangeStreams, } ); let dataReceived = false; diff --git a/src/transaction.ts b/src/transaction.ts index 479262a27..35d5e90f7 100644 --- a/src/transaction.ts +++ b/src/transaction.ts @@ -62,6 +62,7 @@ export interface TimestampBounds { export interface BatchWriteOptions { requestOptions?: Pick; gaxOptions?: CallOptions; + excludeTxnFromChangeStreams?: boolean; } export interface RequestOptions { diff --git a/test/database.ts b/test/database.ts index 9fb89c14d..059f704fe 100644 --- a/test/database.ts +++ b/test/database.ts @@ -600,6 +600,7 @@ describe('Database', () => { requestOptions: { transactionTag: 'batch-write-tag', }, + excludeTxnFromChangeStream: true, gaxOptions: {autoPaginate: false}, } as BatchWriteOptions; @@ -644,6 +645,7 @@ describe('Database', () => { session: fakeSession!.formattedName_!, mutationGroups: mutationGroups.map(mg => mg.proto()), requestOptions: options?.requestOptions, + excludeTxnFromChangeStream: options?.excludeTxnFromChangeStreams, } );