Skip to content

Commit

Permalink
Fix sync it (#28588)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abacn authored Sep 21, 2023
1 parent fee9808 commit 94327fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class BigtableResourceManager implements ResourceManager {
private final Set<String> cdcEnabledTables;

private boolean hasInstance;
private Iterable<BigtableResourceManagerCluster> clusters;
private List<BigtableResourceManagerCluster> clusters;

private final boolean usingStaticInstance;

Expand Down Expand Up @@ -195,12 +195,12 @@ public String getInstanceId() {
/**
* Creates a Bigtable instance in which all clusters, nodes and tables will exist.
*
* @param clusters Collection of BigtableResourceManagerCluster objects to associate with the
* given Bigtable instance.
* @param clusters List of BigtableResourceManagerCluster objects to associate with the given
* Bigtable instance.
* @throws BigtableResourceManagerException if there is an error creating the instance in
* Bigtable.
*/
public synchronized void createInstance(Iterable<BigtableResourceManagerCluster> clusters)
public synchronized void createInstance(List<BigtableResourceManagerCluster> clusters)
throws BigtableResourceManagerException {

// Check to see if instance already exists, and throw error if it does
Expand Down Expand Up @@ -559,7 +559,7 @@ public List<String> getClusterNames() {
}

private Iterable<BigtableResourceManagerCluster> getClusters() {
if (usingStaticInstance && this.clusters == null) {
if (usingStaticInstance && this.clusters.isEmpty()) {
try (BigtableInstanceAdminClient instanceAdminClient =
bigtableResourceManagerClientFactory.bigtableInstanceAdminClient()) {
List<BigtableResourceManagerCluster> managedClusters = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.google.cloud.bigtable.admin.v2.models.StorageType;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.regex.Pattern;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;

Expand Down Expand Up @@ -51,9 +52,9 @@ private BigtableResourceManagerUtils() {}
* @param zone the zone/region that the cluster will be deployed to.
* @param numNodes the number of nodes that the cluster will contain.
* @param storageType the type of storage to configure the cluster with (SSD or HDD).
* @return Collection containing a single BigtableResourceManagerCluster object.
* @return List containing a single BigtableResourceManagerCluster object.
*/
static Iterable<BigtableResourceManagerCluster> generateDefaultClusters(
static List<BigtableResourceManagerCluster> generateDefaultClusters(
String baseString, String zone, int numNodes, StorageType storageType) {

String clusterId =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList;
import org.junit.Before;
Expand Down Expand Up @@ -73,7 +74,7 @@ public class BigtableResourceManagerTest {
private static final StorageType CLUSTER_STORAGE_TYPE = StorageType.SSD;

private BigtableResourceManager testManager;
private Iterable<BigtableResourceManagerCluster> cluster;
private List<BigtableResourceManagerCluster> cluster;

@Before
public void setUp() throws IOException {
Expand Down

0 comments on commit 94327fd

Please sign in to comment.