Skip to content

refactor(bigtable): move ClientConfigurationManager into internal/ses… - #12

Open
mutianf wants to merge 1 commit into
sushanb:vprc-integrationfrom
mutianf:vprc-integration
Open

refactor(bigtable): move ClientConfigurationManager into internal/ses…#12
mutianf wants to merge 1 commit into
sushanb:vprc-integrationfrom
mutianf:vprc-integration

Conversation

@mutianf

@mutianf mutianf commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

…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

…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
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