-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only use ServerDescription equality to prevent event emission
SDAM updates should _always_ be processed, an ServerDescription equality should only be used to prevent superfluous event emission NODE-2474
- Loading branch information
Showing
7 changed files
with
516 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
test/spec/server-discovery-and-monitoring/rs/primary_mismatched_me_not_removed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"description": "Primary mismatched me is not removed", | ||
"uri": "mongodb://localhost:27017,localhost:27018/?replicaSet=rs", | ||
"phases": [ | ||
{ | ||
"responses": [ | ||
[ | ||
"localhost:27017", | ||
{ | ||
"ok": 1, | ||
"hosts": [ | ||
"localhost:27017", | ||
"localhost:27018" | ||
], | ||
"ismaster": true, | ||
"setName": "rs", | ||
"primary": "localhost:27017", | ||
"me": "a:27017", | ||
"minWireVersion": 0, | ||
"maxWireVersion": 7 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"localhost:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs" | ||
}, | ||
"localhost:27018": { | ||
"type": "Unknown", | ||
"setName": null | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs" | ||
} | ||
}, | ||
{ | ||
"responses": [ | ||
[ | ||
"localhost:27018", | ||
{ | ||
"ok": 1, | ||
"hosts": [ | ||
"localhost:27017", | ||
"localhost:27018" | ||
], | ||
"ismaster": false, | ||
"secondary": true, | ||
"setName": "rs", | ||
"primary": "localhost:27017", | ||
"me": "localhost:27018", | ||
"minWireVersion": 0, | ||
"maxWireVersion": 7 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"localhost:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs" | ||
}, | ||
"localhost:27018": { | ||
"type": "RSSecondary", | ||
"setName": "rs" | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs" | ||
} | ||
} | ||
] | ||
} |
73 changes: 73 additions & 0 deletions
73
test/spec/server-discovery-and-monitoring/rs/primary_mismatched_me_not_removed.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
description: Primary mismatched me is not removed | ||
uri: mongodb://localhost:27017,localhost:27018/?replicaSet=rs | ||
|
||
phases: [ | ||
{ | ||
responses: [ | ||
["localhost:27017", { | ||
ok: 1, | ||
hosts: [ | ||
"localhost:27017", | ||
"localhost:27018" | ||
], | ||
ismaster: true, | ||
setName: "rs", | ||
primary: "localhost:27017", | ||
# me does not match the primary responder's address, but the server | ||
# is still added because we don't me mismatch check the primary and all | ||
# servers from a primary ismaster are added to the working server set | ||
me: "a:27017", | ||
minWireVersion: 0, | ||
maxWireVersion: 7 | ||
}] | ||
], | ||
outcome: { | ||
servers: { | ||
"localhost:27017": { | ||
type: "RSPrimary", | ||
setName: "rs" | ||
}, | ||
"localhost:27018": { | ||
type: "Unknown", | ||
setName: null | ||
} | ||
}, | ||
topologyType: "ReplicaSetWithPrimary", | ||
logicalSessionTimeoutMinutes: null, | ||
setName: "rs" | ||
} | ||
}, | ||
{ | ||
responses: [ | ||
["localhost:27018", { | ||
ok: 1, | ||
hosts: [ | ||
"localhost:27017", | ||
"localhost:27018" | ||
], | ||
ismaster: false, | ||
secondary: true, | ||
setName: "rs", | ||
primary: "localhost:27017", | ||
me: "localhost:27018", | ||
minWireVersion: 0, | ||
maxWireVersion: 7 | ||
}] | ||
], | ||
outcome: { | ||
servers: { | ||
"localhost:27017": { | ||
type: "RSPrimary", | ||
setName: "rs" | ||
}, | ||
"localhost:27018": { | ||
type: "RSSecondary", | ||
setName: "rs" | ||
} | ||
}, | ||
topologyType: "ReplicaSetWithPrimary", | ||
logicalSessionTimeoutMinutes: null, | ||
setName: "rs" | ||
} | ||
} | ||
] |
140 changes: 140 additions & 0 deletions
140
test/spec/server-discovery-and-monitoring/rs/repeated.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{ | ||
"description": "Repeated ismaster response must be processed", | ||
"uri": "mongodb://a,b/?replicaSet=rs", | ||
"phases": [ | ||
{ | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"ok": 1, | ||
"ismaster": false, | ||
"secondary": true, | ||
"hidden": true, | ||
"hosts": [ | ||
"a:27017", | ||
"c:27017" | ||
], | ||
"setName": "rs", | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "RSOther", | ||
"setName": "rs" | ||
}, | ||
"b:27017": { | ||
"type": "Unknown" | ||
}, | ||
"c:27017": { | ||
"type": "Unknown" | ||
} | ||
}, | ||
"topologyType": "ReplicaSetNoPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs" | ||
} | ||
}, | ||
{ | ||
"responses": [ | ||
[ | ||
"c:27017", | ||
{ | ||
"ok": 1, | ||
"ismaster": true, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "RSOther", | ||
"setName": "rs" | ||
}, | ||
"b:27017": { | ||
"type": "Unknown" | ||
} | ||
}, | ||
"topologyType": "ReplicaSetNoPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs" | ||
} | ||
}, | ||
{ | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"ok": 1, | ||
"ismaster": false, | ||
"secondary": true, | ||
"hidden": true, | ||
"hosts": [ | ||
"a:27017", | ||
"c:27017" | ||
], | ||
"setName": "rs", | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "RSOther", | ||
"setName": "rs" | ||
}, | ||
"b:27017": { | ||
"type": "Unknown" | ||
}, | ||
"c:27017": { | ||
"type": "Unknown" | ||
} | ||
}, | ||
"topologyType": "ReplicaSetNoPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs" | ||
} | ||
}, | ||
{ | ||
"responses": [ | ||
[ | ||
"c:27017", | ||
{ | ||
"ok": 1, | ||
"ismaster": true, | ||
"hosts": [ | ||
"a:27017", | ||
"c:27017" | ||
], | ||
"setName": "rs", | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "RSOther", | ||
"setName": "rs" | ||
}, | ||
"c:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs" | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.