Skip to content

feat(bigtable): add per-method session diversion configuration - #14681

Open
mutianf wants to merge 2 commits into
googleapis:mainfrom
mutianf:feat/session-diversion-config
Open

mutianf wants to merge 2 commits into
googleapis:mainfrom
mutianf:feat/session-diversion-config

Conversation

@mutianf

@mutianf mutianf commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds a methodScopeKey to DivertingUnaryCallable so session load can be configured per-RPC-method via SessionDiversionConfiguration, in addition to the existing global session_load.
  • resolveSessionLoad() checks global_diversion or per_scope_diversion depending on which strategy the server returns; falls back to flat session_load when no diversion config is present.
  • Moves the supports() check before resolveSessionLoad() to avoid a config lookup for requests the shim can't handle.
  • Fixes ClientConfigurationManager to preserve session config when a SessionDiversionConfiguration is present even if the global session_load is 0 (diversion config encodes its own per-scope session loads).

Test plan

  • DivertingUnaryCallableTest: covers global diversion (load=1 routes to experimental, load=0 falls back to classic), per-scope match (routes to experimental), and per-scope non-match (falls back to classic)
  • Existing session routing tests continue to pass unchanged

@mutianf
mutianf requested review from a team as code owners October 18, 2026 02:00

@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 refactors the Bigtable client's session diversion and shim layers, introducing support for global and per-scope session diversion configurations in DivertingUnaryCallable and refactoring ReadRowShim and ReadModifyWriteRowShim into stateless wrappers around inner stateful shims. However, the refactoring in ShimImpl.java introduced several compilation errors. Specifically, ReadRowShimInner is not imported, the field declarations do not match their initializations in the constructor, and decorateReadRow incorrectly attempts to use the removed readRowShim field instead of instantiating the new generic ReadRowShim class.

Add a methodScopeKey to DivertingUnaryCallable so session load can be
configured per-RPC-method via SessionDiversionConfiguration, in addition
to the existing global session_load. Resolve load from global_diversion
or per_scope_diversion based on which strategy the server returns.

Also move the supports() check before resolveSessionLoad() to avoid a
config lookup for requests the shim can't handle, and fix
ClientConfigurationManager to preserve session config when a diversion
configuration is present even if the global session_load is 0.

Change-Id: I3925b50b9ce0bd4e7b91b17888f9745d07dd9919
@mutianf
mutianf force-pushed the feat/session-diversion-config branch from 56b775f to cc0ad8f Compare October 18, 2026 02:11
@mutianf mutianf changed the title feat(bigtable): add session diversion for ReadRow, MutateRow, CheckAndMutateRow, and ReadModifyWriteRow feat(bigtable): add per-method session diversion configuration Oct 18, 2026
…e.useExperimental

Change-Id: I0501f16a70e7de8c3d9b7df3cb8dcb95040ab07c
@mutianf

mutianf commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 support for session diversion configurations in DivertingUnaryCallable, enabling both global and per-scope diversion strategies (e.g., routing specific Bigtable methods like ReadRow or MutateRow based on a per-method session load). It also updates ClientConfigurationManager to preserve session configurations when a diversion configuration is present and adds comprehensive unit tests to verify the routing behavior. There are no review comments provided, and the changes look solid, so I have no additional feedback to provide.

This branch has not been deployed

No deployments
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.

1 participant