[CDRIVER-751] Discovered servers not checked until next scan Created: 16/Jul/15  Updated: 12/Aug/15  Resolved: 10/Aug/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.2.0
Fix Version/s: 1.2-beta0

Type: Bug Priority: Critical - P2
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

Backwards Compatibility: Fully Compatible

 Description   

Bug in unreleased implementation of Server Discovery And Monitoring spec.

The spec requires a single-threaded scan to keep going until all nodes have been checked, including nodes discovered during the scan. But it seems that _mongoc_topology_do_blocking_scan quits once all servers known at the start of the scan are checked. Discovered nodes are added to the topology description, but not checked until the next scan.

I think mongoc_topology_scanner_add must call mongoc_async_cmd_new to schedule a check during the current scan, instead of deferring it to the next scan.

Impact: an initial server selection may take longer than necessary, or may fail when it could have succeeded. E.g., if the seed list contains only a secondary, the primary is discovered from the secondary's host list, but not checked until the next scan, 500 ms (minHeartbeatFrequencyMS) later.

If the new "serverSelectionTryOnce" is enabled in single-threaded mode, the selection actually fails in this scenario when it must succeed.



 Comments   
Comment by Githook User [ 10/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-751 don't recheck any host in same scan

Fix test_topology_scanner_oscillate case.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/ffc8a01ebefe14960e3176eac8816ca7500c4a08

Comment by Githook User [ 10/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-751 check discovered servers in same scan

Bug in unreleased Server Discovery And Monitoring implementation.

The spec requires a single-threaded scan to keep going until all nodes
have been checked, including nodes discovered during the scan. But
_mongoc_topology_do_blocking_scan quit once all servers known at the
start of the scan were checked. Discovered nodes are added to the
topology description, but not checked until the next scan.

With this patch, a block scan keeps going until all servers are checked,
including those discovered during this scan.

TODO: test_topology_scanner_oscillate currently fails, revealing that
in a pathological scenario the driver now errs on the other side, and
scans forever.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/ddd99c22f9265a4748aa5aaf4850c16b8ea05859

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