Skip to content

Conversation

@marek-szews
Copy link

@marek-szews marek-szews commented Oct 14, 2025

Implements [gRFC A68]https://github.com/grpc/proposal/blob/master/A68-random-subsetting.md

RELEASE NOTES:

  • balancer/randomsubsetting: Implementation of the random_subsetting LB policy

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 14, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@easwars easwars self-assigned this Oct 15, 2025
@easwars easwars self-requested a review October 15, 2025 19:17
@easwars easwars added Type: Feature New features or improvements in behavior Area: xDS Includes everything xDS related, including LB policies used with xDS. Area: Resolvers/Balancers Includes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities. and removed Area: xDS Includes everything xDS related, including LB policies used with xDS. labels Oct 15, 2025
@easwars
Copy link
Contributor

easwars commented Oct 15, 2025

@marek-szews : Could you please get the tests to pass. Thanks.

}

// LBConfig is the config for the outlier detection balancer.
type LBConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this type to be exported. I don't see a reason here. So, if there is no reason, please unexport it. The fields can remain exported since you might want that for JSON marshal/unmarshal.

Copy link
Author

@marek-szews marek-szews Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to use this type in the test function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is also in the same package and should have access to unexported symbols.

Comment on lines 86 to 87
// Default top layer values.
SubsetSize: 10,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this default value specified?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous proposal of config I have found somthing like this (PROP-423):
message RandomSubsettingLbConfig {
// subset_size indicates how many backends every client will be connected to.
// Default is 20.
google.protobuf.UInt32Value subset_size = 1;

But I saw in the most current version (PROTO-157) that this information has been removed. My suggestion is to set subsetSize to 2 by default, because 1 should suggest to use pick_first instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert to using no defaults, both for the subset size and the child policy. Both need to be specified by the user, and if they are missing, the configuration needs to be rejected by returning an error from ParseConfig.

}

// if someonw needs subsetSize == 1, he should use pick_first instead
if lbCfg.SubsetSize < 2 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gRFC only says the following:

    // The value is required and must be greater than 0.

Is the condition that the size be at least 2 specified somewhere else?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the discussion at line 86

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 86 of what?

The only thing we should be checking is whether the subset size is greater than 0 and if not, returning an error from this method.

@github-actions
Copy link

This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.

@github-actions github-actions bot added stale and removed stale labels Oct 23, 2025
@dfawley
Copy link
Member

dfawley commented Oct 29, 2025

Hi @marek-szews - I think we're waiting on you to make some updates so we can continue the review. We can discuss Friday but I wanted to ping this in part to prevent the stale bot from closing it.

@arjan-bal arjan-bal added this to the 1.78 Release milestone Oct 30, 2025
Copy link
Author

@marek-szews marek-szews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rework done, tests passed

Comment on lines 86 to 87
// Default top layer values.
SubsetSize: 10,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous proposal of config I have found somthing like this (PROP-423):
message RandomSubsettingLbConfig {
// subset_size indicates how many backends every client will be connected to.
// Default is 20.
google.protobuf.UInt32Value subset_size = 1;

But I saw in the most current version (PROTO-157) that this information has been removed. My suggestion is to set subsetSize to 2 by default, because 1 should suggest to use pick_first instead.

@dfawley dfawley assigned easwars and unassigned marek-szews Oct 31, 2025
@easwars easwars changed the title Implementation of A68 random_subsetting LB policy. balancer/randomsubsetting: Implementation of the LB policy Nov 13, 2025
@easwars easwars changed the title balancer/randomsubsetting: Implementation of the LB policy balancer/randomsubsetting: Implementation of the random_subsetting LB policy Nov 13, 2025
@easwars
Copy link
Contributor

easwars commented Nov 13, 2025

Rework done, tests passed

Tests are still failing. Please read this document for guidelines: https://github.com/grpc/grpc-go/blob/master/CONTRIBUTING.md

TL;dr

All tests need to be passing before your change can be merged. We recommend you run tests locally before creating your PR to catch breakages early on:

./scripts/vet.sh to catch vet errors.
go test -cpu 1,4 -timeout 7m ./... to run the tests.
go test -race -cpu 1,4 -timeout 7m ./... to run tests in race mode

@easwars easwars assigned marek-szews and unassigned easwars Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Resolvers/Balancers Includes LB policy & NR APIs, resolver/balancer/picker wrappers, LB policy impls and utilities. Type: Feature New features or improvements in behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants