diff --git a/xds/internal/balancer/ringhash/ringhash.go b/xds/internal/balancer/ringhash/ringhash.go index f64b447654e9..38911cc72a98 100644 --- a/xds/internal/balancer/ringhash/ringhash.go +++ b/xds/internal/balancer/ringhash/ringhash.go @@ -185,7 +185,7 @@ type ringhashBalancer struct { // - an address's weight was updated // // Note that this function doesn't trigger SubConn connecting, so all the new -// SubConn states are IDLE. +// SubConn states are Idle. func (b *ringhashBalancer) updateAddresses(addrs []resolver.Address) bool { var addrsUpdated bool // addrsSet is the set converted from addrs, it's used for quick lookup of @@ -397,7 +397,7 @@ type connectivityStateEvaluator struct { // - If there is at least one subchannel in READY state, report READY. // - If there are 2 or more subchannels in TRANSIENT_FAILURE state, report TRANSIENT_FAILURE. // - If there is at least one subchannel in CONNECTING state, report CONNECTING. -// - If there is at least one subchannel in IDLE state, report IDLE. +// - If there is at least one subchannel in Idle state, report Idle. // - Otherwise, report TRANSIENT_FAILURE. // // Note that if there are 1 connecting, 2 transient failure, the overall state diff --git a/xds/internal/balancer/ringhash/ringhash_test.go b/xds/internal/balancer/ringhash/ringhash_test.go index ba92b55f7b5d..fb85367e4a41 100644 --- a/xds/internal/balancer/ringhash/ringhash_test.go +++ b/xds/internal/balancer/ringhash/ringhash_test.go @@ -85,7 +85,7 @@ func setupTest(t *testing.T, addrs []resolver.Address) (*testutils.TestClientCon t.Fatalf("got unexpected new subconn addrs: %v", cmp.Diff(addr1, want, cmp.AllowUnexported(attributes.Attributes{}))) } sc1 := <-cc.NewSubConnCh - // All the SubConns start in IDLE, and should not Connect(). + // All the SubConns start in Idle, and should not Connect(). select { case <-sc1.(*testutils.TestSubConn).ConnectCh: t.Errorf("unexpected Connect() from SubConn %v", sc1) @@ -93,7 +93,7 @@ func setupTest(t *testing.T, addrs []resolver.Address) (*testutils.TestClientCon } } - // Should also have a picker, with all SubConns in IDLE. + // Should also have a picker, with all SubConns in Idle. p1 := <-cc.NewPickerCh return cc, b, p1 } @@ -177,7 +177,7 @@ func TestThreeSubConnsAffinity(t *testing.T) { b.UpdateSubConnState(sc0, balancer.SubConnState{ConnectivityState: connectivity.TransientFailure}) p2 := <-cc.NewPickerCh // Pick with the same hash should be queued, because the SubConn after the - // first picked is IDLE. + // first picked is Idle. if _, err := p2.Pick(balancer.PickInfo{Ctx: ctxWithHash(testHash)}); err != balancer.ErrNoSubConnAvailable { t.Fatalf("first pick returned err %v, want %v", err, balancer.ErrNoSubConnAvailable) } @@ -202,10 +202,10 @@ func TestThreeSubConnsAffinity(t *testing.T) { } } - // Now, after backoff, the first picked SubConn will turn IDLE. + // Now, after backoff, the first picked SubConn will turn Idle. b.UpdateSubConnState(sc0, balancer.SubConnState{ConnectivityState: connectivity.Idle}) // The picks above should have queued Connect() for the first picked - // SubConn, so this IDLE state change will trigger a Connect(). + // SubConn, so this Idle state change will trigger a Connect(). select { case <-sc0.(*testutils.TestSubConn).ConnectCh: case <-time.After(defaultTestTimeout): @@ -365,7 +365,7 @@ func TestAddrWeightChange(t *testing.T) { } // TestSubConnToConnectWhenOverallTransientFailure covers the situation when the -// overall state is TransientFailure, the SubConns turning IDLE will be +// overall state is TransientFailure, the SubConns turning Idle will be // triggered to Connect(). But not when the overall state is not // TransientFailure. func TestSubConnToConnectWhenOverallTransientFailure(t *testing.T) { @@ -382,7 +382,7 @@ func TestSubConnToConnectWhenOverallTransientFailure(t *testing.T) { b.UpdateSubConnState(it.sc.sc, balancer.SubConnState{ConnectivityState: connectivity.TransientFailure}) } - // The next one turning IDLE should Connect(). + // The next one turning Idle should Connect(). sc0 := ring0.items[0].sc.sc b.UpdateSubConnState(sc0, balancer.SubConnState{ConnectivityState: connectivity.Idle}) select { @@ -391,7 +391,7 @@ func TestSubConnToConnectWhenOverallTransientFailure(t *testing.T) { t.Errorf("timeout waiting for Connect() from SubConn %v", sc0) } - // If this SubConn is ready. Other SubConns turning IDLE will not Connect(). + // If this SubConn is ready. Other SubConns turning Idle will not Connect(). b.UpdateSubConnState(sc0, balancer.SubConnState{ConnectivityState: connectivity.Connecting}) b.UpdateSubConnState(sc0, balancer.SubConnState{ConnectivityState: connectivity.Ready})