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

deps: upgrade java-bigtable to 2.44.1 #4445

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -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
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