Description
The balancer API uses important pieces of functionality provided by gRPC via the following interfaces: balancer.ClientConn and balancer.SubConn.
While the balancer.ClientConn
interface provides the functionality to create and delete a balancer.SubConn
, the functionality to modify the addresses of an existing balancer.SubConn
is provided by the balancer.SubConn
interface itself. This asymmetry create an unnecessary pain-point for LB policy implementations in a setup with a tree of LB policies.
The proposed API change here is as follows:
- Extend the
balancer.ClientConn
interface by providing a way to update addresses of an existingbalancer.SubConn
.
// UpdateAddresses updates the addresses used in the passed in SubConn.
// gRPC checks if the currently connected address is still in the new list.
// If so, the connection will be kept. Else, the connection will be
// gracefully closed, and a new connection will be created.
//
// This will trigger a state transition for the SubConn.
UpdateAddresses(SubConn, []resolver.Address)
- Remove the
UpdateAddresses
method on thebalancer.SubConn
interface, which would then provide a singleConnect()
method.
The plan would be as follows:
- Add
UpdateAddresses()
tobalancer.ClientConn
as part of the1.37.x
release. - Remove
UpdateAddresses()
frombalancer.SubConn
in a future release. Maybe1.38.x
or a subsequent one.- We will wait 2 release. So
UpdateAddresses()
will be removed inv1.39.x
- We will wait 2 release. So
While these changes are not strictly following semantic versioning or the Go compatibility promise, they are in accordance with our versioning policy as the changes are limited to experimental APIs.