refactor(bigtable): move ClientConfigurationManager into internal/ses… - #12
Open
mutianf wants to merge 1 commit into
Open
refactor(bigtable): move ClientConfigurationManager into internal/ses…#12mutianf wants to merge 1 commit into
mutianf wants to merge 1 commit into
Conversation
…sion The classic Client used to construct and own the CCM, then inject it into session.NewSessionClient so per-pool listeners could register. CCM is fundamentally session-shaped (its consumers are the session pool sizing listener and the classic/session traffic diverter), so let the session tier own its construction and lifecycle. session.NewSessionClient now dials Bigtable, builds the CCM bound to its own stub, and starts polling. sessionClient.Close cascades: CCM.Close (which barriers in-flight listener callbacks) before tearing down the gRPC connection. A new OnSessionLoad method on the SessionClient interface lets the classic Client wire the diverter without re-exposing internal/transport types. Drive-by fixes uncovered by the refactor: - Diverter bootstrap was NewDiverter(1.0), which routed everything through a not-yet-existent session pool when EnableSessionPool=false. Bootstrap is now 0.0 (safe all-classic default); the OnSessionLoad listener is the single writer that raises it. - CCM listeners fired on every successful poll regardless of whether the config had changed, so SessionPoolImpl.UpdateConfig and Diverter.SetSessionLoad were re-invoked on every 5-minute tick. AddSessionLoadListener and AddSessionPoolListener now cache the value they last delivered and short-circuit on unchanged polls, mirroring Java's ListenerEntry.maybeNotify(oldValue, newValue) equality check. Change-Id: Ie31aba57d2f31e13378c439677898ae9a847bf23
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.
…sion
The classic Client used to construct and own the CCM, then inject it into session.NewSessionClient so per-pool listeners could register. CCM is fundamentally session-shaped (its consumers are the session pool sizing listener and the classic/session traffic diverter), so let the session tier own its construction and lifecycle.
session.NewSessionClient now dials Bigtable, builds the CCM bound to its own stub, and starts polling. sessionClient.Close cascades: CCM.Close (which barriers in-flight listener callbacks) before tearing down the gRPC connection. A new OnSessionLoad method on the SessionClient interface lets the classic Client wire the diverter without re-exposing internal/transport types.
Drive-by fixes uncovered by the refactor:
Diverter bootstrap was NewDiverter(1.0), which routed everything through a not-yet-existent session pool when EnableSessionPool=false. Bootstrap is now 0.0 (safe all-classic default); the OnSessionLoad listener is the single writer that raises it.
CCM listeners fired on every successful poll regardless of whether the config had changed, so SessionPoolImpl.UpdateConfig and Diverter.SetSessionLoad were re-invoked on every 5-minute tick. AddSessionLoadListener and AddSessionPoolListener now cache the value they last delivered and short-circuit on unchanged polls, mirroring Java's ListenerEntry.maybeNotify(oldValue, newValue) equality check.
Change-Id: Ie31aba57d2f31e13378c439677898ae9a847bf23