-
Type: Task
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: libmongoc
-
None
mongoc_server_description_t stores the server description fields "me", "hosts", "passives", "arbiters", "current_primary", and "connection_address" without modification. But the SDAM spec says:
The same as with seeds provided in the initial configuration, all hostnames in the ismaster response's "me", "hosts", "passives", and "arbiters" entries MUST be lower-cased.
Until addressing the bug CDRIVER-3256, this makes no functional difference, since it appears on usage of those fields they are always compared case insensitively (with strcasecmp). However, CDRIVER-3256 requires implementing an equality comparison function of two server descriptions. Though it is simple to case insensitively compare "me", "connection_address", and "current_primary", comparing the lists "hosts", "passives", and "arbiters" is trickier. They are currently stored as bson_t arrays. To compare them accurately, we'd need to do a set compare (to account for duplicates and different ordering) and after lowercasing.
The consequence of considering two "hosts" lists different if one has a duplicate or different order of entries is not very impactful. For example, if an ismaster reply on a single server reported the same information, but with the "hosts" list in a different order, libmongoc would incorrectly emit a server changed event and topology changed event. That means another, much rarer surfacing of CDRIVER-3256.
We should probably be parsing hosts from the ismaster reply, lowercasing them, and storing the host lists in a mongoc_set_t. Note, mongoc_topology_description_t already stores the server list in a mongoc_set_t.
- is related to
-
DRIVERS-944 SDAM spec and monitoring spec tests are inconsistent in topology description definition
- Backlog
- related to
-
CDRIVER-3256 SDAM "changed" events emitted even if descriptions don't change
- Closed