You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by yh...@apache.org on 2024/06/15 00:50:01 UTC

(beam) branch master updated: Use the original way of validating Bigtable Change Stream table existance to improve compatbility with testing (#31597)

This is an automated email from the ASF dual-hosted git repository.

yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new b1c8040b7c9 Use the original way of validating Bigtable Change Stream table existance to improve compatbility with testing (#31597)
b1c8040b7c9 is described below

commit b1c8040b7c9815e2d47fd097fb2c23077f2456c8
Author: Tony Tang <to...@gmail.com>
AuthorDate: Fri Jun 14 17:49:55 2024 -0700

    Use the original way of validating Bigtable Change Stream table existance to improve compatbility with testing (#31597)
    
    Change-Id: Iba1ee679fed4276a271f2fc83c7ad657a0da8174
---
 .../main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
index 4feccd397d7..d25ad7d4871 100644
--- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
+++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
@@ -57,6 +57,7 @@ import org.apache.beam.sdk.io.BoundedSource.BoundedReader;
 import org.apache.beam.sdk.io.gcp.bigtable.changestreams.ChangeStreamMetrics;
 import org.apache.beam.sdk.io.gcp.bigtable.changestreams.UniqueIdGenerator;
 import org.apache.beam.sdk.io.gcp.bigtable.changestreams.action.ActionFactory;
+import org.apache.beam.sdk.io.gcp.bigtable.changestreams.dao.BigtableChangeStreamAccessor;
 import org.apache.beam.sdk.io.gcp.bigtable.changestreams.dao.BigtableClientOverride;
 import org.apache.beam.sdk.io.gcp.bigtable.changestreams.dao.DaoFactory;
 import org.apache.beam.sdk.io.gcp.bigtable.changestreams.dao.MetadataTableAdminDao;
@@ -2307,11 +2308,11 @@ public class BigtableIO {
 
     @Override
     public void validate(PipelineOptions options) {
-      BigtableServiceFactory factory = new BigtableServiceFactory();
       if (getBigtableConfig().getValidate()) {
-        try {
+        try (BigtableChangeStreamAccessor bigtableChangeStreamAccessor =
+            BigtableChangeStreamAccessor.getOrCreate(getBigtableConfig())) {
           checkArgument(
-              factory.checkTableExists(getBigtableConfig(), options, getTableId()),
+              bigtableChangeStreamAccessor.getTableAdminClient().exists(getTableId()),
               "Change Stream table %s does not exist",
               getTableId());
         } catch (IOException e) {