-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
LBv2 (design doc) consists of LoadBalancer2 and its supporting channel implementation ManagedChannelImpl2. Here we outline the transition path from the current LoadBalancer and ManagedChannelImpl (a.k.a LBv1) to LBv2.
The transition is transparent to users who only use the default or stock LoadBalancers that are shipped with gRPC. The following transition plan should only concern advanced users who implement or use custom LoadBalanacer(s).
Also note all changes happen on master first. The changes scheduled for gRPC 1.2 will happen on master soon after 1.1 is released.
During gRPC 1.1
LBv1 and LBv2 coexist. LBv1 is the default one. Both can be set to the channel builder, while LBv2 is used only if a LoadBalancer2 implementation is set to the channel builder.
During this period, implementors re-write their LBs with the v2 API, and migrate their customers to their v2 LBs.
For example, FooBalancerFactory is the current LB, while Foo2BalancerFactory is the new one that uses LBv2.
class FooBalancerFactory extends LoadBalancer.Factory {
}
class Foo2BalancerFactory extends LoadBalancer2.Factory {
}While the v1 version continues working:
NettyChannelBuilder.forTarget(...).loadBalancerFactory(new FooBalancerFactory()).build();Customers should be migrated to use the v2 version:
NettyChannelBuilder.forTarget(...).loadBalancerFactory(new Foo2BalancerFactory()).build();During gRPC 1.2
We replace LoadBalancer with LoadBalancer2, and keep LoadBalancer2 as an alias to LoadBalancer by extending it. LBv1 interfaces and codepath are deleted. All v1-based LBs stop working with gRPC.
Prior to switching to 1.2, the implementors must have switched all their customers to the v2-based LoadBalancer2. During 1.2, they should rebase their v2-based implementations to the proper LoadBalancer interface.
For example, this continues working because LoadBalancer2 extends LoadBalancer:
class Foo2BalancerFactory extends LoadBalancer2.Factory {
}.., but it should be updated to this to prevent breakage with gRPC 1.3:
class Foo2BalancerFactory extends LoadBalancer.Factory {
}gRPC 1.3
We delete the alias LoadBalancer2.