Skip to content

fix(bigtable): ignore blank client-config-override and enforce IT protocol - #15206

Merged
igorbernstein2 merged 3 commits into
mainfrom
fix/bigtable-it-protocol-enforcement
Nov 24, 2026
Merged

igorbernstein2 merged 3 commits into
mainfrom
fix/bigtable-it-protocol-enforcement

Conversation

@igorbernstein2

Copy link
Copy Markdown
Contributor

Summary

Fixes a bug where Maven Failsafe's empty -Dbigtable.internal.client-config-override="" bypassed GetClientConfiguration polling on default integration test runs, and adds suite-wide protocol enforcement (-Dbigtable.expected-protocol) for Bigtable integration tests.

Changes

  1. Ignore blank bigtable.internal.client-config-override (ClientConfigurationManager):
    • Filter out blank strings (.filter(str -> !str.trim().isEmpty())) so empty default <properties> in pom.xml are treated as unset and default IT runs genuinely poll GetClientConfiguration.
    • Added unit test testBlankSysPropOverrideIsIgnoredAndPollsServer in ClientConfigurationManagerTest.
  2. Skip GetClientConfiguration in DirectPath remote-address check (CloudEnv):
    • Under REQUIRE_DIRECT_PATH / REQUIRE_DIRECT_PATH_IPV4, skip the remote IP check for GetClientConfiguration since ClientConfigurationManager always polls over CloudPath regardless of data transport.
    • Keep checking GetClientConfiguration under REQUIRE_CFE so ShimImpl's DirectAccess probe over DirectPath continues to be rejected and forces CFE.
  3. Suite-wide protocol enforcement (AbstractTestEnv, CloudEnv, pom.xml, .kokoro/presubmit/bigtable-integration.cfg):
    • Added -Dbigtable.expected-protocol (ANY | CLASSIC | SESSION), defaulting to ANY when unset/blank, set to SESSION in bigtable-session-it, and passed as CLASSIC in .kokoro/presubmit/bigtable-integration.cfg (follow-up: add CLASSIC to bigtable-classic-it once ci(bigtable): add bigtable-classic-it profile and use it in CFE/DirectPath presubmits #15181 merges).
    • Validate resolved session config in CloudEnv.start() via verifyExpectedProtocol(...).
    • Attach a suite-wide protocol enforcement interceptor (including under ConnectionMode.DEFAULT):
      • CLASSIC: aborts any Bigtable/Open* RPC with Status.FAILED_PRECONDITION.
      • SESSION: aborts classic MutateRow, CheckAndMutateRow, ReadModifyWriteRow, and single-point ReadRows (rows_limit == 1 with single key or equal closed-closed range) with Status.FAILED_PRECONDITION, leaving bulk/range ReadRows and MutateRows unblocked.
    • Added unit tests in CloudEnvTest covering protocol parsing, startup validation, remote-address skipping, and protocol enforcement.
  4. Gate SessionIT on ExpectedProtocol.SESSION:
    • Switch SessionIT's assume() from isSessionsEnabled() to getExpectedProtocol() == ExpectedProtocol.SESSION so environments mid-ramp (e.g. 50% diversion) don't flake once GetClientConfiguration polling is restored.

Verification

  • Formatted with mvn com.spotify.fmt:fmt-maven-plugin:format
  • Verified mvn help:effective-pom for bigtable-prod-it, bigtable-prod-it -Dbigtable.expected-protocol=CLASSIC, and bigtable-cfe-it,bigtable-session-it
  • Ran mvn test -Dtest=CloudEnvTest,ClientConfigurationManagerTest (34/34 passed, 0 Checkstyle violations)

…tocol

Fixes a bug where setting `-Dbigtable.internal.client-config-override=""`
(as maven-failsafe-plugin does when the property is declared empty in
pom.xml) caused ClientConfigurationManager to treat the empty string as an
active local override instead of polling GetClientConfiguration.

Also strengthens Bigtable integration test protocol & transport assertions:
- ClientConfigurationManager: treat blank `bigtable.internal.client-config-override`
  values as unset so default IT runs poll `GetClientConfiguration`.
- CloudEnv: skip the remote-address IP check for `GetClientConfiguration`
  under `REQUIRE_DIRECT_PATH` / `REQUIRE_DIRECT_PATH_IPV4` (since
  `GetClientConfiguration` always uses CloudPath regardless of data
  transport), while keeping the check under `REQUIRE_CFE`.
- AbstractTestEnv / CloudEnv / pom.xml: add `-Dbigtable.expected-protocol`
  (`ANY` | `CLASSIC` | `SESSION`), enforce resolved session config in
  `CloudEnv.start()`, and attach a suite-wide protocol enforcement
  interceptor blocking `Bigtable/Open*` under `CLASSIC` and classic
  `MutateRow`, `CheckAndMutateRow`, `ReadModifyWriteRow`, and single-point
  `ReadRows` (`rows_limit == 1`) under `SESSION`.
- SessionIT: gate `assume()` on `ExpectedProtocol.SESSION` so partial-ramp
  environments (e.g. 50% diversion) do not flake.
- `.kokoro/presubmit/bigtable-integration.cfg`: pass
  `-Dbigtable.expected-protocol=CLASSIC` for the prod default presubmit.
@igorbernstein2
igorbernstein2 requested review from a team as code owners November 24, 2026 19:03

@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 enforce and verify the expected protocol (CLASSIC or SESSION) during integration testing. It adds a new bigtable.expected-protocol system property, updates test configurations, and implements a ProtocolEnforcementInterceptor in CloudEnv to block invalid RPCs based on the expected protocol. Additionally, it ensures blank system property overrides are ignored in ClientConfigurationManager. The review feedback suggests normalizing the protocol string to uppercase in AbstractTestEnv.parseExpectedProtocol to make the configuration more robust against lowercase or mixed-case inputs.

@igorbernstein2
igorbernstein2 merged commit 2b00c9e into main Nov 24, 2026
198 checks passed
@igorbernstein2
igorbernstein2 deleted the fix/bigtable-it-protocol-enforcement branch November 24, 2026 20:33
igorbernstein2 added a commit that referenced this pull request Nov 24, 2026
…ofile (#15215)

Follow-up to #15181 and #15206 (which were branched independently before
merging).

Sets `<bigtable.expected-protocol>CLASSIC</bigtable.expected-protocol>`
in the `bigtable-classic-it` Maven profile so `Classic CFE` and `Classic
DirectPath` integration test runs enforce the classic protocol via
`CloudEnv`'s startup check and `ProtocolEnforcementInterceptor`,
matching `bigtable-session-it` (`SESSION`) and prod `Default`
(`CLASSIC`).

## Verification
- Verified `mvn help:effective-pom -P
bigtable-cfe-it,bigtable-classic-it` resolves
`bigtable.expected-protocol=CLASSIC` in `maven-failsafe-plugin`'s
`cfe-it` execution.
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.

2 participants