forked from mongodb/mongo-python-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PYTHON-2970 Prioritize electionId over setVersion for stale primary c…
…heck (mongodb#845)
- Loading branch information
1 parent
f081297
commit 225d131
Showing
11 changed files
with
481 additions
and
50 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
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
92 changes: 92 additions & 0 deletions
92
test/discovery_and_monitoring/rs/electionId_precedence_setVersion.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,92 @@ | ||
{ | ||
"description": "ElectionId is considered higher precedence than setVersion", | ||
"uri": "mongodb://a/?replicaSet=rs", | ||
"phases": [ | ||
{ | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"ok": 1, | ||
"helloOk": true, | ||
"isWritablePrimary": true, | ||
"hosts": [ | ||
"a:27017", | ||
"b:27017" | ||
], | ||
"setName": "rs", | ||
"setVersion": 1, | ||
"electionId": { | ||
"$oid": "000000000000000000000001" | ||
}, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
], | ||
[ | ||
"b:27017", | ||
{ | ||
"ok": 1, | ||
"helloOk": true, | ||
"isWritablePrimary": true, | ||
"hosts": [ | ||
"a:27017", | ||
"b:27017" | ||
], | ||
"setName": "rs", | ||
"setVersion": 2, | ||
"electionId": { | ||
"$oid": "000000000000000000000001" | ||
}, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
], | ||
[ | ||
"a:27017", | ||
{ | ||
"ok": 1, | ||
"helloOk": true, | ||
"isWritablePrimary": true, | ||
"hosts": [ | ||
"a:27017", | ||
"b:27017" | ||
], | ||
"setName": "rs", | ||
"setVersion": 1, | ||
"electionId": { | ||
"$oid": "000000000000000000000002" | ||
}, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs", | ||
"setVersion": 1, | ||
"electionId": { | ||
"$oid": "000000000000000000000002" | ||
} | ||
}, | ||
"b:27017": { | ||
"type": "Unknown", | ||
"setName": null, | ||
"setVersion": null, | ||
"electionId": null | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs", | ||
"maxSetVersion": 1, | ||
"maxElectionId": { | ||
"$oid": "000000000000000000000002" | ||
} | ||
} | ||
} | ||
] | ||
} |
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
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
149 changes: 149 additions & 0 deletions
149
test/discovery_and_monitoring/rs/set_version_can_rollback.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,149 @@ | ||
{ | ||
"description": "Set version rolls back after new primary with higher election Id", | ||
"uri": "mongodb://a/?replicaSet=rs", | ||
"phases": [ | ||
{ | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"ok": 1, | ||
"hello": true, | ||
"isWritablePrimary": true, | ||
"hosts": [ | ||
"a:27017", | ||
"b:27017" | ||
], | ||
"setName": "rs", | ||
"setVersion": 2, | ||
"electionId": { | ||
"$oid": "000000000000000000000001" | ||
}, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs", | ||
"setVersion": 2, | ||
"electionId": { | ||
"$oid": "000000000000000000000001" | ||
} | ||
}, | ||
"b:27017": { | ||
"type": "Unknown", | ||
"setName": null, | ||
"electionId": null | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs", | ||
"maxSetVersion": 2, | ||
"maxElectionId": { | ||
"$oid": "000000000000000000000001" | ||
} | ||
} | ||
}, | ||
{ | ||
"_comment": "Response from new primary with newer election Id", | ||
"responses": [ | ||
[ | ||
"b:27017", | ||
{ | ||
"ok": 1, | ||
"hello": true, | ||
"isWritablePrimary": true, | ||
"hosts": [ | ||
"a:27017", | ||
"b:27017" | ||
], | ||
"setName": "rs", | ||
"setVersion": 1, | ||
"electionId": { | ||
"$oid": "000000000000000000000002" | ||
}, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "Unknown", | ||
"setName": null, | ||
"electionId": null | ||
}, | ||
"b:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs", | ||
"setVersion": 1, | ||
"electionId": { | ||
"$oid": "000000000000000000000002" | ||
} | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs", | ||
"maxSetVersion": 1, | ||
"maxElectionId": { | ||
"$oid": "000000000000000000000002" | ||
} | ||
} | ||
}, | ||
{ | ||
"_comment": "Response from stale primary", | ||
"responses": [ | ||
[ | ||
"a:27017", | ||
{ | ||
"ok": 1, | ||
"hello": true, | ||
"isWritablePrimary": true, | ||
"hosts": [ | ||
"a:27017", | ||
"b:27017" | ||
], | ||
"setName": "rs", | ||
"setVersion": 2, | ||
"electionId": { | ||
"$oid": "000000000000000000000001" | ||
}, | ||
"minWireVersion": 0, | ||
"maxWireVersion": 6 | ||
} | ||
] | ||
], | ||
"outcome": { | ||
"servers": { | ||
"a:27017": { | ||
"type": "Unknown", | ||
"setName": null, | ||
"electionId": null | ||
}, | ||
"b:27017": { | ||
"type": "RSPrimary", | ||
"setName": "rs", | ||
"setVersion": 1, | ||
"electionId": { | ||
"$oid": "000000000000000000000002" | ||
} | ||
} | ||
}, | ||
"topologyType": "ReplicaSetWithPrimary", | ||
"logicalSessionTimeoutMinutes": null, | ||
"setName": "rs", | ||
"maxSetVersion": 1, | ||
"maxElectionId": { | ||
"$oid": "000000000000000000000002" | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.