Search in sources :

Example 1 with BigtableDataSettings

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());
}
Also used : InstantiatingGrpcChannelProvider(com.google.api.gax.grpc.InstantiatingGrpcChannelProvider) BigtableDataSettings(com.google.cloud.bigtable.data.v2.BigtableDataSettings) Test(org.junit.Test)

Example 2 with BigtableDataSettings

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);
}
Also used : BigtableDataSettings(com.google.cloud.bigtable.data.v2.BigtableDataSettings) Test(org.junit.Test)

Example 3 with BigtableDataSettings

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);
}
Also used : NoCredentialsProvider(com.google.api.gax.core.NoCredentialsProvider) NoCredentialsProvider(com.google.api.gax.core.NoCredentialsProvider) CredentialsProvider(com.google.api.gax.core.CredentialsProvider) BigtableDataSettings(com.google.cloud.bigtable.data.v2.BigtableDataSettings) Test(org.junit.Test)

Example 4 with BigtableDataSettings

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);
}
Also used : BigtableDataSettings(com.google.cloud.bigtable.data.v2.BigtableDataSettings) BatchingSettings(com.google.api.gax.batching.BatchingSettings) Test(org.junit.Test)

Example 5 with BigtableDataSettings

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());
}
Also used : BigtableDataSettings(com.google.cloud.bigtable.data.v2.BigtableDataSettings) Test(org.junit.Test)

Aggregations

BigtableDataSettings (com.google.cloud.bigtable.data.v2.BigtableDataSettings)20 Test (org.junit.Test)12 BigtableTableAdminSettings (com.google.cloud.bigtable.admin.v2.BigtableTableAdminSettings)4 BigtableDataClient (com.google.cloud.bigtable.data.v2.BigtableDataClient)4 InstantiatingGrpcChannelProvider (com.google.api.gax.grpc.InstantiatingGrpcChannelProvider)3 EnhancedBigtableStubSettings (com.google.cloud.bigtable.data.v2.stub.EnhancedBigtableStubSettings)3 Before (org.junit.Before)3 NoCredentialsProvider (com.google.api.gax.core.NoCredentialsProvider)2 BigtableInstanceAdminClient (com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient)2 BigtableInstanceAdminSettings (com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminSettings)2 Builder (com.google.cloud.bigtable.data.v2.BigtableDataSettings.Builder)2 Row (com.google.cloud.bigtable.data.v2.models.Row)2 IOException (java.io.IOException)2 Ignore (org.junit.Ignore)2 ApiFunction (com.google.api.core.ApiFunction)1 BatcherImpl (com.google.api.gax.batching.BatcherImpl)1 BatchingSettings (com.google.api.gax.batching.BatchingSettings)1 FlowControlEventStats (com.google.api.gax.batching.FlowControlEventStats)1 CredentialsProvider (com.google.api.gax.core.CredentialsProvider)1 RetrySettings (com.google.api.gax.retrying.RetrySettings)1