xds: wrr_locality LB to use acceptResolvedAddresses() (#9625)

Part of a migration to move load balancers away from
handleResolvedAddresses().
This commit is contained in:
Terry Wilson 2022-10-13 16:27:03 -07:00 committed by GitHub
parent 3198195908
commit e16f1436a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -61,7 +61,7 @@ final class WrrLocalityLoadBalancer extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
// The configuration with the child policy is combined with the locality weights
@ -76,7 +76,7 @@ final class WrrLocalityLoadBalancer extends LoadBalancer {
Status unavailable =
Status.UNAVAILABLE.withDescription("wrr_locality error: no locality weights provided");
helper.updateBalancingState(TRANSIENT_FAILURE, new ErrorPicker(unavailable));
return;
return false;
}
// Weighted target LB expects a WeightedPolicySelection for each locality as it will create a
@ -101,6 +101,8 @@ final class WrrLocalityLoadBalancer extends LoadBalancer {
resolvedAddresses.toBuilder()
.setLoadBalancingPolicyConfig(new WeightedTargetConfig(weightedPolicySelections))
.build());
return true;
}
@Override