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

GODRIVER-1778 Reject HeartbeatFrequencyMS of less than 500ms #1828

Merged
merged 10 commits into from
Oct 2, 2024

Conversation

joyjwang
Copy link
Contributor

@joyjwang joyjwang commented Sep 24, 2024

GODRIVER-1778

Summary

The Server Monitoring spec explicitly forbids setting a heartbeatFrequencyMS of less than 500ms:

For both multi- and single-threaded drivers, the driver MUST NOT permit users to configure it less than minHeartbeatFrequencyMS (500ms).

Background & Motivation

@joyjwang joyjwang changed the title add validation for heartbeat GODRIVER-1778 Reject HeartbeatFrequencyMS of less than 500ms Sep 24, 2024
@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Sep 24, 2024
Copy link
Contributor

API Change Report

No changes found!

@joyjwang joyjwang marked this pull request as ready for review September 25, 2024 19:41
@joyjwang
Copy link
Contributor Author

Possible Follow-Ups:

  • “For multi-threaded and asynchronous drivers it MUST default to 10 seconds and MUST be configurable. For single-threaded drivers it MUST default to 60 seconds and MUST be configurable.” according to spec Should we change defaults?
  • Saw in GODRIVER-104 we chose not to change heartbeatIntervalMS, is there a reason we didn't standardize?

mongo/options/clientoptions.go Outdated Show resolved Hide resolved
mongo/client_test.go Outdated Show resolved Hide resolved
mongo/options/clientoptions_test.go Show resolved Hide resolved
mongo/options/clientoptions_test.go Outdated Show resolved Hide resolved
@@ -45,7 +45,7 @@ const (
)

var (
defaultHeartbeatInterval = 50 * time.Millisecond
defaultHeartbeatInterval = 500 * time.Millisecond
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the history of the original 50ms default? Does the 500ms requirement conflict with legacy test specifications? Or was this value chosen arbitrarily?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it came from this commit to implement streaming heartbeat protocol, not sure how the value was chosen though.

@prestonvasquez
Copy link
Collaborator

prestonvasquez commented Sep 27, 2024

We should document the minimum value on the options setter function.

prestonvasquez
prestonvasquez previously approved these changes Oct 1, 2024
matthewdale
matthewdale previously approved these changes Oct 1, 2024
Copy link
Collaborator

@matthewdale matthewdale 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, with a few suggestions! 👍

mongo/options/clientoptions_test.go Outdated Show resolved Hide resolved
mongo/options/clientoptions_test.go Show resolved Hide resolved
@joyjwang joyjwang merged commit e22ca8f into mongodb:master Oct 2, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants