rls: Migrate RLS LB to acceptResolvedAddresses() (#9612)

Second attempt at this, now with the understanding that RLS actually can
accept empty address lists.

This seems contrary to the behavior this LB advertizes with the canHandleEmptyAddressListFromNameResolution() method. This method is not overridden, so the default response of false is preserved. Empty address lists are supported though, and the parent LB never called the canHandleEmptyAddressListFromNameResolution() method.
This commit is contained in:
Terry Wilson 2022-10-10 13:38:03 -07:00 committed by GitHub
parent 31d777e212
commit 950fb7da61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -49,7 +49,7 @@ final class RlsLoadBalancer extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
logger.log(ChannelLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
LbPolicyConfiguration lbPolicyConfiguration =
(LbPolicyConfiguration) resolvedAddresses.getLoadBalancingPolicyConfig();
@ -78,6 +78,7 @@ final class RlsLoadBalancer extends LoadBalancer {
// not required.
this.lbPolicyConfiguration = lbPolicyConfiguration;
}
return true;
}
@Override

View File

@ -445,7 +445,7 @@ public class RlsLoadBalancerTest {
ConfigOrError parsedConfigOrError =
provider.parseLoadBalancingPolicyConfig(getServiceConfig());
assertThat(parsedConfigOrError.getConfig()).isNotNull();
rlsLb.handleResolvedAddresses(ResolvedAddresses.newBuilder()
rlsLb.acceptResolvedAddresses(ResolvedAddresses.newBuilder()
.setAddresses(ImmutableList.of(new EquivalentAddressGroup(mock(SocketAddress.class))))
.setLoadBalancingPolicyConfig(parsedConfigOrError.getConfig())
.build());