Skip to content

Commit

Permalink
chore: add feature flags for DirectAccess
Browse files Browse the repository at this point in the history
Change-Id: I81d16773980bff6232ffe20839a9968718a361b1
  • Loading branch information
igorbernstein2 committed Oct 29, 2024
1 parent b7e5c81 commit 3429c2e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
private static final String SERVER_DEFAULT_APP_PROFILE_ID = "";

// TODO(meeral-k): add documentation
private static final String CBT_ENABLE_DIRECTPATH = "CBT_ENABLE_DIRECTPATH";
private static final boolean DIRECT_PATH_ENABLED =
Boolean.parseBoolean(System.getenv("CBT_ENABLE_DIRECTPATH"));

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

Expand Down Expand Up @@ -376,10 +378,9 @@ public String getMetricsEndpoint() {

/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
Boolean isDirectpathEnabled = Boolean.parseBoolean(System.getenv(CBT_ENABLE_DIRECTPATH));
InstantiatingGrpcChannelProvider.Builder grpcTransportProviderBuilder =
BigtableStubSettings.defaultGrpcTransportProviderBuilder();
if (isDirectpathEnabled) {
if (DIRECT_PATH_ENABLED) {
// Attempts direct access to CBT service over gRPC to improve throughput,
// whether the attempt is allowed is totally controlled by service owner.
grpcTransportProviderBuilder
Expand Down Expand Up @@ -830,7 +831,11 @@ private Builder() {
.setWaitTimeout(Duration.ofMinutes(5));

featureFlags =
FeatureFlags.newBuilder().setReverseScans(true).setLastScannedRowResponses(true);
FeatureFlags.newBuilder()
.setReverseScans(true)
.setLastScannedRowResponses(true)
.setDirectAccessRequested(DIRECT_PATH_ENABLED)
.setTrafficDirectorEnabled(DIRECT_PATH_ENABLED);
}

private Builder(EnhancedBigtableStubSettings settings) {
Expand Down

0 comments on commit 3429c2e

Please sign in to comment.