Skip to content

feat(bigtable): add NoOpChannelPrimer for session channel pools - #20208

Merged
sushanb merged 2 commits into
googleapis:mainfrom
sushanb:feat/bigtable-noop-channel-primer
Jul 28, 2026
Merged

sushanb merged 2 commits into
googleapis:mainfrom
sushanb:feat/bigtable-noop-channel-primer

Conversation

@sushanb

@sushanb sushanb commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a NoOpChannelPrimer implementation of ChannelPrimer that explicitly disables per-connection priming. Session channel pools warm their channels via the OpenSession handshake on each newly-opened stream, so a PingAndWarm at dial time is redundant.

The ChannelPrimer contract already allows nil-as-"no priming" (see the factory's nil-primer branch), but nil is a placeholder-shaped sentinel — easy to misread as "primer not wired up yet" rather than a deliberate architectural choice. NoOpChannelPrimer makes the intent explicit at the construction site and gives the follow-up SessionClient refactor a named type to plumb.

Changes

  • channel_primer.go — new NoOpChannelPrimer struct{} + Prime method returning nil; interface docstring extended to name it alongside pingAndWarmChannelPrimer.
  • channel_primer_test.go — three new tests:
    • TestNoOpChannelPrimer_Prime — returns nil and doesn't dereference the connection.
    • TestNoOpChannelPrimer_ImplementsChannelPrimer — compile-time guard on interface satisfaction.
    • TestConnectionFactory_NoOpPrimerSkipsPriming — composes into the existing connectionFactory the same way nil does; no PingAndWarm on the wire.

Test plan

  • `go test ./bigtable/internal/transport/ -run 'ChannelPrimer|Primer|Prime' -count=1 -short` → 4/4 relevant + PingAndWarm suite all pass locally.
  • `go build ./bigtable/internal/transport/` clean.
  • `go vet ./bigtable/internal/transport/` clean.
  • `golint` clean.
  • CI green (post-rebase + consolidation).

@sushanb
sushanb requested review from a team as code owners July 23, 2026 20:21
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Jul 23, 2026

@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 NoOpChannelPrimer, an implementation of the ChannelPrimer interface that explicitly disables per-connection priming, along with corresponding unit tests. The reviewer suggested moving the compile-time interface satisfaction guard from a test function to a package-level variable to align with standard Go conventions.

Comment thread bigtable/internal/transport/channel_primer_test.go
NoOpChannelPrimer explicitly disables per-connection priming. Session
channel pools warm their channels via the OpenSession handshake on each
newly-opened stream, so a PingAndWarm at dial time is redundant.

The ChannelPrimer contract already allows nil-as-"no priming" (see the
factory's nil-primer branch), but nil is a placeholder-shaped sentinel —
easy to read as "primer not wired up yet" rather than a deliberate
choice. NoOpChannelPrimer makes the intent explicit at the construction
site and gives the session-client refactor a named type to plumb.

Tests:
- TestNoOpChannelPrimer_Prime: returns nil, doesn't dereference conn.
- TestNoOpChannelPrimer_ImplementsChannelPrimer: compile-time guard on
  the interface satisfaction.
- TestConnectionFactory_NoOpPrimerSkipsPriming: composes into the
  existing connectionFactory the same way nil does — no PingAndWarm on
  the wire.
@sushanb
sushanb force-pushed the feat/bigtable-noop-channel-primer branch from 9a3e933 to be6ed2a Compare July 28, 2026 16:24
TestConnectionFactory_NilPrimerSkipsPriming +
TestConnectionFactory_NoOpPrimerSkipsPriming were structurally
identical (same fake, same factory, same assertion) — differed only
in primer field. Fold into TestConnectionFactory_NoPrimingVariants
table-driven test with two cases (nil, NoOpChannelPrimer{}).

Same coverage, ~15 LOC less duplication, and any future no-prime
variant becomes a one-line entry to the cases slice instead of a
copy-pasted test function.
@sushanb
sushanb merged commit d055a8a into googleapis:main Jul 28, 2026
19 checks passed
sushanb added a commit that referenced this pull request Jul 28, 2026
…ols (#20209)

## Summary

Adds a session-pool sibling to `pingAndWarmDirectAccessChecker`. Session
channel pools do not use PingAndWarm — they warm channels via the
`OpenSession` handshake on each newly-opened stream (see #20208 —
`NoOpChannelPrimer`). Passing a NoOp primer into the classic checker
would leave `isALTSConn` unset, so the ALTS check would always fail for
session pools.

`getClientConfigDirectAccessChecker` runs the same `CheckCompatibility`
flow (dial → probe → ALTS check → success-metric or async
investigation), but issues `GetClientConfiguration` as the probe RPC —
the same verb session pools already talk on the wire.

## Changes

- **`direct_access_checker.go`** (modified): extract two shared helpers
from `pingAndWarmDirectAccessChecker` so both checkers can use them
without duplication.
- `investigateDirectAccessFailure(logger, reportFailure, probeSingle,
originalErr)` — the GCE-environment precondition walk, now taking a
`probeSingle` callback so each checker plugs in its own RPC-verb probe.
- `newAltsProbeChannel(ctx, targetEndpoint)` — the ALTS + oauth +
authority-override dial used by the single-endpoint investigation probe.
Behavior unchanged.
- `pingAndWarmDirectAccessChecker.investigateFailure` /
`.probeSingleEndpoint` become thin wrappers over the shared helpers.
Existing behavior preserved.
- **`direct_access_checker_getclientconfig.go`** (new):
`getClientConfigDirectAccessChecker` struct, constructor,
`CheckCompatibility`, `probeGetClientConfig` (the compatibility probe),
`probeSingleEndpoint` (the single-endpoint investigation probe), and
`recordProbePeer` — the ALTS + IP-protocol side-effect helper that
mirrors what `BigtableConn.Prime` does for PingAndWarm.
- **`direct_access_checker_getclientconfig_test.go`** (new): 7 tests
covering interface satisfaction, dialer identity, dial-failure
short-circuit, and the four IP/ALTS observation branches of
`recordProbePeer`.

## Test plan

- [x] \`go test ./bigtable/internal/transport/ -run
'GetClientConfigDirectAccess|RecordProbePeer' -count=1 -short\` → 7/7
pass.
- [x] \`go test ./bigtable/internal/transport/ -count=1 -short\` (full
transport suite, ~200 tests, 42s) → all pass, verifying the pingAndWarm
refactor is behavior-preserving.
- [x] \`go build\` / \`go vet\` / \`golint\` all clean.
- [ ] CI green.

## Follow-up

A subsequent PR will add a session-pool factory that wires this checker
alongside `NoOpChannelPrimer` (from #20208) and the
`ClientConfigurationManager` polling loop.
sushanb pushed a commit that referenced this pull request Aug 3, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.52.0](bigtable/v1.51.0...bigtable/v1.52.0)
(2026-08-03)


### Features

* **bigtable:** Add AFE picker (Simple / LeastInFlight / LeastLatency)
([#20204](#20204))
([bcbf714](bcbf714))
* **bigtable:** Add ClientConfig.DisableSession to opt out of session
backend
([#20297](#20297))
([7ee5e44](7ee5e44))
* **bigtable:** Add getClientConfigDirectAccessChecker for session pools
([#20209](#20209))
([3b8d30a](3b8d30a))
* **bigtable:** Add NoOpChannelPrimer for session channel pools
([#20208](#20208))
([d055a8a](d055a8a))
* **bigtable:** Add per-AFE sessionList for the two-tier session pool
([#20224](#20224))
([dbf0c3f](dbf0c3f))
* **bigtable:** Add protoRowToRow conversion helper for TableShim
([#20257](#20257))
([1297143](1297143))
* **bigtable:** Add Session debug surface (observability fields +
methods)
([#20211](#20211))
([d8d3e16](d8d3e16))
* **bigtable:** Add Session lifecycle (Start, Close, ForceClose,
readLoop, heartBeatLoop)
([#20215](#20215))
([b9e53c6](b9e53c6))
* **bigtable:** Add Session struct + state machine
([#20117](#20117))
([09acbb3](09acbb3))
* **bigtable:** Add session.Config.EnableDebug to gate sessionz debug
state
([#20247](#20247))
([ce74c31](ce74c31))
* **bigtable:** Add SessionClient + SessionTable + lazyPool
([#20228](#20228))
([ab2c96c](ab2c96c))
* **bigtable:** Add SessionPoolImpl (two-tier pool + scaling + debug)
([#20225](#20225))
([683eda8](683eda8))
* **bigtable:** Rename session pool display to
<resource-id>-<PERM>
([#20248](#20248))
([35e146e](35e146e))
* **bigtable:** Route Client.Open()-returned *Table through the Diverter
([#20273](#20273))
([2b81c7d](2b81c7d))
* **bigtable:** State-based classification for abnormal session close
([#20243](#20243))
([f2905b7](f2905b7))
* **bigtable:** TableShim fallback to classic on session UNIMPLEMENTED
([#20269](#20269))
([36540af](36540af))
* **bigtable:** TTL-on-idle cache for per-resource session.TableAPI
([#20263](#20263))
([00b2a49](00b2a49))
* **bigtable:** Wire Diverter on Client and route Open* via TableShim
([#20256](#20256))
([b32fbd7](b32fbd7))


### Bug Fixes

* **bigtable:** AFE picker latency signal — subtract poolWait and
compute TransportLatency = wire − backend at source
([#20281](#20281))
([bb8c4d5](bb8c4d5))
* **bigtable:** Guard NewStream OnFinish against grpc-go double-fire
([#20295](#20295))
([b51da29](b51da29))
* **bigtable:** Real per-resource pool teardown on sessionTable.Close +
cache close-race gate
([#20264](#20264))
([599aea9](599aea9))
* **bigtable:** Session.durations / session.uptime — set explicit
histogram bucket boundaries
([#20276](#20276))
([97eee22](97eee22))
* **bigtable:** SessionTableHandle self-heals across cache eviction
([#20296](#20296))
([0dd98cd](0dd98cd))
* **bigtable:** Translate ctx errors to gRPC status on session vRPC
([#20299](#20299))
([0f3b2a5](0f3b2a5))
* **bigtable:** Treat PingAndWarm NotFound as a successful prime
([#20219](#20219))
([a1557ad](a1557ad))


### Performance Improvements

* **bigtable:** Delete periodic Tick loop; sizing is event-driven
([#20285](#20285))
([2c096bd](2c096bd))
* **bigtable:** Drop pick_lost_race debug tag from CheckoutSession hot
path
([#20280](#20280))
([bd0e400](bd0e400))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants