Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: attempt DirectPath by default (#544)
  • Loading branch information
mohanli-ml committed Dec 3, 2020
1 parent 44d77e6 commit 2043063
Showing 1 changed file with 4 additions and 24 deletions.
Expand Up @@ -89,9 +89,6 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
private static final int MAX_MESSAGE_SIZE = 256 * 1024 * 1024;
private static final String SERVER_DEFAULT_APP_PROFILE_ID = "";

// TODO(weiranf): Remove this temporary endpoint once DirectPath goes to public beta
private static final String DIRECT_PATH_ENDPOINT = "test-bigtable.sandbox.googleapis.com:443";

private static final Set<Code> IDEMPOTENT_RETRY_CODES =
ImmutableSet.of(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE);

Expand Down Expand Up @@ -170,12 +167,6 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
private EnhancedBigtableStubSettings(Builder builder) {
super(builder);

if (DIRECT_PATH_ENDPOINT.equals(builder.getEndpoint())) {
logger.warning(
"Connecting to Bigtable using DirectPath."
+ " This is currently an experimental feature and should not be used in production.");
}

// Since point reads, streaming reads, bulk reads share the same base callable that converts
// grpc errors into ApiExceptions, they must have the same retry codes.
Preconditions.checkState(
Expand Down Expand Up @@ -248,13 +239,9 @@ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProvi
.setKeepAliveTime(Duration.ofSeconds(30)) // sends ping in this interval
.setKeepAliveTimeout(
Duration.ofSeconds(10)) // wait this long before considering the connection dead
// TODO(weiranf): Set this to true by default once DirectPath goes to public beta
.setAttemptDirectPath(isDirectPathEnabled());
}

// TODO(weiranf): Remove this once DirectPath goes to public beta
private static boolean isDirectPathEnabled() {
return Boolean.getBoolean("bigtable.attempt-directpath");
// Attempts direct access to CBT service over gRPC to improve throughput,
// whether the attempt is allowed is totally controlled by service owner.
.setAttemptDirectPath(true);
}

static int getDefaultChannelPoolSize() {
Expand Down Expand Up @@ -529,14 +516,7 @@ private Builder() {
// Defaults provider
BigtableStubSettings.Builder baseDefaults = BigtableStubSettings.newBuilder();

// TODO(weiranf): remove this once DirectPath goes to public Beta and uses the default
// endpoint.
if (isDirectPathEnabled()) {
setEndpoint(DIRECT_PATH_ENDPOINT);
} else {
setEndpoint(baseDefaults.getEndpoint());
}

setEndpoint(baseDefaults.getEndpoint());
setTransportChannelProvider(defaultTransportChannelProvider());
setStreamWatchdogCheckInterval(baseDefaults.getStreamWatchdogCheckInterval());
setStreamWatchdogProvider(baseDefaults.getStreamWatchdogProvider());
Expand Down

0 comments on commit 2043063

Please sign in to comment.