use of com.google.cloud.bigtable.data.v2.BigtableDataSettings in project java-bigtable-hbase by googleapis.
the class TestBigtableHBaseVeneerSettings method testDataSettingsChannelPool.
@Test
public void testDataSettingsChannelPool() throws IOException {
configuration.setInt(BIGTABLE_DATA_CHANNEL_COUNT_KEY, 3);
BigtableHBaseVeneerSettings settings = (BigtableHBaseVeneerSettings) BigtableHBaseSettings.create(configuration);
BigtableDataSettings dataSettings = settings.getDataSettings();
InstantiatingGrpcChannelProvider transportChannelProvider = (InstantiatingGrpcChannelProvider) dataSettings.getStubSettings().getTransportChannelProvider();
assertEquals(3, transportChannelProvider.toBuilder().getPoolSize());
}
use of com.google.cloud.bigtable.data.v2.BigtableDataSettings in project java-bigtable-hbase by googleapis.
the class TestBigtableHBaseVeneerSettings method testDefaultThrottlingDisabled.
@Test
public void testDefaultThrottlingDisabled() throws IOException {
BigtableHBaseVeneerSettings settingUtils = BigtableHBaseVeneerSettings.create(configuration);
BigtableDataSettings settings = settingUtils.getDataSettings();
assertFalse(settings.getStubSettings().bulkMutateRowsSettings().isLatencyBasedThrottlingEnabled());
assertEquals(settings.getStubSettings().bulkMutateRowsSettings().getTargetRpcLatencyMs(), null);
}
use of com.google.cloud.bigtable.data.v2.BigtableDataSettings in project java-bigtable-hbase by googleapis.
the class TestBigtableHBaseVeneerSettings method testDataSettingsWithEmulator.
@Test
public void testDataSettingsWithEmulator() throws IOException {
// A real port isn't required for this test; only verifying the configs can be stored and
// retrieved.
final int availablePort = 987654321;
String emulatorHost = "localhost:" + availablePort;
configuration.set(BIGTABLE_EMULATOR_HOST_KEY, emulatorHost);
BigtableDataSettings dataSettings = ((BigtableHBaseVeneerSettings) BigtableHBaseVeneerSettings.create(configuration)).getDataSettings();
assertEquals(emulatorHost, dataSettings.getStubSettings().getEndpoint());
CredentialsProvider credProvider = dataSettings.getStubSettings().getCredentialsProvider();
assertTrue(credProvider instanceof NoCredentialsProvider);
}
use of com.google.cloud.bigtable.data.v2.BigtableDataSettings in project java-bigtable-hbase by googleapis.
the class TestBigtableHBaseVeneerSettings method testBulkMutationConfiguration.
@Test
public void testBulkMutationConfiguration() throws IOException {
long autoFlushMs = 2000L;
long maxRowKeyCount = 100L;
long maxInflightRPC = 500L;
long maxMemory = 100 * 1024L;
long bulkMaxReqSize = 20 * 1024;
configuration.setLong(BIGTABLE_BULK_AUTOFLUSH_MS_KEY, autoFlushMs);
configuration.setLong(BIGTABLE_BULK_MAX_ROW_KEY_COUNT, maxRowKeyCount);
configuration.setLong(MAX_INFLIGHT_RPCS_KEY, maxInflightRPC);
configuration.setLong(BIGTABLE_BULK_MAX_REQUEST_SIZE_BYTES, bulkMaxReqSize);
configuration.setLong(MAX_ELAPSED_BACKOFF_MILLIS_KEY, autoFlushMs);
configuration.setLong(BIGTABLE_BUFFERED_MUTATOR_MAX_MEMORY_KEY, maxMemory);
configuration.setBoolean(BigtableOptionsFactory.BIGTABLE_BUFFERED_MUTATOR_ENABLE_THROTTLING, true);
configuration.setInt(BigtableOptionsFactory.BIGTABLE_BUFFERED_MUTATOR_THROTTLING_THRESHOLD_MILLIS, 1234);
BigtableHBaseVeneerSettings settingUtils = ((BigtableHBaseVeneerSettings) BigtableHBaseVeneerSettings.create(configuration));
BigtableDataSettings settings = settingUtils.getDataSettings();
BatchingSettings batchingSettings = settings.getStubSettings().bulkMutateRowsSettings().getBatchingSettings();
assertEquals(ofMillis(autoFlushMs), batchingSettings.getDelayThreshold());
assertEquals(Long.valueOf(bulkMaxReqSize), batchingSettings.getRequestByteThreshold());
assertEquals(maxRowKeyCount, settingUtils.getBulkMaxRowCount());
assertEquals(Long.valueOf(maxRowKeyCount), batchingSettings.getElementCountThreshold());
assertEquals(Long.valueOf(maxInflightRPC * maxRowKeyCount), batchingSettings.getFlowControlSettings().getMaxOutstandingElementCount());
assertEquals(maxMemory, settingUtils.getBatchingMaxRequestSize());
assertTrue(settings.getStubSettings().bulkMutateRowsSettings().isLatencyBasedThrottlingEnabled());
assertEquals((long) settings.getStubSettings().bulkMutateRowsSettings().getTargetRpcLatencyMs(), 1234L);
}
use of com.google.cloud.bigtable.data.v2.BigtableDataSettings in project java-bigtable-hbase by googleapis.
the class TestBigtableHBaseVeneerSettings method testWhenRetriesAreDisabled.
@Test
public void testWhenRetriesAreDisabled() throws IOException {
configuration.setBoolean(ENABLE_GRPC_RETRIES_KEY, false);
BigtableDataSettings dataSettings = ((BigtableHBaseVeneerSettings) BigtableHBaseVeneerSettings.create(configuration)).getDataSettings();
assertTrue(dataSettings.getStubSettings().bulkMutateRowsSettings().getRetryableCodes().isEmpty());
assertTrue(dataSettings.getStubSettings().readRowSettings().getRetryableCodes().isEmpty());
assertTrue(dataSettings.getStubSettings().readRowsSettings().getRetryableCodes().isEmpty());
assertTrue(dataSettings.getStubSettings().sampleRowKeysSettings().getRetryableCodes().isEmpty());
}
Aggregations