1description: "Replica set discovery"
2
3uri: "mongodb://a/?replicaSet=rs"
4
5phases: [
6
7 # At first, a, b, and c are secondaries.
8 {
9 responses: [
10
11 ["a:27017", {
12
13 ok: 1,
14 helloOk: true,
15 isWritablePrimary: false,
16 secondary: true,
17 setName: "rs",
18 hosts: ["a:27017", "b:27017", "c:27017"],
19 minWireVersion: 0,
20 maxWireVersion: 6
21 }]
22 ],
23
24 outcome: {
25
26 servers: {
27
28 "a:27017": {
29
30 type: "RSSecondary",
31 setName: "rs"
32 },
33
34 "b:27017": {
35
36 type: "Unknown",
37 setName:
38 },
39
40 "c:27017": {
41
42 type: "Unknown",
43 setName:
44 }
45 },
46 topologyType: "ReplicaSetNoPrimary",
47 logicalSessionTimeoutMinutes: null,
48 setName: "rs"
49 }
50 },
51
52 # Admin removes a, adds a high-priority member d which becomes primary.
53 {
54 responses: [
55
56 ["b:27017", {
57
58 ok: 1,
59 helloOk: true,
60 isWritablePrimary: false,
61 secondary: true,
62 setName: "rs",
63 primary: "d:27017",
64 hosts: ["b:27017", "c:27017", "d:27017"],
65 minWireVersion: 0,
66 maxWireVersion: 6
67 }]
68 ],
69
70 outcome: {
71
72 servers: {
73
74 "a:27017": {
75
76 type: "RSSecondary",
77 setName: "rs"
78 },
79
80 "b:27017": {
81
82 type: "RSSecondary",
83 setName: "rs"
84 },
85
86 "c:27017": {
87
88 type: "Unknown",
89 setName:
90 },
91
92 "d:27017": {
93
94 type: "PossiblePrimary",
95 setName:
96 }
97 },
98 topologyType: "ReplicaSetNoPrimary",
99 logicalSessionTimeoutMinutes: null,
100 setName: "rs"
101 }
102 },
103
104 # Primary responds.
105 {
106 responses: [
107
108 ["d:27017", {
109
110 ok: 1,
111 helloOk: true,
112 isWritablePrimary: true,
113 setName: "rs",
114 hosts: ["b:27017", "c:27017", "d:27017", "e:27017"],
115 minWireVersion: 0,
116 maxWireVersion: 6
117 }]
118 ],
119
120 outcome: {
121
122 # e is new.
123 servers: {
124
125 "b:27017": {
126
127 type: "RSSecondary",
128 setName: "rs"
129 },
130
131 "c:27017": {
132
133 type: "Unknown",
134 setName:
135 },
136
137 "d:27017": {
138
139 type: "RSPrimary",
140 setName: "rs"
141 },
142
143 "e:27017": {
144
145 type: "Unknown",
146 setName:
147 }
148 },
149 topologyType: "ReplicaSetWithPrimary",
150 logicalSessionTimeoutMinutes: null,
151 setName: "rs"
152 }
153 },
154
155 # Stale response from c.
156 {
157 responses: [
158
159 ["c:27017", {
160
161 ok: 1,
162 helloOk: true,
163 isWritablePrimary: false,
164 secondary: true,
165 setName: "rs",
166 hosts: ["a:27017", "b:27017", "c:27017"],
167 minWireVersion: 0,
168 maxWireVersion: 6
169 }]
170 ],
171
172 outcome: {
173
174 # We don't add a back.
175 # We don't remove e.
176 servers: {
177
178 "b:27017": {
179
180 type: "RSSecondary",
181 setName: "rs"
182 },
183
184 "c:27017": {
185
186 type: "RSSecondary",
187 setName: "rs"
188 },
189
190 "d:27017": {
191
192 type: "RSPrimary",
193 setName: "rs"
194 },
195
196 "e:27017": {
197
198 type: "Unknown",
199 setName:
200 }
201 },
202 topologyType: "ReplicaSetWithPrimary",
203 logicalSessionTimeoutMinutes: null,
204 setName: "rs"
205 }
206 }
207]
View as plain text