Skip to content

Commit ecf4d3e

Browse files
chore: add feature flags for DirectAccess (#2392)
Change-Id: I81d16773980bff6232ffe20839a9968718a361b1 Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-bigtable/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Rollback plan is reviewed and LGTMed - [ ] All new data plane features have a completed end to end testing plan Fixes #<issue_number_goes_here> ☕️ If you write sample code, please follow the [samples format]( https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
1 parent b7e5c81 commit ecf4d3e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ public class EnhancedBigtableStubSettings extends StubSettings<EnhancedBigtableS
105105
private static final String SERVER_DEFAULT_APP_PROFILE_ID = "";
106106

107107
// TODO(meeral-k): add documentation
108-
private static final String CBT_ENABLE_DIRECTPATH = "CBT_ENABLE_DIRECTPATH";
108+
private static final boolean DIRECT_PATH_ENABLED =
109+
Boolean.parseBoolean(System.getenv("CBT_ENABLE_DIRECTPATH"));
110+
109111
private static final Set<Code> IDEMPOTENT_RETRY_CODES =
110112
ImmutableSet.of(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE);
111113

@@ -376,10 +378,9 @@ public String getMetricsEndpoint() {
376378

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

832833
featureFlags =
833-
FeatureFlags.newBuilder().setReverseScans(true).setLastScannedRowResponses(true);
834+
FeatureFlags.newBuilder()
835+
.setReverseScans(true)
836+
.setLastScannedRowResponses(true)
837+
.setDirectAccessRequested(DIRECT_PATH_ENABLED)
838+
.setTrafficDirectorEnabled(DIRECT_PATH_ENABLED);
834839
}
835840

836841
private Builder(EnhancedBigtableStubSettings settings) {

0 commit comments

Comments
 (0)