Skip to content

Commit

Permalink
update bigtable version (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgruener authored and nevillelyh committed Jul 21, 2016
1 parent ebf1404 commit 72b4a31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
7 changes: 3 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.trueaccord.scalapb.{ScalaPbPlugin => PB}
val dataflowSdkVersion = "1.6.0"
val algebirdVersion = "0.12.1"
val avroVersion = "1.7.7"
val bigtableVersion = "0.9.0"
val bigtableVersion = "0.9.1"
val breezeVersion ="0.12"
val chillVersion = "0.8.0"
val commonsIoVersion = "2.5"
Expand All @@ -39,7 +39,7 @@ val hbaseVersion = "1.0.2"
val javaLshVersion = "0.9"
val jodaConvertVersion = "1.8.1"
val junitVersion = "4.12"
val nettyTcNativeVersion = "1.1.33.Fork13"
val nettyTcNativeVersion = "1.1.33.Fork18"
val scalaCheckVersion = "1.13.1"
val scalaMacrosVersion = "2.1.0"
val scalapbVersion = "0.5.19" // inner protobuf-java version must match beam/dataflow-sdk one
Expand Down Expand Up @@ -247,8 +247,7 @@ lazy val scioBigtable: Project = Project(
"com.google.cloud.bigtable" % "bigtable-hbase-dataflow" % bigtableVersion exclude ("org.slf4j", "slf4j-log4j12"),
"org.apache.hadoop" % "hadoop-common" % hadoopVersion exclude ("org.slf4j", "slf4j-log4j12"),
"org.apache.hbase" % "hbase-common" % hbaseVersion,
"io.netty" % "netty-tcnative" % nettyTcNativeVersion classifier "linux-x86_64",
"io.netty" % "netty-tcnative" % nettyTcNativeVersion classifier "osx-x86_64"
"io.netty" % "netty-tcnative-boringssl-static" % nettyTcNativeVersion
)
)
).dependsOn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
package com.spotify.scio.bigtable;

import com.google.bigtable.repackaged.com.google.cloud.config.BigtableOptions;
import com.google.bigtable.repackaged.com.google.cloud.grpc.BigtableInstanceClient;
import com.google.bigtable.repackaged.com.google.cloud.grpc.BigtableInstanceGrpcClient;
import com.google.bigtable.repackaged.com.google.cloud.grpc.io.ChannelPool;
import com.google.bigtable.repackaged.com.google.com.google.bigtable.admin.v2.Cluster;
import com.google.bigtable.repackaged.com.google.com.google.bigtable.admin.v2.ListClustersRequest;
import com.google.bigtable.repackaged.com.google.com.google.bigtable.admin.v2.BigtableInstanceAdminGrpc;
import com.google.bigtable.repackaged.com.google.com.google.bigtable.admin.v2.BigtableInstanceAdminGrpc.BigtableInstanceAdminBlockingStub;
import com.google.bigtable.repackaged.com.google.com.google.bigtable.admin.v2.ListClustersResponse;
import com.google.cloud.bigtable.dataflow.CloudBigtableConfiguration;
import org.joda.time.Duration;
Expand Down Expand Up @@ -53,22 +53,24 @@ public static void updateNumberOfBigtableNodes(final CloudBigtableConfiguration
final int numberOfNodes,
final Duration sleepDuration) throws IOException, InterruptedException {
final BigtableOptions bigtableOptions = cloudBigtableConfiguration.toBigtableOptions();
final ChannelPool channelPool = ChannelPoolCreator.createPool(bigtableOptions.getClusterAdminHost());
final BigtableInstanceAdminBlockingStub adminGrpc = BigtableInstanceAdminGrpc.newBlockingStub(channelPool);

final ChannelPool channelPool = ChannelPoolCreator.createPool(bigtableOptions.getInstanceAdminHost());

final BigtableInstanceClient bigtableInstanceClient = new BigtableInstanceGrpcClient(channelPool);

final String instanceName = bigtableOptions.getInstanceName().toString();

// Fetch clusters in Bigtable instance
final ListClustersRequest clustersRequest = ListClustersRequest.newBuilder().setParent(instanceName).build();
final ListClustersResponse clustersResponse = adminGrpc.listClusters(clustersRequest);
final ListClustersResponse clustersResponse = bigtableInstanceClient.listCluster(clustersRequest);

// For each cluster update the number of nodes
for (Cluster cluster : clustersResponse.getClustersList()) {
final Cluster updatedCluster = Cluster.newBuilder()
.setName(cluster.getName())
.setServeNodes(numberOfNodes)
.build();
adminGrpc.updateCluster(updatedCluster);
bigtableInstanceClient.updateCluster(updatedCluster);
}

// Wait for the new nodes to be provisioned
Expand Down

0 comments on commit 72b4a31

Please sign in to comment.