[CDRIVER-3256] SDAM "changed" events emitted even if descriptions don't change Created: 24/Jul/19  Updated: 28/Oct/23  Resolved: 12/Feb/20

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.17.0-beta, 1.17.0

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File curr.json     File example-client.c     File prev.json    
Issue Links:
Depends
Related
is related to CDRIVER-3527 Store server_description_t hostname f... Backlog

 Description   

The SDAM monitoring spec states that the ServerDescriptionChangedEvent must be emitted...

When the old server description is not equal to the new server description

And similarly, the TopologyDescriptionChangedEvent must be emitted...

When the old topology description is not equal to the new topology description.

Though, it does not appear that we check if the previous and new server descriptions differ when generating the events here

Note the comparison for ServerDescription equality is described here.

I've validated that we incorrectly send events with the attached modification to example-client.c, which prints out two SDAM ServerDescriptionChanged events with equal isMaster replies, and example output in curr/prev.json of two equivalent isMaster replies that were printed.



 Comments   
Comment by Githook User [ 12/Feb/20 ]

Author:

{'username': 'kevinAlbs', 'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com'}

Message: CDRIVER-3256 omit duplicate SDAM changed events
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/7beadb0e4d8ac2e5d761b154f58b19e6d1c68cc9

Comment by Githook User [ 14/Jan/20 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-2970 resync SDAM tests

Excluding one SDAM monitoring test, which is waiting on CDRIVER-3256
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/259b6148bd1087705aae01e3609dfcdb69253cbe

Comment by Kevin Albertson [ 08/Jan/20 ]

Note, libmongoc does not appear to have an implementation of the Server Description Equality matching (https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#server-description-equality), which makes me think we're also unnecessarily processing equal isMaster replies from non-single topologies. The SDAM spec says that when we're processing an isMaster reply for a non-single topology:

If the new server description is equal to the previous server description as defined in Server Description Equality, stop the processing.

SPEC-1475 adds a spec test that for a single topology, repeated equal isMaster replies do not produce repeated server_description_changed or topology_description_changed events. Once this ticket is complete, sync that test as well (standalone_suppress_equal_description_changes.json). Perhaps also create a spec test for non-single topologies, since I don't believe standalone_suppress_equal_description_changes would have caught the issue that we were still processing equal isMaster on non-single topologies.

Comment by Githook User [ 25/Jul/19 ]

Author:

{'name': 'Kaitlin Mahar', 'email': 'kaitlinmahar@gmail.com', 'username': 'kmahar'}

Message: add workaround for workaround for CDRIVER-3256
Branch: SWIFT-374/pooled-mode-and-sessions
https://github.com/mongodb/mongo-swift-driver/commit/123746dba8543d6755c1ebf74f518cba1386cfe4

Comment by Githook User [ 24/Jul/19 ]

Author:

{'name': 'Kaitlin Mahar', 'email': 'kaitlinmahar@gmail.com', 'username': 'kmahar'}

Message: add workaround for workaround for CDRIVER-3256
Branch: SWIFT-374/pooled-mode-and-sessions
https://github.com/mongodb/mongo-swift-driver/commit/62cfb2734494c96f3537fdd4c859c1dd9bbbd76a

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