Commit 96cfd47
authored
feat(client): Enable routing cookie and attempt headers for enhanced retries (#12964)
Implements client-side logic to support the Cloud Bigtable routing
cookie protocol (see
[go/cbt-support-routing-cookie](http://go/cbt-support-routing-cookie)).
This feature enhances server-initiated retries and improves resilience.
Specific modifications:
* **Feature Flag:** The client now signals support for this feature by
setting `RoutingCookie: true` in the `bigtable-features` header.
* **Cookie Propagation:** Any headers prefixed with `x-goog-cbt-cookie-`
received in response metadata are collected and sent back on subsequent
requests for the same operation.
* **Attempt Header:**
* The `x-goog-cbt-attempt` header is added to each outgoing RPC attempt.
* This integer value starts at 0 and is incremented before each call.
* Crucially, the counter is reset to 0 if the client receives *any*
metadata (headers or trailers) from the server, indicating the request
reached the backend. This helps differentiate between network issues and
server-side retries.
* **Internal Tracking:** The `opTracer` in `metrics.go` now stores the
current cookies and the `routingAttempt` number.
These changes enable more sophisticated load balancing and retry
strategies, by giving the service and routing layers visibility into the
client's retry state and a mechanism to influence client behavior.
Fixes: #126581 parent 1c63383 commit 96cfd47
File tree
3 files changed
+41
-11
lines changed- bigtable
- internal/testproxy
3 files changed
+41
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
| |||
398 | 401 | | |
399 | 402 | | |
400 | 403 | | |
| 404 | + | |
401 | 405 | | |
402 | 406 | | |
403 | 407 | | |
| |||
2281 | 2285 | | |
2282 | 2286 | | |
2283 | 2287 | | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
2284 | 2299 | | |
2285 | 2300 | | |
2286 | 2301 | | |
2287 | | - | |
| 2302 | + | |
2288 | 2303 | | |
2289 | 2304 | | |
2290 | 2305 | | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2291 | 2309 | | |
2292 | 2310 | | |
2293 | 2311 | | |
2294 | 2312 | | |
2295 | 2313 | | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
460 | 463 | | |
461 | 464 | | |
462 | 465 | | |
| |||
524 | 527 | | |
525 | 528 | | |
526 | 529 | | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
533 | 535 | | |
534 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
535 | 544 | | |
536 | 545 | | |
537 | 546 | | |
| |||
0 commit comments