xds: fix ring hash childLB acceptResolvedAddress not in syncContext (#10664)

This commit is contained in:
yifeizhuang 2023-11-13 14:58:30 -08:00 committed by GitHub
parent d5544bbb02
commit ae62785e0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -425,12 +425,14 @@ final class RingHashLoadBalancer extends MultiChildLoadBalancer {
return PickResult.withNoResult();
}
if (subchannelView.connectivityState == IDLE || childLbState.isDeactivated()) {
if (childLbState.isDeactivated()) {
childLbState.activate();
} else {
syncContext.execute(() -> childLbState.getLb().requestConnection());
}
if (subchannelView.connectivityState == IDLE) {
syncContext.execute(() -> {
if (childLbState.isDeactivated()) {
childLbState.activate();
} else {
childLbState.getLb().requestConnection();
}
});
return PickResult.withNoResult(); // Indicates that this should be retried after backoff
}
@ -531,11 +533,10 @@ final class RingHashLoadBalancer extends MultiChildLoadBalancer {
if (!isDeactivated()) {
return;
}
currentConnectivityState = CONNECTING;
getLb().switchTo(pickFirstLbProvider);
markReactivated();
getLb().acceptResolvedAddresses(this.getResolvedAddresses()); // Time to get a subchannel
getLb().acceptResolvedAddresses(this.getResolvedAddresses());
logger.log(XdsLogLevel.DEBUG, "Child balancer {0} reactivated", getKey());
}