Skip to content

Commit

Permalink
Use the original way of validating Bigtable Change Stream table exist…
Browse files Browse the repository at this point in the history
…ance to improve compatbility with testing (#31597)

Change-Id: Iba1ee679fed4276a271f2fc83c7ad657a0da8174
  • Loading branch information
tonytanger committed Jun 15, 2024
1 parent c02a5e6 commit b1c8040
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
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;
Expand Down Expand Up @@ -2307,11 +2308,11 @@ public ReadChangeStream withoutValidation() {

@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) {
Expand Down

0 comments on commit b1c8040

Please sign in to comment.