Skip to content

Commit b33b0fc

Browse files
authored
Revert "feat: attemp DirectPath by default (#467)" (#520)
This reverts commit 89c622d.
1 parent 0ef7c5d commit b33b0fc

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java

+23-4
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
8989
private static final int MAX_MESSAGE_SIZE = 256 * 1024 * 1024;
9090
private static final String SERVER_DEFAULT_APP_PROFILE_ID = "";
9191

92+
// TODO(weiranf): Remove this temporary endpoint once DirectPath goes to public beta
93+
private static final String DIRECT_PATH_ENDPOINT = "test-bigtable.sandbox.googleapis.com:443";
94+
9295
private static final Set<Code> IDEMPOTENT_RETRY_CODES =
9396
ImmutableSet.of(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE);
9497

@@ -167,6 +170,12 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
167170
private EnhancedBigtableStubSettings(Builder builder) {
168171
super(builder);
169172

173+
if (DIRECT_PATH_ENDPOINT.equals(builder.getEndpoint())) {
174+
logger.warning(
175+
"Connecting to Bigtable using DirectPath."
176+
+ " This is currently an experimental feature and should not be used in production.");
177+
}
178+
170179
// Since point reads, streaming reads, bulk reads share the same base callable that converts
171180
// grpc errors into ApiExceptions, they must have the same retry codes.
172181
Preconditions.checkState(
@@ -240,9 +249,13 @@ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProvi
240249
.setKeepAliveTimeout(
241250
Duration.ofSeconds(10)) // wait this long before considering the connection dead
242251
.setKeepAliveWithoutCalls(true) // sends ping without active streams
243-
// Attempts direct access to CBT service over gRPC to improve throughput,
244-
// whether the attempt is allowed is totally controlled by service owner.
245-
.setAttemptDirectPath(true);
252+
// TODO(weiranf): Set this to true by default once DirectPath goes to public beta
253+
.setAttemptDirectPath(isDirectPathEnabled());
254+
}
255+
256+
// TODO(weiranf): Remove this once DirectPath goes to public beta
257+
private static boolean isDirectPathEnabled() {
258+
return Boolean.getBoolean("bigtable.attempt-directpath");
246259
}
247260

248261
static int getDefaultChannelPoolSize() {
@@ -517,7 +530,13 @@ private Builder() {
517530
// Defaults provider
518531
BigtableStubSettings.Builder baseDefaults = BigtableStubSettings.newBuilder();
519532

520-
setEndpoint(baseDefaults.getEndpoint());
533+
// TODO(weiranf): remove this once DirectPath goes to public Beta and uses the default
534+
// endpoint.
535+
if (isDirectPathEnabled()) {
536+
setEndpoint(DIRECT_PATH_ENDPOINT);
537+
} else {
538+
setEndpoint(baseDefaults.getEndpoint());
539+
}
521540

522541
setTransportChannelProvider(defaultTransportChannelProvider());
523542
setStreamWatchdogCheckInterval(baseDefaults.getStreamWatchdogCheckInterval());

0 commit comments

Comments
 (0)