-
Type:
Improvement
-
Resolution: Works as Designed
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
The following is the rules for topologyVersion comparison
- If the response topologyVersion is unset or the ServerDescription's topologyVersion is null, the client MUST assume the response is more recent.
- If the response's topologyVersion.processId is not equal to the ServerDescription's, the client MUST assume the response is more recent.
- If the response's topologyVersion.processId is equal to the ServerDescription's, the client MUST use the counter field to determine which topologyVersion is more recent.
Point 1 is not correctly checked by our driver:
const topologyVersionsEqual = this.topologyVersion === other?.topologyVersion || compareTopologyVersion(this.topologyVersion, other?.topologyVersion) === 0;
Here, if both topologyVersions are null we'll true for equality when actually other should always be greater. Fixing this causes a spec test to fail:
Monitoring a direct connection - suppress update events for equal server descriptions
Extra events are emitted because now the serverDescription changes with nullish topologyVersions are considered different