Skip to content

Cherry pick #8864 to v1.79.x#8896

Merged
eshitachandwani merged 1 commit intogrpc:v1.79.xfrom
eshitachandwani:cherrypickjd
Feb 11, 2026
Merged

Cherry pick #8864 to v1.79.x#8896
eshitachandwani merged 1 commit intogrpc:v1.79.xfrom
eshitachandwani:cherrypickjd

Conversation

@eshitachandwani
Copy link
Copy Markdown
Member

Original PR : #8864

RELEASE NOTES:

  • pickfirst: Add support for weighted random shuffling of endpoints, as described in gRFC A113

This PR implements the currently in-review gRFC A113:
grpc/proposal#535. I've split the PR into
logically separate commits to help with the review process.

Summary of changes:
- Commit 1: simplify the implementation of `groupLocalitiesByPriority`
- Change the implementation to use newly added methods in the stdlib
`maps` and `slices` package to significantly simplify the implementation
(and get rid of an unnecessary test)
- Commit 2: Remove code that handles localities and endpoints of weight
0
- Remove unnecessary checks for locality and endpoint weights of `0` in
`cluster_resolver`. The xDS client already guarantees that these weights
will never be set to `0`.
- Commit 3: add the env var GRPC_EXPERIMENTAL_PF_WEIGHTED_SHUFFLING
- Commit 4: Weight computation changes in cluster_resolver LB policy
- This performs the weight normalization and fixed-point arithmetic
specified in A113
  - The change here is guarded by the above env var
- Ended up duplicating the tests that verify the weight computation
behavior. This will make it easier to delete the old tests when the env
var is removed.
- Commit 5: Fix a broken test in ring_hash due to the new weight
computation
- Commit 6: Weighted shuffling in pick_first
  - Contains the changes specified in A113 for the pick_first LB policy
  - Changes are guarded by the env var

RELEASE NOTES:
- pickfirst: Add support for weighted random shuffling of endpoints, as
described in gRFC A113
@eshitachandwani eshitachandwani added this to the 1.79 Release milestone Feb 11, 2026
@eshitachandwani eshitachandwani added the Type: Meta Github repo, process, etc label Feb 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 92.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.33%. Comparing base (0381eb6) to head (eafc876).
⚠️ Report is 1 commits behind head on v1.79.x.

Files with missing lines Patch % Lines
balancer/pickfirst/pickfirst.go 92.59% 1 Missing and 1 partial ⚠️
...rnal/xds/balancer/clusterresolver/configbuilder.go 91.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           v1.79.x    #8896      +/-   ##
===========================================
- Coverage    83.48%   83.33%   -0.15%     
===========================================
  Files          414      414              
  Lines        32720    32743      +23     
===========================================
- Hits         27315    27287      -28     
- Misses        4025     4058      +33     
- Partials      1380     1398      +18     
Files with missing lines Coverage Δ
balancer/pickfirst/internal/internal.go 100.00% <ø> (ø)
internal/envconfig/envconfig.go 100.00% <ø> (ø)
balancer/pickfirst/pickfirst.go 89.28% <92.59%> (-0.34%) ⬇️
...rnal/xds/balancer/clusterresolver/configbuilder.go 92.42% <91.30%> (-1.61%) ⬇️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eshitachandwani eshitachandwani merged commit 68804be into grpc:v1.79.x Feb 11, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Meta Github repo, process, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants