Repository navigation
Commit 5214ab7
authored
feat(bigtable): modularize channel priming behind a ChannelPrimer interface (#20027)
## Summary
Mirrors the pluggable shape that PR #19987 established for the Direct
Access compatibility check. Channel priming had been hard-wired into the
pool via three loose options (`WithInstanceName` / `WithAppProfile` /
`WithFeatureFlagsMetadata`) that the `connectionFactory` had to stitch
back together on every dial.
- New `ChannelPrimer` interface (`channel_primer.go`): `Prime(ctx,
*BigtableConn) error`. The pluggable extension point that future pool
factories (session-based, custom) can swap in.
- `pingAndWarmChannelPrimer` is today's only implementation; it owns the
`(instance, appProfile, featureFlagsMD)` tuple and delegates to
`BigtableConn.Prime` — the existing `PingAndWarm` RPC stays untouched.
- New `WithChannelPrimer` pool option replaces `WithInstanceName` /
`WithAppProfile` / `WithFeatureFlagsMetadata`.
- `connectionFactory` now carries a `ChannelPrimer` instead of three
individual fields. **When the primer is nil, `primeWithRetry` returns
immediately** — the pool dials the channel and puts it straight into
rotation, no `PingAndWarm` sent. The classic channel pool factory still
wires the `pingAndWarmChannelPrimer`, so user-facing default behavior is
unchanged.
- `pingAndWarmDirectAccessChecker` reuses the same primer rather than
duplicating `conn.Prime(ctx, instance, profile, flags)` in two places.
The factory now constructs **one** primer and shares it with both the
pool (via `WithChannelPrimer`) and the checker, eliminating the
three-arg drift that existed across the two consumers.
## Test plan
- [x] `go build ./...` clean
- [x] `go vet ./...` clean
- [x] `golint` clean on touched files
- [x] `go test ./internal/transport/...` passes (existing tests
migrated; new `channel_primer_test.go` covers (a)
`pingAndWarmChannelPrimer.Prime` issues `PingAndWarm` carrying the
configured feature-flag metadata, and (b) `connectionFactory` skips
priming entirely when the primer is nil)1 parent 2e6820b commit 5214ab7
6 files changed
Lines changed: 214 additions & 76 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 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
159 | 163 | | |
160 | | - | |
161 | | - | |
162 | 164 | | |
163 | 165 | | |
164 | | - | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
187 | | - | |
188 | | - | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 104 | | |
112 | 105 | | |
113 | 106 | | |
| |||
129 | 122 | | |
130 | 123 | | |
131 | 124 | | |
132 | | - | |
133 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
134 | 132 | | |
135 | | - | |
| 133 | + | |
136 | 134 | | |
137 | 135 | | |
138 | 136 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 137 | + | |
| 138 | + | |
148 | 139 | | |
149 | | - | |
| 140 | + | |
150 | 141 | | |
151 | 142 | | |
152 | 143 | | |
| |||
372 | 363 | | |
373 | 364 | | |
374 | 365 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
| 366 | + | |
379 | 367 | | |
380 | 368 | | |
381 | 369 | | |
| |||
391 | 379 | | |
392 | 380 | | |
393 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
394 | 389 | | |
395 | 390 | | |
396 | 391 | | |
| |||
441 | 436 | | |
442 | 437 | | |
443 | 438 | | |
444 | | - | |
445 | | - | |
446 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
447 | 442 | | |
448 | 443 | | |
449 | 444 | | |
| |||
463 | 458 | | |
464 | 459 | | |
465 | 460 | | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
471 | 464 | | |
472 | 465 | | |
473 | 466 | | |
| |||
980 | 973 | | |
981 | 974 | | |
982 | 975 | | |
983 | | - | |
984 | | - | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
985 | 979 | | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
991 | 983 | | |
992 | 984 | | |
993 | | - | |
994 | | - | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
995 | 988 | | |
996 | 989 | | |
997 | 990 | | |
| |||
1006 | 999 | | |
1007 | 1000 | | |
1008 | 1001 | | |
1009 | | - | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
1010 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
1011 | 1009 | | |
1012 | 1010 | | |
1013 | 1011 | | |
| |||
1022 | 1020 | | |
1023 | 1021 | | |
1024 | 1022 | | |
1025 | | - | |
| 1023 | + | |
1026 | 1024 | | |
1027 | 1025 | | |
1028 | 1026 | | |
| |||
0 commit comments