Skip to content

feat(bigtable): Option to disable direct access fallback - #14193

Open
nimf wants to merge 1 commit into
mainfrom
disable_da_option
Open

feat(bigtable): Option to disable direct access fallback#14193
nimf wants to merge 1 commit into
mainfrom
disable_da_option

Conversation

@nimf

@nimf nimf commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@nimf
nimf requested review from a team as code owners August 26, 2026 19:16

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to disable DirectPath fallback in ClientConfigurationManager using the environment variable CBT_DISABLE_DIRECT_ACCESS_FALLBACK or system property bigtable.internal.disable-direct-access-fallback. When enabled, configurations with DirectAccessWithFallback are normalized to DirectAccessOnly. The review feedback suggests renaming the internal field disableDirectPathFallback and its associated references and test method to disableDirectAccessFallback to ensure naming consistency with the configuration keys and protobuf fields.


private final ClientConfiguration defaultConfig;
private final Optional<ClientConfiguration> overrideConfig;
private final boolean disableDirectPathFallback;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To maintain consistency with the environment variable CBT_DISABLE_DIRECT_ACCESS_FALLBACK, the system property bigtable.internal.disable-direct-access-fallback, and the protobuf fields (DirectAccessOnly / DirectAccessWithFallback), please rename this field from disableDirectPathFallback to disableDirectAccessFallback.

Suggested change
private final boolean disableDirectPathFallback;
private final boolean disableDirectAccessFallback;

Comment on lines +186 to +190
this.disableDirectPathFallback =
Optional.ofNullable(System.getenv(DISABLE_DIRECT_ACCESS_FALLBACK_ENV_VAR))
.orElseGet(
() -> sysProps.getProperty(DISABLE_DIRECT_ACCESS_FALLBACK_SYS_PROP_KEY, "false"))
.equalsIgnoreCase("true");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Rename the field assignment to disableDirectAccessFallback to match the renamed field.

Suggested change
this.disableDirectPathFallback =
Optional.ofNullable(System.getenv(DISABLE_DIRECT_ACCESS_FALLBACK_ENV_VAR))
.orElseGet(
() -> sysProps.getProperty(DISABLE_DIRECT_ACCESS_FALLBACK_SYS_PROP_KEY, "false"))
.equalsIgnoreCase("true");
this.disableDirectAccessFallback =
Optional.ofNullable(System.getenv(DISABLE_DIRECT_ACCESS_FALLBACK_ENV_VAR))
.orElseGet(
() -> sysProps.getProperty(DISABLE_DIRECT_ACCESS_FALLBACK_SYS_PROP_KEY, "false"))
.equalsIgnoreCase("true");

Comment on lines +420 to +424
if (disableDirectPathFallback
&& builder
.getSessionConfiguration()
.getChannelConfiguration()
.hasDirectAccessWithFallback()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Update the reference to use disableDirectAccessFallback instead of disableDirectPathFallback.

Suggested change
if (disableDirectPathFallback
&& builder
.getSessionConfiguration()
.getChannelConfiguration()
.hasDirectAccessWithFallback()) {
if (disableDirectAccessFallback
&& builder
.getSessionConfiguration()
.getChannelConfiguration()
.hasDirectAccessWithFallback()) {

}

@Test
void disableDirectPathFallbackTest() throws Exception {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Rename the test method to disableDirectAccessFallbackTest to align with the renamed field and configuration keys.

Suggested change
void disableDirectPathFallbackTest() throws Exception {
void disableDirectAccessFallbackTest() throws Exception {

@nimf
nimf requested a review from mutianf August 26, 2026 19:22
private static final Logger logger = Logger.getLogger(ClientConfigurationManager.class.getName());

public static final String OVERRIDE_SYS_PROP_KEY = "bigtable.internal.client-config-override";
public static final String DISABLE_DIRECT_ACCESS_FALLBACK_ENV_VAR =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both env var and system property?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's okay to have both and convenient for users.

@mutianf mutianf added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 27, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 27, 2026
@nimf nimf added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 28, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants