Repository navigation
Conversation
Follow-up to googleapis#14681. Three issues found reviewing the merged change. 1. The per-RPC diversion decision (DivertingUnaryCallable.resolveSessionLoad) and the client-wide "are sessions in use at all" decision (ClientConfigurationManager.divertsAnyTrafficToSessions) implemented two different, drifting rules. The client-wide one was the more permissive: it ORed the deprecated flat session_load with the diversion config and scanned every scope key, including methods no DivertingUnaryCallable asks for. So a config such as per_scope_diversion { "method:Bigtable.MutateRows": {session_load: 1.0} } made areSessionsRequired() true, flipping the sessions_required / sessions_compatible feature flags advertised to the server and keeping the session config and channel pool alive, while not a single request was ever diverted. Both now go through SessionScope, which owns the list of scopes this client actually serves, whether each honours the deprecated flat session_load, and the one resolution rule. The disagreement is no longer representable. 2. The default client config carried a zero-valued per_scope_diversion for ReadRow and MutateRow. A diversion configuration is authoritative once present, so those entries shadowed the flat session_load for every scope in any config derived from the default: the initial config before the first GetClientConfiguration response, the handleFailedFetch fallback when the validity window expires, and anything merged from the bigtable.internal.client-config-override sys-prop. The entries were purely documentary (an absent key and an absent config both resolve to 0), so they are removed. 3. ReadModifyWriteRow on the session path extracted its row with `r.hasRow() ? r.getRow() : null`, so a response without a row handed user code a null that the classic path never produces. Unlike ReadRow, where a missing key legitimately means null, ReadModifyWriteRow always mutates and always yields a row, so it now extracts unconditionally. Also forwards the per-method retry settings to the default call context for CheckAndMutateRow and ReadModifyWriteRow, matching ReadRow and MutateRow. Change-Id: Ifa30efb0e07cf07495d753200bfec6d277f0e5e9
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new SessionScope enum to encapsulate per-method diversion scopes and their session load resolution rules. This refactoring unifies the diversion logic previously split across DivertingUnaryCallable and ClientConfigurationManager, ensuring consistency between per-RPC routing and client-wide session management. Additionally, retry settings are now correctly propagated to the default call context for check-and-mutate and read-modify-write row callables, and corresponding unit tests have been added or updated. There are no review comments, so I have no feedback to provide.
nimf
approved these changes
Oct 23, 2026
mutianf
enabled auto-merge (squash)
October 23, 2026 01:28
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #14681, from reviewing it after it merged. Three independent fixes.
1. Two drifting resolution rules (the main one)
DivertingUnaryCallable.resolveSessionLoad(per RPC) andClientConfigurationManager.divertsAnyTrafficToSessions(client-wide) answered "does traffic go to sessions?" with separately maintained rules that had already diverged:session_loadSo
per_scope_diversion { "method:Bigtable.MutateRows": {session_load: 1.0} }madeareSessionsRequired()true — flipping thesessions_required/sessions_compatiblefeature flags sent to the server and keeping the session config and channel pool alive — whileDivertingUnaryCallablediverted exactly zero requests, because no callable asks for that scope. Same forsession_load: 1.0plus a CheckAndMutateRow-only map.Both now go through a new
SessionScopeenum, which owns the four scopes this client serves, whether each honours the deprecated flatsession_load, and the single resolution rule (moved verbatim out ofDivertingUnaryCallable).ShimImplpassesSessionScope.READ_ROWinstead of aString+booleanpair.2. The default config shadowed the flat
session_loadbigtable-default-client-config.textprotocarried a zero-valuedper_scope_diversionfor ReadRow and MutateRow. Since a diversion configuration is authoritative once present, those entries forced every scope to 0 in any config derived from the default:normalizeConfig(defaultConfig)before the firstGetClientConfigurationresponse,handleFailedFetch→setClientConfiguration(defaultConfig)path when the validity window expires during a config-service outage,bigtable.internal.client-config-overridesys-prop, including thebigtable-session-itMaven profile.This surfaced as 10
ClientConfigurationManagerTestfailures the moment fix 1 made the two checks agree — they had been passing only because the client-wide check disagreed and reported sessions as on. The entries were purely documentary (an absent key and an absent diversion config both resolve to 0), so they are removed.3. ReadModifyWriteRow could return
nullon the session pathThe extractor was
r -> r.hasRow() ? r.getRow() : null, so aSessionReadModifyWriteRowResponsewithout a row handed user code anullthe classic path never produces (EnhancedBigtableStubalways builds aRowfrom the possibly-unsetresp.getRow()). Unlike ReadRow — where a missing key legitimately meansnull— ReadModifyWriteRow always mutates and always yields a row, so it now extracts unconditionally. Both extractors are named constants with tests pinning the split.Also forwards the per-method retry settings to the default call context for CheckAndMutateRow and ReadModifyWriteRow, matching the existing ReadRow and MutateRow wiring.
Testing
New
SessionScopeTest(7 cases) covers the resolution rule and the agreement invariant; new cases inShimImplTestpin the ReadRow-null / ReadModifyWriteRow-non-null split, andClientConfigurationManagerTestgains one asserting the bundled default never shadows a flatsession_load.DivertingUnaryCallableTest,ClientConfigurationManagerTest,ShimImplTest,SessionDeadlineTest,SessionScopeTest,RowBuilderShimTest,ReadModifyWriteRowShimTest— 57 tests, all passing.