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

grpc: report connectivity state changes on the ClientConn for Subscribers #6437

Merged
merged 14 commits into from
Aug 8, 2023

Conversation

my4-dev
Copy link
Contributor

@my4-dev my4-dev commented Jul 8, 2023

This PR adds a logic to report connectivity state changes on the ClientConn for Subscribers.

Please refer to #6036 (comment) in #6036 . Original issue is #5818.

RELEASE NOTES: none

@easwars easwars self-requested a review July 11, 2023 17:36
@easwars easwars self-assigned this Jul 11, 2023
@easwars easwars added this to the 1.58 Release milestone Jul 14, 2023
clientconn.go Outdated Show resolved Hide resolved
clientconn.go Outdated Show resolved Hide resolved
clientconn.go Outdated Show resolved Hide resolved
internal/internal.go Outdated Show resolved Hide resolved
clientconn_test.go Outdated Show resolved Hide resolved
@my4-dev
Copy link
Contributor Author

my4-dev commented Jul 24, 2023

@easwars : Thank you for reviewing! I've fixed some implementations according to your comments.

clientconn.go Outdated Show resolved Hide resolved
clientconn.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Show resolved Hide resolved
@easwars easwars changed the title Report connectivity state changes on the ClientConn for Subscribers grpc: report connectivity state changes on the ClientConn for Subscribers Jul 26, 2023
@easwars easwars added the Type: Internal Cleanup Refactors, etc label Jul 26, 2023
clientconn.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
clientconn.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
test/connectivity_state_updates_test.go Outdated Show resolved Hide resolved
Co-authored-by: Easwar Swaminathan <easwars@google.com>
@easwars
Copy link
Contributor

easwars commented Aug 1, 2023

@dfawley for second set of eyes.

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: backend.Address}}})
awaitState(ctx, t, cc, connectivity.Ready)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it will be flaky to me, just like the previous instance of the same thing we found.

However, idleness is a great test of the pubsub delivering transitions reliably that the other API could miss. So I think we can just delete this awaitState and everything will be good.

if gotState != wantState {
t.Errorf("Received unexpected state: %q; want: %q", gotState, wantState)
}
case <-time.After(defaultTestTimeout):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: initialize the context at the start of the test and use <-ctx.Done() here instead.

Comment on lines 109 to 111
if t.Failed() {
t.FailNow()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this can be deleted since there is no code after it.

@my4-dev
Copy link
Contributor Author

my4-dev commented Aug 6, 2023

Thanks @dfawley !
I've applied your comments!

@dfawley dfawley merged commit 2059c6e into grpc:master Aug 8, 2023
1 check passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants