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

resolver/dns: Add SetMinResolutionInterval Option #6962

Merged

Conversation

HomayoonAlimohammadi
Copy link
Contributor

@HomayoonAlimohammadi HomayoonAlimohammadi commented Feb 4, 2024

In this merge request I tried to make SetMinResolutionInterval which is currently a constant duration variable by providing options. SetMinResolutionInterval sets the default minimum interval at which DNS re-resolutions are allowed. This helps to prevent excessive re-resolution.

RELEASE NOTES:

  • resolver/dns: Add SetMinResolutionInterval to set the minimum interval at which DNS re-resolutions may occur.

Copy link

linux-foundation-easycla bot commented Feb 4, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Merging #6962 (06182cb) into master (c31cec3) will decrease coverage by 0.10%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6962      +/-   ##
==========================================
- Coverage   81.28%   81.19%   -0.10%     
==========================================
  Files         345      345              
  Lines       33925    33927       +2     
==========================================
- Hits        27577    27546      -31     
- Misses       5184     5208      +24     
- Partials     1164     1173       +9     
Files Coverage Δ
internal/resolver/dns/dns_resolver.go 89.31% <100.00%> (ø)
resolver/dns/dns_resolver.go 66.66% <100.00%> (+16.66%) ⬆️

... and 23 files with indirect coverage changes

@HomayoonAlimohammadi HomayoonAlimohammadi force-pushed the add-min-dns-resolution-rate-option branch from 1a0eb21 to ffde661 Compare February 4, 2024 12:31
@HomayoonAlimohammadi
Copy link
Contributor Author

@dfawley I would really appreciate it if you would take a look at this merge request.

@HomayoonAlimohammadi
Copy link
Contributor Author

I'm not able to add any labels or milestones. Would you please help me around?

@HomayoonAlimohammadi
Copy link
Contributor Author

I will really appreciate it if you would take a look at this merge request: @dfawley @ginayeh

@dfawley dfawley added the Type: Feature New features or improvements in behavior label Feb 15, 2024
@dfawley dfawley added this to the 1.63 Release milestone Feb 15, 2024
@dfawley
Copy link
Member

dfawley commented Feb 15, 2024

Hi, I think a change like this is OK but we'd want it to be a global configuration knob like we are doing with DNS resolution timeouts in #6917. Please let us know if you have any questions about that approach.

Copy link

This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.

@HomayoonAlimohammadi
Copy link
Contributor Author

Hi, I think a change like this is OK but we'd want it to be a global configuration knob like we are doing with DNS resolution timeouts in #6917. Please let us know if you have any questions about that approach.

Hello again, sorry for the later reply. I've changed the structure to the best of my knowledge according to the pull request you've mentioned. Please let me know if there's any problem. @dfawley

@HomayoonAlimohammadi
Copy link
Contributor Author

Hi again, is there anything I can do further for this PR or is there still anything wrong with it? Thanks a lot @dfawley

@zasweq zasweq modified the milestones: 1.63 Release, 1.64 Release Mar 20, 2024
@HomayoonAlimohammadi HomayoonAlimohammadi force-pushed the add-min-dns-resolution-rate-option branch from 32b53fd to 4e95397 Compare April 2, 2024 14:51
@HomayoonAlimohammadi
Copy link
Contributor Author

I resolved the conflicts and it's ready to go! Let me know if I need to change anything.

@dfawley
Copy link
Member

dfawley commented Apr 3, 2024

Sorry for the delay.. I will review it this week for sure.

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

LGTM, just a few minor comments. Thank you for the PR!

internal/resolver/dns/dns_resolver.go Show resolved Hide resolved
Comment on lines 58 to 60
//
// Using this option overwrites the default [MinResolutionRate] specified
// in the internal dns resolver package.
Copy link
Member

Choose a reason for hiding this comment

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

This is an implementation detail and should be kept out of godoc comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! Done.

Comment on lines 73 to 75
origMinResRate := dns.MinResolutionRate
dns.MinResolutionRate = d
t.Cleanup(func() { dns.MinResolutionRate = origMinResRate })
Copy link
Member

Choose a reason for hiding this comment

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

Could this call into the exported DNS library's SetMinResolution... instead, to get test coverage of the setter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right, thanks for pointing it out! Done.

@HomayoonAlimohammadi HomayoonAlimohammadi force-pushed the add-min-dns-resolution-rate-option branch from 4a02e12 to 2398289 Compare April 5, 2024 16:38
@HomayoonAlimohammadi HomayoonAlimohammadi removed their assignment Apr 5, 2024
@HomayoonAlimohammadi
Copy link
Contributor Author

I struggle to understand why the vet-proto fails. Would you please help me out?

@dfawley
Copy link
Member

dfawley commented Apr 5, 2024

I struggle to understand why the vet-proto fails. Would you please help me out?

This check is optional, and the failure is caused by an upstream protobuf definition change. Please ignore it.

@HomayoonAlimohammadi
Copy link
Contributor Author

I struggle to understand why the vet-proto fails. Would you please help me out?

This check is optional, and the failure is caused by an upstream protobuf definition change. Please ignore it.

Thanks a lot. I think all the comments are resolved. Let me know if I need to change anything.

Comment on lines 56 to 58
// SetMinResolutionRate sets the default minimum rate at which DNS re-resolutions are
// allowed. This helps to prevent excessive re-resolution.
func SetMinResolutionRate(d time.Duration) {
Copy link
Member

Choose a reason for hiding this comment

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

I swear I wrote this comment in the last pass, but it's gone now. :) Sorry!

Please rename this to SetMinResolutionInterval (and change the global variable name to match). A "rate" is the opposite of what this is. (This actually determines the maximum rate, or the minimum interval.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're totally right, thanks for pointing it out!
I think I managed to change all of them. I triple checked to make sure but let me know if there's still anything wrong.

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@dfawley dfawley requested a review from arvindbr8 April 5, 2024 17:32
@arvindbr8 arvindbr8 changed the title Add MinDNSResolutionRate Option resolver/dns: Add SetMinResolutionInterval Option Apr 5, 2024
Copy link
Member

@arvindbr8 arvindbr8 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the PR @HomayoonAlimohammadi.

Slightly updated the PR title/description to match the latest diff.

@arvindbr8 arvindbr8 merged commit 8444ae0 into grpc:master Apr 5, 2024
13 of 14 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants