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

[EventEngine] Simplify EventEngine::DNSResolver API #33459

Merged
merged 15 commits into from Jun 22, 2023

Conversation

yijiem
Copy link
Member

@yijiem yijiem commented Jun 16, 2023

This change simplifies EventEngine::DNSResolver's API based on the proposal: go/event-engine-dns-resolver-api-changes. Note that this API change + the implementation described in go/event-engine-dns-resolver-implementation has already been tested against our main test suites and are passing them.

@yijiem yijiem added the release notes: yes Indicates if PR needs to be in release notes label Jun 16, 2023
@yijiem yijiem marked this pull request as ready for review June 16, 2023 15:38
@yijiem yijiem requested a review from markdroth as a code owner June 16, 2023 15:38
/// with a status indicating the success or failure of the lookup.
/// Implementations should pass the appropriate statuses to the callback.
/// For example, callbacks might expect to receive DEADLINE_EXCEEDED or
/// When the lookup is complete or cancelled, the \a on_resolve callback
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it's assumed already, but maybe add a note that cancellation is "best effort", in the sense that a lookup will not necessarily fail if it's cancelled (for example a cancellation might race with completion of a successful lookup, in which case the lookup succeeds).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm on the fence on this. Since we don't have an explicit Cancel API now, adding the note here seems a bit out of context. I added the following note to the DNSResolver class declaration:

  /// Note: in the gRPC implementation, cancellation (through destruction) is
  /// "best effort" as if the request has completed during the cancellation, the
  /// result might still be reported through its callback.

PTAL. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I've provided a suggestion for this above.

}
// Even if cancellation fails here, OnResolvedLocked will return early, and
Copy link
Contributor

Choose a reason for hiding this comment

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

since the callback is now always invoked, does this callback still apply?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think it still apply. This part of the code hasn't been changed: https://github.com/grpc/grpc/blob/master/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc#L475

And I think it's still the case that the resolver will not see a complete result after ee_client_channel_resolver is Orphaned.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it , thanks (I was thinking about the DNSResolver cancellation rather than "client channel DNS resolver cancellation"

@yijiem yijiem requested a review from drfloob June 21, 2023 16:56
Copy link
Member

@drfloob drfloob left a comment

Choose a reason for hiding this comment

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

Looks great!

@yijiem yijiem enabled auto-merge (squash) June 22, 2023 18:25
@yijiem yijiem merged commit 6e95ceb into grpc:master Jun 22, 2023
60 of 65 checks passed
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Jun 23, 2023
mario-vimal pushed a commit to mario-vimal/grpc that referenced this pull request Jul 13, 2023
This change simplifies `EventEngine::DNSResolver`'s API based on the
proposal:
[go/event-engine-dns-resolver-api-changes](http://go/event-engine-dns-resolver-api-changes).
Note that this API change + the implementation described in
[go/event-engine-dns-resolver-implementation](http://go/event-engine-dns-resolver-implementation)
has already been tested against our main test suites and are passing
them.


<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloat/improvement imported Specifies if the PR has been imported to the internal repository lang/core per-call-memory/neutral per-channel-memory/neutral release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants