xds: fix RingHash LB null pointer issue (#8438)

This commit is contained in:
ZHANG Dapeng 2021-08-24 11:27:02 -07:00 committed by GitHub
parent e45aab085c
commit cae2339366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -188,8 +188,10 @@ final class CdsLoadBalancer2 extends LoadBalancer {
if (root.result.lbPolicy() == LbPolicy.RING_HASH) {
lbProvider = lbRegistry.getProvider("ring_hash");
lbConfig = new RingHashConfig(root.result.minRingSize(), root.result.maxRingSize());
} else {
}
if (lbProvider == null) {
lbProvider = lbRegistry.getProvider("round_robin");
lbConfig = null;
}
ClusterResolverConfig config = new ClusterResolverConfig(
Collections.unmodifiableList(instances), new PolicySelection(lbProvider, lbConfig));