Commit a25e93d
authored
feat(bigtable): modularize Direct Access compatibility check (#19987)
## Summary
- Extract the Direct Access compatibility decision out of
`BigtableChannelPool` behind a new `DirectAccessChecker` interface so
each channel pool factory can plug in its own strategy.
- Today's only implementation, `pingAndWarmDirectAccessChecker`,
preserves current behavior (PingAndWarm probe + ALTS check + async
failure investigation + `direct_access/compatible` metric). The upcoming
session pool factory will plug in a `GetClientConfiguration`-based
checker (driven by `ClientConfigurationManager`) without touching the
pool.
- A small `disabledDirectAccessChecker` keeps the
`direct_access/compatible{reason=manually_disabled}` reading when the
env/config disables Direct Access — the env var check moves up to the
factory so the pool no longer re-reads `CBT_ENABLE_DIRECTPATH`.
## Changes
- **New** `internal/transport/direct_access_checker.go`:
`DirectAccessChecker` interface, `pingAndWarmDirectAccessChecker`,
`disabledDirectAccessChecker`, and the moved helpers
(`xdsCdsURITemplate`, `checkIPPlumbing`, `checkKernelRoutes`,
`probeSingleEndpoint`).
- `internal/transport/connpool.go`: remove `directAccessDialer`,
`directAccessFeatureFlagsMD`, `daEligibleGauge` fields, the
`WithDirectAccessDialer` / `WithDirectAccessFeatureFlagsMetadata`
options, the in-pool probe + investigation chain, the duplicate
`CBT_ENABLE_DIRECTPATH` check, and the metric reporting helpers. Add
`WithDirectAccessChecker`. `NewBigtableChannelPool` now just delegates
to the checker.
- `internal/transport/channel_pool_factory.go`: when
`isDirectAccessEnabled(config)` is true, wire a
`pingAndWarmDirectAccessChecker`; otherwise wire a
`disabledDirectAccessChecker`. Both passed via
`WithDirectAccessChecker`.
- `internal/transport/connpool_test.go`: six `TestDirectAccessLogic`
subtests updated to construct the appropriate checker. The env-disabled
subtest becomes `DirectAccess_DisabledChecker` since the env-var gate
has moved to the factory layer.
## Test plan
- [x] `cd bigtable && go build ./...`
- [x] `cd bigtable && go vet ./...`
- [x] `cd bigtable && go test ./internal/transport/... -count=1` (full
transport suite, including all six `TestDirectAccessLogic` subtests,
`TestCreateAndStartManagedChannelPool*`, and
`TestManagedChannelPool_Close`)1 parent 0bbd701 commit a25e93d
6 files changed
Lines changed: 508 additions & 339 deletions
File tree
- bigtable/internal/transport
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
156 | 159 | | |
157 | 160 | | |
158 | 161 | | |
159 | | - | |
160 | 162 | | |
161 | 163 | | |
162 | | - | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
| |||
175 | 182 | | |
176 | 183 | | |
177 | 184 | | |
178 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
179 | 196 | | |
180 | 197 | | |
181 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
0 commit comments