-
Notifications
You must be signed in to change notification settings - Fork 4k
Milestone
Description
Since we are doing lot of wrapping on the LoadBalancer API, and Subchannels are passed through various interfaces, a wrapped Subchannel will require a lot of care to make sure it's consistent on all APIs, e.g.,
- The Subchannel from
createSubchannel()should be the same objects that's passed toSubchannelStateListeneron every wrapping level. - An upcoming ORCA load reporting API is another example (xds: implement lb policy backend metric api #5639 (comment)).
- The
SubchannelfromPickResultwill have to be unwrapped as well.ManagedChannelImplassumes theSubchannelfromPickResultis the real "SubchannelImpl".
Possible solutions:
- Move
LoadBalancer.Helpermethods that acceptsSubchannelto theSubchannelclass, e.g.,updateSubchannelAddresses(). Stop passingSubchannelto the listeners. But that requires astart(), which is a non-trivial API change on the currentSubchannel, but could be considered for new APIs. - The opposite of above -- move all state-mutating methods, e.g.,
shutdown(),requestConnection()toHelper, eliminating the need for wrappingSubchannel. - Provide a util to help correctly wrap
Subchannelwhile keeping the consistency. - Add another identity object to
Subchannel. This could also used byManagedChannelImplto retrieve the real "SubchannelImpl" fromPickResult.
Solutions 2 and 5 wouldn't go along with our plan of changing Subchannel attributes to an object, because a wrapping Helper can only add its own stuff on that object by wrapping it, which ends up the need for unwrapping it on the Subchannel. Otherwise they seem to work well.
Metadata
Metadata
Assignees
Labels
No labels