Skip to content

Commit

Permalink
deps: upgrade java-bigtable to 2.44.1 (#4445)
Browse files Browse the repository at this point in the history
* deps: upgrade java-bigtable to 2.44.1

Change-Id: I8b3bcbd2ad6398dc67517ad6cbaef9d080022a37

* format

Change-Id: I88fae43328ec6e437468db1aefd7dd3f4a34ef11

* fix shading

Change-Id: I591d5a737828b39f857647dc5478fd558e2e1473
  • Loading branch information
igorbernstein2 authored Sep 30, 2024
1 parent 782b39c commit ae7b9d8
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,16 @@ private BigtableDataSettings buildBigtableDataSettings(ClientOperationTimeouts c
int port = Integer.parseInt(emulatorEndpoint.get().substring(split + 1));
dataBuilder = BigtableDataSettings.newBuilderForEmulator(host, port);
} else {
String endpoint =
BigtableDataSettings.newBuilder()
.setProjectId(getProjectId())
.setInstanceId(getInstanceId())
.build()
.getStubSettings()
.getEndpoint();

dataBuilder = BigtableDataSettings.newBuilder();
configureConnection(dataBuilder.stubSettings(), BIGTABLE_HOST_KEY);
configureConnection(dataBuilder.stubSettings(), BIGTABLE_HOST_KEY, endpoint);
configureCredentialProvider(dataBuilder.stubSettings());
}
configureHeaderProvider(dataBuilder.stubSettings());
Expand Down Expand Up @@ -366,8 +374,15 @@ private BigtableTableAdminSettings buildBigtableTableAdminSettings() throws IOEx
int port = Integer.parseInt(emulatorEndpoint.substring(split + 1));
adminBuilder = BigtableTableAdminSettings.newBuilderForEmulator(host, port);
} else {
String defaultEndpoint =
BigtableTableAdminSettings.newBuilder()
.setProjectId(getProjectId())
.setInstanceId(getInstanceId())
.build()
.getStubSettings()
.getEndpoint();
adminBuilder = BigtableTableAdminSettings.newBuilder();
configureConnection(adminBuilder.stubSettings(), BIGTABLE_ADMIN_HOST_KEY);
configureConnection(adminBuilder.stubSettings(), BIGTABLE_ADMIN_HOST_KEY, defaultEndpoint);
configureCredentialProvider(adminBuilder.stubSettings());
}
configureHeaderProvider(adminBuilder.stubSettings());
Expand Down Expand Up @@ -414,8 +429,14 @@ public ManagedChannelBuilder apply(
})
.build());
} else {
String defaultEndpoint =
BigtableInstanceAdminSettings.newBuilder()
.setProjectId(getProjectId())
.build()
.getStubSettings()
.getEndpoint();
adminBuilder = BigtableInstanceAdminSettings.newBuilder();
configureConnection(adminBuilder.stubSettings(), BIGTABLE_ADMIN_HOST_KEY);
configureConnection(adminBuilder.stubSettings(), BIGTABLE_ADMIN_HOST_KEY, defaultEndpoint);
configureCredentialProvider(adminBuilder.stubSettings());
}
configureHeaderProvider(adminBuilder.stubSettings());
Expand All @@ -425,8 +446,8 @@ public ManagedChannelBuilder apply(
return adminBuilder.build();
}

private void configureConnection(StubSettings.Builder<?, ?> stubSettings, String endpointKey) {
String defaultEndpoint = stubSettings.getEndpoint();
private void configureConnection(
StubSettings.Builder<?, ?> stubSettings, String endpointKey, String defaultEndpoint) {
String defaultHostname = defaultEndpoint.substring(0, defaultEndpoint.lastIndexOf(':'));
String defaultPort = defaultEndpoint.substring(defaultEndpoint.lastIndexOf(':') + 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.google.cloud.bigtable.data.v2.models.RowMutationEntry;
import com.google.cloud.bigtable.hbase.wrappers.BulkMutationWrapper;
import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -124,12 +125,13 @@ public Object answer(InvocationOnMock invocationOnMock) {

@Test
public void testWhenBatcherIsClosed() throws IOException {
BatchingSettings batchingSettings = mock(BatchingSettings.class);
FlowControlSettings flowControlSettings =
FlowControlSettings.newBuilder()
.setLimitExceededBehavior(LimitExceededBehavior.Ignore)
BatchingSettings batchingSettings =
BatchingSettings.newBuilder()
.setFlowControlSettings(
FlowControlSettings.newBuilder()
.setLimitExceededBehavior(LimitExceededBehavior.Ignore)
.build())
.build();
when(batchingSettings.getFlowControlSettings()).thenReturn(flowControlSettings);

BatchingDescriptor mockBatchingDescriptor = mock(BatchingDescriptor.class);

Expand All @@ -141,16 +143,15 @@ public void testWhenBatcherIsClosed() throws IOException {
when(unaryCallable.futureCall(any(), any()))
.thenReturn(ApiFutures.immediateFuture(new Object()));

ScheduledExecutorService executor = Executors.newScheduledThreadPool(0);

@SuppressWarnings("unchecked")
Batcher<RowMutationEntry, Void> actualBatcher =
new BatcherImpl(
mockBatchingDescriptor,
unaryCallable,
new Object(),
batchingSettings,
mock(ScheduledExecutorService.class));
mockBatchingDescriptor, unaryCallable, new Object(), batchingSettings, executor);
BulkMutationWrapper underTest = new BulkMutationVeneerApi(actualBatcher, 0);
underTest.close();
executor.shutdownNow();

Exception actualEx = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ limitations under the License.
<ignoredDependencies>
<dependency>io.opentelemetry:opentelemetry-api</dependency>
<dependency>io.opentelemetry:opentelemetry-context</dependency>
<dependency>io.opentelemetry:opentelemetry-semconv</dependency>
</ignoredDependencies>
</configuration>
</execution>
Expand Down
1 change: 1 addition & 0 deletions bigtable-hbase-2.x-parent/bigtable-hbase-2.x/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ limitations under the License.
<ignoredDependencies>
<dependency>io.opentelemetry:opentelemetry-api</dependency>
<dependency>io.opentelemetry:opentelemetry-context</dependency>
<dependency>io.opentelemetry:opentelemetry-semconv</dependency>
</ignoredDependencies>
</configuration>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ limitations under the License.
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-config</artifactId>
<version>1.7.7</version>
<version>1.11.1</version>
</parent>

<licenses>
Expand All @@ -55,7 +55,7 @@ limitations under the License.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- core dependency versions -->
<bigtable.version>2.39.2</bigtable.version>
<bigtable.version>2.44.1</bigtable.version>
<google-cloud-bigtable-emulator.version>0.175.0</google-cloud-bigtable-emulator.version>
<bigtable-metrics-api.version>1.29.2</bigtable-metrics-api.version>
<!-- Optional dep for bigtable-metrics-api used for tests -->
Expand Down

0 comments on commit ae7b9d8

Please sign in to comment.