xds: ringhash policy in TRANSIENT_FAILURE should not attempt connecting when already in connecting (#9535)

This commit is contained in:
yifeizhuang 2022-09-09 17:27:22 -07:00 committed by GitHub
parent 84d0b0474f
commit 42e68149a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -248,7 +248,7 @@ final class RingHashLoadBalancer extends LoadBalancer {
overallState = READY;
} else if (numTransientFailure >= 2) {
overallState = TRANSIENT_FAILURE;
startConnectionAttempt = true;
startConnectionAttempt = (numConnecting == 0);
} else if (numConnecting > 0) {
overallState = CONNECTING;
} else if (numTransientFailure == 1 && subchannels.size() > 1) {

View File

@ -310,7 +310,7 @@ public class RingHashLoadBalancerTest {
ConnectivityStateInfo.forNonError(CONNECTING));
inOrder.verify(helper)
.updateBalancingState(eq(TRANSIENT_FAILURE), any(SubchannelPicker.class));
verifyConnection(1);
verifyConnection(0);
// three in TRANSIENT_FAILURE, one in CONNECTING
deliverSubchannelState(
@ -320,7 +320,7 @@ public class RingHashLoadBalancerTest {
inOrder.verify(helper).refreshNameResolution();
inOrder.verify(helper)
.updateBalancingState(eq(TRANSIENT_FAILURE), any(SubchannelPicker.class));
verifyConnection(1);
verifyConnection(0);
// three in TRANSIENT_FAILURE, one in READY
deliverSubchannelState(
@ -884,7 +884,7 @@ public class RingHashLoadBalancerTest {
deliverSubchannelState(subchannels.get(Collections.singletonList(servers.get(1))),
ConnectivityStateInfo.forNonError(CONNECTING));
verify(helper, times(2)).updateBalancingState(eq(TRANSIENT_FAILURE), pickerCaptor.capture());
verifyConnection(3);
verifyConnection(2);
// Picking subchannel triggers connection.
PickSubchannelArgs args = new PickSubchannelArgsImpl(