[CDRIVER-739] minHeartbeatFrequencyMS can be overridden Created: 09/Jul/15  Updated: 03/May/17  Resolved: 11/Oct/16

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.2.0
Fix Version/s: TBD

Type: Bug Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-438 Implement Server Discovery And Monito... Closed

 Description   

The Server Discovery And Monitoring Spec says a driver must wait at least minHeartbeatFrequencyMS (500ms, not configurable) between ismaster calls no matter what:

https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#minheartbeatfrequencyms

If the C Driver is configured with a heartbeatFrequencyMS shorter than that, it can call ismaster more frequently.

I think this MIN should be a MAX:

https://github.com/mongodb/mongo-c-driver/blob/5972a47c1c8ca7bf17056492573579baeb2c9c40/src/mongoc/mongoc-topology.c#L629-629



 Comments   
Comment by A. Jesse Jiryu Davis [ 11/Oct/16 ]

It's correct, the formula first calculates the time left until heartbeatFrequencyMS expires:

timeout = heartbeat_msec - ((now - last_scan) / 1000);

Then it calculates the time left until minHeartbeatFrequencyMS:

force_timeout = MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS - ((now - last_scan) / 1000);

Then it takes the minimum of the two. Even if threads are requesting scans very frequently, force_timeout is calculated to last until minHeartbeatFrequencyMS expires.

Generated at Wed Feb 07 21:10:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.