Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add feature flags for DirectAccess #2392

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading