mongo 2.11.1 → 2.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +2 -1
  3. data.tar.gz.sig +0 -0
  4. data/Rakefile +24 -0
  5. data/lib/mongo/auth.rb +30 -10
  6. data/lib/mongo/auth/cr.rb +1 -0
  7. data/lib/mongo/auth/cr/conversation.rb +13 -13
  8. data/lib/mongo/auth/ldap.rb +2 -1
  9. data/lib/mongo/auth/ldap/conversation.rb +9 -12
  10. data/lib/mongo/auth/scram.rb +1 -0
  11. data/lib/mongo/auth/scram/conversation.rb +36 -27
  12. data/lib/mongo/auth/x509.rb +2 -1
  13. data/lib/mongo/auth/x509/conversation.rb +9 -9
  14. data/lib/mongo/client.rb +17 -6
  15. data/lib/mongo/cluster.rb +65 -49
  16. data/lib/mongo/cluster/sdam_flow.rb +87 -3
  17. data/lib/mongo/database.rb +1 -1
  18. data/lib/mongo/server.rb +13 -6
  19. data/lib/mongo/server/connection.rb +12 -4
  20. data/lib/mongo/server/connection_base.rb +7 -4
  21. data/lib/mongo/server/description.rb +34 -21
  22. data/lib/mongo/session.rb +10 -10
  23. data/lib/mongo/version.rb +1 -1
  24. data/spec/README.md +13 -0
  25. data/spec/integration/auth_spec.rb +27 -8
  26. data/spec/integration/client_construction_spec.rb +14 -0
  27. data/spec/mongo/auth/ldap/conversation_spec.rb +1 -1
  28. data/spec/mongo/auth/scram/conversation_spec.rb +23 -14
  29. data/spec/mongo/auth/x509/conversation_spec.rb +1 -1
  30. data/spec/mongo/client_construction_spec.rb +1 -21
  31. data/spec/mongo/cluster_spec.rb +38 -0
  32. data/spec/mongo/collection/view/map_reduce_spec.rb +1 -1
  33. data/spec/mongo/server/connection_spec.rb +67 -0
  34. data/spec/runners/sdam/verifier.rb +6 -3
  35. data/spec/spec_tests/data/sdam/rs/primary_address_change.yml +29 -0
  36. data/spec/spec_tests/data/sdam/rs/primary_mismatched_me.yml +27 -23
  37. data/spec/spec_tests/data/sdam/rs/primary_to_no_primary_mismatched_me.yml +56 -79
  38. data/spec/spec_tests/data/sdam/sharded/primary_address_change.yml +21 -0
  39. data/spec/spec_tests/data/sdam/sharded/primary_mismatched_me.yml +22 -0
  40. data/spec/spec_tests/data/sdam/single/primary_address_change.yml +24 -0
  41. data/spec/spec_tests/data/sdam/single/primary_mismatched_me.yml +25 -0
  42. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_me_mismatch.yml +159 -0
  43. data/spec/spec_tests/data/sdam_monitoring/{replica_set_other_seed.yml → replica_set_with_primary_change.yml} +97 -101
  44. data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_removal.yml +22 -18
  45. data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +90 -0
  46. data/spec/support/cluster_config.rb +36 -0
  47. data/spec/support/constraints.rb +18 -18
  48. data/spec/support/server_discovery_and_monitoring.rb +2 -0
  49. metadata +18 -4
  50. metadata.gz.sig +0 -0
@@ -0,0 +1,24 @@
1
+ description: RS Primary whose address differs from client address but no me mismatch
2
+ uri: mongodb://localhost:27017/?connect=direct
3
+ phases:
4
+ -
5
+ responses:
6
+ -
7
+ - localhost:27017
8
+ - hosts:
9
+ - a:27017
10
+ - b:27017
11
+ ismaster: true
12
+ ok: 1
13
+ setName: rs
14
+ minWireVersion: 0
15
+ maxWireVersion: 6
16
+ outcome:
17
+ # In Single topology the server type is preserved. In this case the
18
+ # connection is to a RS primary.
19
+ servers:
20
+ localhost:27017:
21
+ type: RSPrimary
22
+ setName: rs
23
+ topologyType: Single
24
+ logicalSessionTimeoutMinutes:
@@ -0,0 +1,25 @@
1
+ description: RS Primary w/mismatched me
2
+ uri: mongodb://localhost:27017/?connect=direct
3
+ phases:
4
+ -
5
+ responses:
6
+ -
7
+ - localhost:27017
8
+ - me: a:27017
9
+ hosts:
10
+ - a:27017
11
+ - b:27017
12
+ ismaster: true
13
+ ok: 1
14
+ setName: rs
15
+ minWireVersion: 0
16
+ maxWireVersion: 6
17
+ outcome:
18
+ # In Single topology the server type is preserved. In this case the
19
+ # connection is to a RS primary.
20
+ servers:
21
+ localhost:27017:
22
+ type: RSPrimary
23
+ setName: rs
24
+ topologyType: Single
25
+ logicalSessionTimeoutMinutes:
@@ -0,0 +1,159 @@
1
+ description: "Monitoring a topology that is a replica set with a me mismatch in first response"
2
+ uri: "mongodb://a,b/"
3
+ phases:
4
+ -
5
+ responses: []
6
+ outcome:
7
+ events:
8
+ -
9
+ topology_opening_event:
10
+ topologyId: "42"
11
+ -
12
+ topology_description_changed_event:
13
+ topologyId: "42"
14
+ previousDescription:
15
+ topologyType: "Unknown"
16
+ servers: []
17
+ newDescription:
18
+ topologyType: "Unknown"
19
+ servers:
20
+ -
21
+ address: "a:27017"
22
+ arbiters: []
23
+ hosts: []
24
+ passives: []
25
+ type: "Unknown"
26
+ -
27
+ address: "b:27017"
28
+ arbiters: []
29
+ hosts: []
30
+ passives: []
31
+ type: "Unknown"
32
+ -
33
+ server_opening_event:
34
+ topologyId: "42"
35
+ address: "a:27017"
36
+ -
37
+ server_opening_event:
38
+ topologyId: "42"
39
+ address: "b:27017"
40
+ # phase 1 - server is a primary with mismatched me
41
+ -
42
+ responses:
43
+ -
44
+ - "a:27017"
45
+ -
46
+ ok: 1
47
+ ismaster: true
48
+ setName: "rs"
49
+ setVersion: 1
50
+ me: "aa:27017"
51
+ primary: "aa:27017"
52
+ hosts:
53
+ - "aa:27017"
54
+ minWireVersion: 0
55
+ maxWireVersion: 4
56
+ outcome:
57
+ events:
58
+ # TODO see about having the opening event precede the closing event.
59
+ -
60
+ server_closed_event:
61
+ topologyId: "42"
62
+ address: "a:27017"
63
+ -
64
+ server_closed_event:
65
+ topologyId: "42"
66
+ address: "b:27017"
67
+ -
68
+ server_opening_event:
69
+ topologyId: "42"
70
+ address: "aa:27017"
71
+ -
72
+ topology_description_changed_event:
73
+ topologyId: "42"
74
+ previousDescription:
75
+ topologyType: "Unknown"
76
+ servers:
77
+ -
78
+ address: "a:27017"
79
+ arbiters: []
80
+ hosts: []
81
+ passives: []
82
+ -
83
+ address: "b:27017"
84
+ arbiters: []
85
+ hosts: []
86
+ passives: []
87
+ newDescription:
88
+ topologyType: "ReplicaSetNoPrimary"
89
+ setName: rs
90
+ servers:
91
+ -
92
+ address: "aa:27017"
93
+ arbiters: []
94
+ hosts: []
95
+ passives: []
96
+
97
+ # phaes 2 - response from new primary from new address
98
+ -
99
+ responses:
100
+ -
101
+ - "aa:27017"
102
+ -
103
+ ok: 1
104
+ ismaster: true
105
+ setName: "rs"
106
+ setVersion: 1
107
+ primary: "aa:27017"
108
+ me: "aa:27017"
109
+ hosts:
110
+ - "aa:27017"
111
+ minWireVersion: 0
112
+ maxWireVersion: 4
113
+ outcome:
114
+ events:
115
+ -
116
+ server_description_changed_event:
117
+ topologyId: "42"
118
+ address: "aa:27017"
119
+ previousDescription:
120
+ address: "aa:27017"
121
+ arbiters: []
122
+ hosts: []
123
+ passives: []
124
+ type: "Unknown"
125
+ newDescription:
126
+ address: "aa:27017"
127
+ arbiters: []
128
+ hosts:
129
+ - "aa:27017"
130
+ passives: []
131
+ primary: "aa:27017"
132
+ setName: "rs"
133
+ type: "RSPrimary"
134
+ -
135
+ topology_description_changed_event:
136
+ topologyId: "42"
137
+ previousDescription:
138
+ topologyType: "ReplicaSetNoPrimary"
139
+ setName: rs
140
+ servers:
141
+ -
142
+ address: "aa:27017"
143
+ arbiters: []
144
+ hosts: []
145
+ passives: []
146
+ type: "Unknown"
147
+ newDescription:
148
+ topologyType: "ReplicaSetWithPrimary"
149
+ setName: "rs"
150
+ servers:
151
+ -
152
+ address: "aa:27017"
153
+ arbiters: []
154
+ hosts:
155
+ - "aa:27017"
156
+ passives: []
157
+ primary: "aa:27017"
158
+ setName: "rs"
159
+ type: "RSPrimary"
@@ -1,24 +1,10 @@
1
- description: "Monitoring a topology that is a replica set with RSOther seed"
1
+ description: "Monitoring a topology that is a replica set with primary address change"
2
2
  uri: "mongodb://a,b"
3
3
  phases:
4
- # phase 1
5
- -
6
- responses:
7
- -
8
- - "a:27017"
9
- -
10
- ok: 1
11
- ismaster: true
12
- setName: "rs"
13
- setVersion: 1
14
- primary: "c:27017"
15
- hosts:
16
- - "c:27017"
17
- - "d:27017"
18
- minWireVersion: 0
19
- maxWireVersion: 4
20
- outcome:
21
- events:
4
+ -
5
+ responses: []
6
+ outcome:
7
+ events:
22
8
  -
23
9
  topology_opening_event:
24
10
  topologyId: "42"
@@ -28,7 +14,7 @@ phases:
28
14
  previousDescription:
29
15
  topologyType: "Unknown"
30
16
  servers: []
31
- newDescription:
17
+ newDescription:
32
18
  topologyType: "Unknown"
33
19
  servers:
34
20
  -
@@ -51,6 +37,23 @@ phases:
51
37
  server_opening_event:
52
38
  topologyId: "42"
53
39
  address: "b:27017"
40
+ # phase 1 - discover topology
41
+ -
42
+ responses:
43
+ -
44
+ - "a:27017"
45
+ -
46
+ ok: 1
47
+ ismaster: true
48
+ setName: "rs"
49
+ setVersion: 1
50
+ primary: "a:27017"
51
+ hosts:
52
+ - "a:27017"
53
+ minWireVersion: 0
54
+ maxWireVersion: 4
55
+ outcome:
56
+ events:
54
57
  -
55
58
  server_description_changed_event:
56
59
  topologyId: "42"
@@ -65,12 +68,15 @@ phases:
65
68
  address: "a:27017"
66
69
  arbiters: []
67
70
  hosts:
68
- - "c:27017"
69
- - "d:27017"
71
+ - "a:27017"
70
72
  passives: []
71
- primary: "c:27017"
73
+ primary: "a:27017"
72
74
  setName: "rs"
73
- type: "RSOther"
75
+ type: "RSPrimary"
76
+ -
77
+ server_closed_event:
78
+ topologyId: "42"
79
+ address: "b:27017"
74
80
  -
75
81
  topology_description_changed_event:
76
82
  topologyId: "42"
@@ -90,60 +96,88 @@ phases:
90
96
  passives: []
91
97
  type: "Unknown"
92
98
  newDescription:
93
- topologyType: "ReplicaSetNoPrimary"
94
- setName: rs
99
+ topologyType: "ReplicaSetWithPrimary"
100
+ setName: "rs"
95
101
  servers:
96
102
  -
97
103
  address: "a:27017"
98
104
  arbiters: []
99
105
  hosts:
100
- - "c:27017"
101
- - "d:27017"
106
+ - "a:27017"
102
107
  passives: []
103
- primary: "c:27017"
108
+ primary: "a:27017"
104
109
  setName: "rs"
105
- type: "RSOther"
106
- -
107
- address: "b:27017"
108
- arbiters: []
109
- hosts: []
110
- passives: []
111
- type: "Unknown"
110
+ type: "RSPrimary"
111
+
112
+
113
+ # phase 2 - primary changes ip address
114
+ -
115
+ responses:
116
+ -
117
+ - "a:27017"
118
+ -
119
+ ok: 1
120
+ ismaster: true
121
+ setName: "rs"
122
+ setVersion: 1
123
+ primary: "aa:27017"
124
+ me: "aa:27017"
125
+ hosts:
126
+ - "aa:27017"
127
+ minWireVersion: 0
128
+ maxWireVersion: 4
129
+ outcome:
130
+ events:
131
+ # TODO see about having the opening event precede the closing event.
132
+ -
133
+ server_closed_event:
134
+ topologyId: "42"
135
+ address: "a:27017"
136
+ -
137
+ server_opening_event:
138
+ topologyId: "42"
139
+ address: "aa:27017"
140
+ -
141
+ topology_description_changed_event:
142
+ topologyId: "42"
143
+ previousDescription:
144
+ topologyType: "ReplicaSetWithPrimary"
145
+ setName: "rs"
146
+ servers:
112
147
  -
113
- address: "c:27017"
148
+ address: "a:27017"
114
149
  arbiters: []
115
- hosts: []
150
+ hosts:
151
+ - "a:27017"
116
152
  passives: []
117
- type: "Unknown"
153
+ primary: "a:27017"
154
+ setName: "rs"
155
+ type: "RSPrimary"
156
+ newDescription:
157
+ topologyType: "ReplicaSetNoPrimary"
158
+ setName: rs
159
+ servers:
118
160
  -
119
- address: "d:27017"
161
+ address: "aa:27017"
120
162
  arbiters: []
121
163
  hosts: []
122
164
  passives: []
123
165
  type: "Unknown"
124
- -
125
- server_opening_event:
126
- topologyId: "42"
127
- address: "c:27017"
128
- -
129
- server_opening_event:
130
- topologyId: "42"
131
- address: "d:27017"
132
166
 
133
- # phase 2
167
+ # phaes 3 - response from new primary from new address
134
168
  -
135
169
  responses:
136
170
  -
137
- - "c:27017"
171
+ - "aa:27017"
138
172
  -
139
173
  ok: 1
140
174
  ismaster: true
141
175
  setName: "rs"
142
176
  setVersion: 1
143
- primary: "c:27017"
177
+ primary: "aa:27017"
178
+ me: "aa:27017"
144
179
  hosts:
145
- - "c:27017"
146
- - "d:27017"
180
+ - "aa:27017"
147
181
  minWireVersion: 0
148
182
  maxWireVersion: 4
149
183
  outcome:
@@ -151,31 +185,22 @@ phases:
151
185
  -
152
186
  server_description_changed_event:
153
187
  topologyId: "42"
154
- address: "c:27017"
188
+ address: "aa:27017"
155
189
  previousDescription:
156
- address: "c:27017"
190
+ address: "aa:27017"
157
191
  arbiters: []
158
192
  hosts: []
159
193
  passives: []
160
194
  type: "Unknown"
161
195
  newDescription:
162
- address: "c:27017"
196
+ address: "aa:27017"
163
197
  arbiters: []
164
198
  hosts:
165
- - "c:27017"
166
- - "d:27017"
199
+ - "aa:27017"
167
200
  passives: []
168
- primary: "c:27017"
201
+ primary: "aa:27017"
169
202
  setName: "rs"
170
203
  type: "RSPrimary"
171
- -
172
- server_closed_event:
173
- topologyId: "42"
174
- address: "a:27017"
175
- -
176
- server_closed_event:
177
- topologyId: "42"
178
- address: "b:27017"
179
204
  -
180
205
  topology_description_changed_event:
181
206
  topologyId: "42"
@@ -184,50 +209,21 @@ phases:
184
209
  setName: rs
185
210
  servers:
186
211
  -
187
- address: "a:27017"
188
- arbiters: []
189
- hosts:
190
- - "c:27017"
191
- - "d:27017"
192
- passives: []
193
- primary: "c:27017"
194
- setName: "rs"
195
- type: "RSOther"
196
- -
197
- address: "b:27017"
198
- arbiters: []
199
- hosts: []
200
- passives: []
201
- type: "Unknown"
202
- -
203
- address: "c:27017"
212
+ address: "aa:27017"
204
213
  arbiters: []
205
214
  hosts: []
206
215
  passives: []
207
216
  type: "Unknown"
208
- -
209
- address: "d:27017"
210
- arbiters: []
211
- hosts: []
212
- passives: []
213
- type: "Unknown"
214
- newDescription:
217
+ newDescription:
215
218
  topologyType: "ReplicaSetWithPrimary"
216
219
  setName: "rs"
217
220
  servers:
218
221
  -
219
- address: "c:27017"
222
+ address: "aa:27017"
220
223
  arbiters: []
221
224
  hosts:
222
- - "c:27017"
223
- - "d:27017"
225
+ - "aa:27017"
224
226
  passives: []
225
- primary: "c:27017"
227
+ primary: "aa:27017"
226
228
  setName: "rs"
227
229
  type: "RSPrimary"
228
- -
229
- address: "d:27017"
230
- arbiters: []
231
- hosts: []
232
- passives: []
233
- type: "Unknown"