Skip to content

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 review-priority-low Low Priority PR for Review: within 3 business days 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?


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

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
Member

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! 👍

@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

review-priority-low Low Priority PR for Review: within 3 business days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants