1
- description : " Primary with no electionId, then a primary with electionId "
1
+ description : " Primaries with and without electionIds "
2
2
3
3
uri : " mongodb://a/?replicaSet=rs"
4
4
@@ -10,7 +10,7 @@ phases: [
10
10
["a:27017", {
11
11
ok : 1,
12
12
ismaster : true,
13
- hosts : ["a:27017", "b:27017"],
13
+ hosts : ["a:27017", "b:27017", "c:27017" ],
14
14
setName : " rs"
15
15
}]
16
16
],
@@ -26,11 +26,15 @@ phases: [
26
26
type : " Unknown" ,
27
27
setName : ,
28
28
electionId :
29
+ },
30
+ " c:27017 " : {
31
+ type : " Unknown" ,
32
+ setName : ,
33
+ electionId :
29
34
}
30
35
},
31
36
topologyType : " ReplicaSetWithPrimary" ,
32
37
setName : " rs" ,
33
- maxElectionId :
34
38
}
35
39
},
36
40
@@ -40,9 +44,9 @@ phases: [
40
44
["b:27017", {
41
45
ok : 1,
42
46
ismaster : true,
43
- hosts : ["a:27017", "b:27017"],
47
+ hosts : ["a:27017", "b:27017", "c:27017" ],
44
48
setName : " rs" ,
45
- electionId : {"$oid": "000000000000000000000001 "}
49
+ electionId : {"$oid": "000000000000000000000002 "}
46
50
}]
47
51
],
48
52
@@ -56,12 +60,16 @@ phases: [
56
60
" b:27017 " : {
57
61
type : " RSPrimary" ,
58
62
setName : " rs" ,
59
- electionId : {"$oid": "000000000000000000000001"}
63
+ electionId : {"$oid": "000000000000000000000002"}
64
+ },
65
+ " c:27017 " : {
66
+ type : " Unknown" ,
67
+ setName : ,
68
+ electionId :
60
69
}
61
70
},
62
71
topologyType : " ReplicaSetWithPrimary" ,
63
72
setName : " rs" ,
64
- maxElectionId : {"$oid": "000000000000000000000001"}
65
73
}
66
74
},
67
75
@@ -71,7 +79,7 @@ phases: [
71
79
["a:27017", {
72
80
ok : 1,
73
81
ismaster : true,
74
- hosts : ["a:27017", "b:27017"],
82
+ hosts : ["a:27017", "b:27017", "c:27017" ],
75
83
setName : " rs"
76
84
}]
77
85
],
@@ -86,12 +94,51 @@ phases: [
86
94
type : " Unknown" ,
87
95
setName : ,
88
96
electionId :
97
+ },
98
+ " c:27017 " : {
99
+ type : " Unknown" ,
100
+ setName : ,
101
+ electionId :
102
+ }
103
+ },
104
+ topologyType : " ReplicaSetWithPrimary" ,
105
+ setName : " rs" ,
106
+ }
107
+ },
108
+
109
+ # But we remember A's electionId, so when we finally hear from C
110
+ # claiming it is primary, we ignore it due to its outdated electionId
111
+ {
112
+ responses : [
113
+ ["c:27017", {
114
+ ok : 1,
115
+ ismaster : true,
116
+ hosts : ["a:27017", "b:27017", "c:27017"],
117
+ setName : " rs" ,
118
+ electionId : {"$oid": "000000000000000000000001"}
119
+ }]
120
+ ],
121
+ outcome : {
122
+ servers : {
123
+ # Still primary.
124
+ " a:27017 " : {
125
+ type : " RSPrimary" ,
126
+ setName : " rs" ,
127
+ electionId :
128
+ },
129
+ " b:27017 " : {
130
+ type : " Unknown" ,
131
+ setName : ,
132
+ electionId :
133
+ },
134
+ " c:27017 " : {
135
+ type : " Unknown" ,
136
+ setName : ,
137
+ electionId :
89
138
}
90
139
},
91
140
topologyType : " ReplicaSetWithPrimary" ,
92
141
setName : " rs" ,
93
- # But we remember old electionId.
94
- maxElectionId : {"$oid": "000000000000000000000001"}
95
142
}
96
143
}
97
144
]
0 commit comments