Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion xds/src/main/java/io/grpc/xds/RingHashLoadBalancer.java
Expand Up @@ -248,7 +248,7 @@ private void updateBalancingState() {
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) {
Expand Down
6 changes: 3 additions & 3 deletions xds/src/test/java/io/grpc/xds/RingHashLoadBalancerTest.java
Expand Up @@ -310,7 +310,7 @@ public void aggregateSubchannelStates_twoOrMoreSubchannelsInTransientFailure() {
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(
Expand All @@ -320,7 +320,7 @@ public void aggregateSubchannelStates_twoOrMoreSubchannelsInTransientFailure() {
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(
Expand Down Expand Up @@ -884,7 +884,7 @@ public void thirdSubchannelConnecting() {
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(
Expand Down