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