File tree Expand file tree Collapse file tree 3 files changed +85
-4
lines changed Expand file tree Collapse file tree 3 files changed +85
-4
lines changed Original file line number Diff line number Diff line change @@ -364,7 +364,8 @@ def mongos?
364
364
#
365
365
# @since 2.0.0
366
366
def other?
367
- !primary? && !secondary? && !passive? && !arbiter?
367
+ ( !primary? && !secondary? && !passive? && !arbiter? ) ||
368
+ ( hidden? && !replica_set_name . nil? )
368
369
end
369
370
370
371
# Will return true if the server is passive.
Original file line number Diff line number Diff line change @@ -7,12 +7,21 @@ phases: [
7
7
{
8
8
responses : [
9
9
10
+ ["a:27017", {
11
+
12
+ ok : 1,
13
+ ismaster : false,
14
+ secondary : true,
15
+ hidden : true,
16
+ hosts : ["c:27017", "d:27017"],
17
+ setName : " rs"
18
+ }],
10
19
["b:27017", {
11
20
12
21
ok : 1,
13
22
ismaster : false,
14
23
secondary : false,
15
- hosts : ["a :27017", "b :27017"],
24
+ hosts : ["c :27017", "d :27017"],
16
25
setName : " rs"
17
26
}]
18
27
],
@@ -23,14 +32,26 @@ phases: [
23
32
24
33
" a:27017 " : {
25
34
26
- type : " Unknown " ,
27
- setName :
35
+ type : " RSOther " ,
36
+ setName : " rs "
28
37
},
29
38
30
39
" b:27017 " : {
31
40
32
41
type : " RSOther" ,
33
42
setName : " rs"
43
+ },
44
+
45
+ " c:27017 " : {
46
+
47
+ type : " Unknown" ,
48
+ setName :
49
+ },
50
+
51
+ " d:27017 " : {
52
+
53
+ type : " Unknown" ,
54
+ setName :
34
55
}
35
56
},
36
57
Original file line number Diff line number Diff line change
1
+ description : " Primary becomes a secondary with wrong setName"
2
+
3
+ uri : " mongodb://a/?replicaSet=rs"
4
+
5
+ phases : [
6
+
7
+ # Primary is discovered normally.
8
+ {
9
+ responses : [
10
+
11
+ ["a:27017", {
12
+
13
+ ok : 1,
14
+ ismaster : true,
15
+ hosts : ["a:27017"],
16
+ setName : " rs"
17
+ }]
18
+ ],
19
+
20
+ outcome : {
21
+
22
+ servers : {
23
+
24
+ " a:27017 " : {
25
+
26
+ type : " RSPrimary" ,
27
+ setName : " rs"
28
+ }
29
+ },
30
+
31
+ topologyType : " ReplicaSetWithPrimary" ,
32
+ setName : " rs"
33
+ }
34
+ },
35
+
36
+ # Primary changes its setName and becomes secondary.
37
+ # Remove it and change the topologyType.
38
+ {
39
+ responses : [
40
+
41
+ ["a:27017", {
42
+
43
+ ok : 1,
44
+ ismaster : false,
45
+ secondary : true,
46
+ hosts : ["a:27017"],
47
+ setName : " wrong"
48
+ }]
49
+ ],
50
+
51
+ outcome : {
52
+
53
+ servers : {},
54
+
55
+ topologyType : " ReplicaSetNoPrimary" ,
56
+ setName : " rs"
57
+ }
58
+ }
59
+ ]
You can’t perform that action at this time.
0 commit comments