feat(tonic-xds): compute gRFC A42 request hash from header hash policy#2686
Merged
YutaoMa merged 8 commits intoJun 18, 2026
Merged
Conversation
|
|
45848fb to
5745c41
Compare
ankurmittal
reviewed
Jun 15, 2026
ankurmittal
reviewed
Jun 15, 2026
ankurmittal
reviewed
Jun 15, 2026
ankurmittal
reviewed
Jun 15, 2026
YutaoMa
reviewed
Jun 16, 2026
YutaoMa
reviewed
Jun 16, 2026
Contributor
|
Specify this is scoped for tonic-xds in PR title for better discoverability. |
Adds the request-hash computation that the ring-hash LB picker (A42) will
consume, ahead of the picker itself:
- HashPolicyConfig::Header type (RDS parsing deferred to a later PR)
- RouteDecision.request_hash field
- compute_request_hash(): XXH64 seed-0 with Envoy's rotate-XOR combination
and terminal short-circuit
- resolve_route populates request_hash from a default header policy
("x-ring-hash-key") as scaffolding until RDS hash_policy parsing lands
Adds the xxhash-rust dependency. Core-first sequencing: the data plane is
built and tested before xDS config wiring.
5745c41 to
6ad7479
Compare
content-type is hashed correctly by the generic header path (tonic always sets content-type=application/grpc before routing), matching grpc-go, so no special-casing is owed.
Per gRFC A42, a terminal hash policy stops further combination once any hash has been generated, even if the terminal policy itself produced no hash (e.g. its header is absent). The previous code only short-circuited when the terminal policy matched, diverging from Envoy/grpc-go. Move the terminal check out of the matched branch and gate it on the accumulated hash. Add a test covering a terminal policy with an absent header following a matching policy.
c7e951e to
1dea873
Compare
YutaoMa
reviewed
Jun 18, 2026
…ffer Hash the comma-joined header values straight into a streaming Xxh64 hasher instead of building a concatenated Vec. XXH64 is boundary-independent, so the digest is unchanged (existing pinned-digest tests still pass); this removes the multi-value allocation and unifies the single- and multi-value paths.
YutaoMa
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement gRFC A42: xDS Ring Hash LB Policy in tonic-xds. It lands the per-request hash computation.
What this PR does
Tests
Added UTs.
Currently this path won't be called in production.
Plan (A42 series)