Skip to content

unwrap ForwardingSubchannel during Picks#12658

Draft
shivaspeaks wants to merge 3 commits intogrpc:masterfrom
shivaspeaks:unwrap-forwarding-subchannel
Draft

unwrap ForwardingSubchannel during Picks#12658
shivaspeaks wants to merge 3 commits intogrpc:masterfrom
shivaspeaks:unwrap-forwarding-subchannel

Conversation

@shivaspeaks
Copy link
Member

@shivaspeaks shivaspeaks commented Feb 16, 2026

This PR ensures that Load Balancing (LB) policies unwrap ForwardingSubchannel instances before returning them in a PickResult. This change is a critical prerequisite for deleting Subchannel Attributes and removing the internal getInternalSubchannel() API.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like we don't need WeightedRoundRobinPicker specifically here, as we're just using the normal pick API. Let's avoid digging into the picker for the tests that don't need it. Which unfortunately, isn't many of the ones you've changed (most dig into the picker).

PickResult result = delegate.pickSubchannel(args);
Subchannel subchannel = result.getSubchannel();
if (subchannel != null) {
if (subchannel instanceof ClusterImplLbHelper.ClusterImplSubchannel) {
Copy link
Member

Choose a reason for hiding this comment

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

Move this into the next block. It is already checking that there is a subchannel, and isOk() is guaranteed true when there's a subchannel (so it could have just checked the subchannel).

Copy link
Member

Choose a reason for hiding this comment

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

No, no. Yes, this is in our own tests, but digging in like this is pretty much always wrong. Let's add an accessor in testFixtures to get the delegate, similar to GracefulSwitchLoadBalancerAccessor

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no testFixtures for xds, should we create one? We can create OrcaOobUtilAccessor and put it within test/java/io/grpc/xds/orca forlder.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is the only other test that doesn't need the getWrrPicker()

@shivaspeaks shivaspeaks requested a review from ejona86 February 18, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments