Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release-2.51.0] Cherry pick #28588: Fix sync it framework BigtableResourceManager #28594

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading