mongo 2.11.0 → 2.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Rakefile +24 -0
- data/lib/mongo/address.rb +53 -37
- data/lib/mongo/auth.rb +30 -10
- data/lib/mongo/auth/cr.rb +1 -0
- data/lib/mongo/auth/cr/conversation.rb +13 -13
- data/lib/mongo/auth/ldap.rb +2 -1
- data/lib/mongo/auth/ldap/conversation.rb +9 -12
- data/lib/mongo/auth/scram.rb +1 -0
- data/lib/mongo/auth/scram/conversation.rb +36 -27
- data/lib/mongo/auth/user.rb +7 -1
- data/lib/mongo/auth/x509.rb +2 -1
- data/lib/mongo/auth/x509/conversation.rb +9 -9
- data/lib/mongo/bulk_write/transformable.rb +3 -3
- data/lib/mongo/client.rb +17 -6
- data/lib/mongo/cluster.rb +67 -49
- data/lib/mongo/cluster/sdam_flow.rb +87 -3
- data/lib/mongo/collection/view/readable.rb +3 -1
- data/lib/mongo/collection/view/writable.rb +3 -3
- data/lib/mongo/cursor/builder/kill_cursors_command.rb +8 -1
- data/lib/mongo/cursor/builder/op_kill_cursors.rb +8 -1
- data/lib/mongo/database.rb +1 -1
- data/lib/mongo/grid/file.rb +5 -0
- data/lib/mongo/grid/file/chunk.rb +2 -0
- data/lib/mongo/grid/fs_bucket.rb +15 -13
- data/lib/mongo/grid/stream/write.rb +9 -3
- data/lib/mongo/protocol/serializers.rb +12 -2
- data/lib/mongo/retryable.rb +33 -8
- data/lib/mongo/server.rb +13 -6
- data/lib/mongo/server/connection.rb +15 -8
- data/lib/mongo/server/connection_base.rb +7 -4
- data/lib/mongo/server/description.rb +34 -21
- data/lib/mongo/server/monitor.rb +1 -1
- data/lib/mongo/server/monitor/connection.rb +2 -3
- data/lib/mongo/session.rb +10 -10
- data/lib/mongo/socket.rb +10 -1
- data/lib/mongo/uri.rb +1 -1
- data/lib/mongo/version.rb +1 -1
- data/mongo.gemspec +1 -1
- data/spec/README.md +13 -0
- data/spec/integration/auth_spec.rb +27 -8
- data/spec/integration/bson_symbol_spec.rb +34 -0
- data/spec/integration/client_construction_spec.rb +14 -0
- data/spec/integration/client_options_spec.rb +5 -5
- data/spec/integration/connection_spec.rb +57 -9
- data/spec/integration/crud_spec.rb +45 -0
- data/spec/integration/cursor_reaping_spec.rb +2 -1
- data/spec/integration/grid_fs_bucket_spec.rb +48 -0
- data/spec/integration/retryable_errors_spec.rb +204 -39
- data/spec/integration/retryable_writes_spec.rb +36 -36
- data/spec/integration/size_limit_spec.rb~12e1e9c4f... RUBY-2242 Fix zlib compression (#2021) +98 -0
- data/spec/lite_spec_helper.rb +1 -0
- data/spec/mongo/address_spec.rb +19 -13
- data/spec/mongo/auth/ldap/conversation_spec.rb +1 -1
- data/spec/mongo/auth/scram/conversation_spec.rb +25 -14
- data/spec/mongo/auth/user/view_spec.rb +36 -1
- data/spec/mongo/auth/user_spec.rb +12 -0
- data/spec/mongo/auth/x509/conversation_spec.rb +1 -1
- data/spec/mongo/bulk_write_spec.rb +2 -2
- data/spec/mongo/client_construction_spec.rb +1 -21
- data/spec/mongo/cluster_spec.rb +57 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +1 -1
- data/spec/mongo/collection_spec.rb +26 -2
- data/spec/mongo/cursor/builder/op_kill_cursors_spec.rb +56 -0
- data/spec/mongo/server/connection_spec.rb +76 -8
- data/spec/mongo/server/monitor/connection_spec.rb +14 -7
- data/spec/mongo/socket/ssl_spec.rb +132 -98
- data/spec/mongo/socket/tcp_spec.rb +1 -9
- data/spec/mongo/uri_spec.rb +1 -1
- data/spec/runners/sdam/verifier.rb +91 -0
- data/spec/spec_tests/data/sdam/rs/primary_address_change.yml +29 -0
- data/spec/spec_tests/data/sdam/rs/primary_mismatched_me.yml +27 -23
- data/spec/spec_tests/data/sdam/rs/primary_to_no_primary_mismatched_me.yml +56 -79
- data/spec/spec_tests/data/sdam/sharded/primary_address_change.yml +21 -0
- data/spec/spec_tests/data/sdam/sharded/primary_mismatched_me.yml +22 -0
- data/spec/spec_tests/data/sdam/single/primary_address_change.yml +24 -0
- data/spec/spec_tests/data/sdam/single/primary_mismatched_me.yml +25 -0
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_me_mismatch.yml +159 -0
- data/spec/spec_tests/data/sdam_monitoring/{replica_set_other_seed.yml → replica_set_with_primary_change.yml} +97 -101
- data/spec/spec_tests/data/sdam_monitoring/replica_set_with_primary_removal.yml +22 -18
- data/spec/spec_tests/data/sdam_monitoring/standalone_to_rs_with_me_mismatch.yml +90 -0
- data/spec/spec_tests/sdam_monitoring_spec.rb +9 -4
- data/spec/support/cluster_config.rb +36 -0
- data/spec/support/cluster_tools.rb +5 -3
- data/spec/support/command_monitoring.rb +1 -1
- data/spec/support/constraints.rb +18 -18
- data/spec/support/lite_constraints.rb +8 -0
- data/spec/support/sdam_monitoring.rb +0 -115
- data/spec/support/server_discovery_and_monitoring.rb +2 -0
- data/spec/support/spec_config.rb +1 -1
- data/spec/support/utils.rb +11 -1
- metadata +687 -659
- metadata.gz.sig +3 -2
@@ -1,24 +1,10 @@
|
|
1
|
-
description: "Monitoring a topology that is a replica set with
|
1
|
+
description: "Monitoring a topology that is a replica set with primary address change"
|
2
2
|
uri: "mongodb://a,b"
|
3
3
|
phases:
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
- "
|
69
|
-
- "d:27017"
|
71
|
+
- "a:27017"
|
70
72
|
passives: []
|
71
|
-
primary: "
|
73
|
+
primary: "a:27017"
|
72
74
|
setName: "rs"
|
73
|
-
type: "
|
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: "
|
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
|
-
- "
|
101
|
-
- "d:27017"
|
106
|
+
- "a:27017"
|
102
107
|
passives: []
|
103
|
-
primary: "
|
108
|
+
primary: "a:27017"
|
104
109
|
setName: "rs"
|
105
|
-
type: "
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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: "
|
148
|
+
address: "a:27017"
|
114
149
|
arbiters: []
|
115
|
-
hosts:
|
150
|
+
hosts:
|
151
|
+
- "a:27017"
|
116
152
|
passives: []
|
117
|
-
|
153
|
+
primary: "a:27017"
|
154
|
+
setName: "rs"
|
155
|
+
type: "RSPrimary"
|
156
|
+
newDescription:
|
157
|
+
topologyType: "ReplicaSetNoPrimary"
|
158
|
+
setName: rs
|
159
|
+
servers:
|
118
160
|
-
|
119
|
-
address: "
|
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
|
-
#
|
167
|
+
# phaes 3 - response from new primary from new address
|
134
168
|
-
|
135
169
|
responses:
|
136
170
|
-
|
137
|
-
- "
|
171
|
+
- "aa:27017"
|
138
172
|
-
|
139
173
|
ok: 1
|
140
174
|
ismaster: true
|
141
175
|
setName: "rs"
|
142
176
|
setVersion: 1
|
143
|
-
primary: "
|
177
|
+
primary: "aa:27017"
|
178
|
+
me: "aa:27017"
|
144
179
|
hosts:
|
145
|
-
- "
|
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: "
|
188
|
+
address: "aa:27017"
|
155
189
|
previousDescription:
|
156
|
-
address: "
|
190
|
+
address: "aa:27017"
|
157
191
|
arbiters: []
|
158
192
|
hosts: []
|
159
193
|
passives: []
|
160
194
|
type: "Unknown"
|
161
195
|
newDescription:
|
162
|
-
address: "
|
196
|
+
address: "aa:27017"
|
163
197
|
arbiters: []
|
164
198
|
hosts:
|
165
|
-
- "
|
166
|
-
- "d:27017"
|
199
|
+
- "aa:27017"
|
167
200
|
passives: []
|
168
|
-
primary: "
|
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: "
|
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: "
|
222
|
+
address: "aa:27017"
|
220
223
|
arbiters: []
|
221
224
|
hosts:
|
222
|
-
- "
|
223
|
-
- "d:27017"
|
225
|
+
- "aa:27017"
|
224
226
|
passives: []
|
225
|
-
primary: "
|
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"
|
@@ -1,23 +1,10 @@
|
|
1
1
|
description: "Monitoring a topology that is a replica set with primary removal"
|
2
2
|
uri: "mongodb://a,b"
|
3
3
|
phases:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
- "a:27017"
|
9
|
-
-
|
10
|
-
ok: 1
|
11
|
-
ismaster: true
|
12
|
-
setName: "rs"
|
13
|
-
setVersion: 1
|
14
|
-
primary: "a:27017"
|
15
|
-
hosts:
|
16
|
-
- "a:27017"
|
17
|
-
minWireVersion: 0
|
18
|
-
maxWireVersion: 4
|
19
|
-
outcome:
|
20
|
-
events:
|
4
|
+
-
|
5
|
+
responses: []
|
6
|
+
outcome:
|
7
|
+
events:
|
21
8
|
-
|
22
9
|
topology_opening_event:
|
23
10
|
topologyId: "42"
|
@@ -50,6 +37,23 @@ phases:
|
|
50
37
|
server_opening_event:
|
51
38
|
topologyId: "42"
|
52
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:
|
53
57
|
-
|
54
58
|
server_description_changed_event:
|
55
59
|
topologyId: "42"
|
@@ -144,7 +148,7 @@ phases:
|
|
144
148
|
passives: []
|
145
149
|
primary: "c:27017"
|
146
150
|
setName: "wrong"
|
147
|
-
type: "
|
151
|
+
type: "RSPrimary"
|
148
152
|
-
|
149
153
|
server_closed_event:
|
150
154
|
topologyId: "42"
|
@@ -0,0 +1,90 @@
|
|
1
|
+
description: "Standalone connection to a replica set node with a me mismatch"
|
2
|
+
uri: "mongodb://a/?connect=direct"
|
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: "Single"
|
19
|
+
servers:
|
20
|
+
-
|
21
|
+
address: "a:27017"
|
22
|
+
arbiters: []
|
23
|
+
hosts: []
|
24
|
+
passives: []
|
25
|
+
type: "Unknown"
|
26
|
+
-
|
27
|
+
server_opening_event:
|
28
|
+
topologyId: "42"
|
29
|
+
address: "a:27017"
|
30
|
+
# phase 1 - server is a primary with mismatched me
|
31
|
+
-
|
32
|
+
responses:
|
33
|
+
-
|
34
|
+
- "a:27017"
|
35
|
+
-
|
36
|
+
ok: 1
|
37
|
+
ismaster: true
|
38
|
+
setName: "rs"
|
39
|
+
setVersion: 1
|
40
|
+
primary: "aa:27017"
|
41
|
+
me: "aa:27017"
|
42
|
+
hosts:
|
43
|
+
- "aa:27017"
|
44
|
+
minWireVersion: 0
|
45
|
+
maxWireVersion: 4
|
46
|
+
outcome:
|
47
|
+
events:
|
48
|
+
-
|
49
|
+
server_description_changed_event:
|
50
|
+
topologyId: "42"
|
51
|
+
address: "a:27017"
|
52
|
+
previousDescription:
|
53
|
+
address: "a:27017"
|
54
|
+
arbiters: []
|
55
|
+
hosts: []
|
56
|
+
passives: []
|
57
|
+
type: "Unknown"
|
58
|
+
newDescription:
|
59
|
+
address: "a:27017"
|
60
|
+
arbiters: []
|
61
|
+
hosts:
|
62
|
+
- "aa:27017"
|
63
|
+
passives: []
|
64
|
+
primary: "aa:27017"
|
65
|
+
setName: "rs"
|
66
|
+
type: "RSPrimary"
|
67
|
+
-
|
68
|
+
topology_description_changed_event:
|
69
|
+
topologyId: "42"
|
70
|
+
previousDescription:
|
71
|
+
topologyType: "Single"
|
72
|
+
servers:
|
73
|
+
-
|
74
|
+
address: "a:27017"
|
75
|
+
arbiters: []
|
76
|
+
hosts: []
|
77
|
+
passives: []
|
78
|
+
type: "Unknown"
|
79
|
+
newDescription:
|
80
|
+
topologyType: "Single"
|
81
|
+
servers:
|
82
|
+
-
|
83
|
+
address: "a:27017"
|
84
|
+
arbiters: []
|
85
|
+
hosts:
|
86
|
+
- "aa:27017"
|
87
|
+
passives: []
|
88
|
+
primary: "aa:27017"
|
89
|
+
setName: "rs"
|
90
|
+
type: "RSPrimary"
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'lite_spec_helper'
|
2
2
|
|
3
|
+
require_relative '../runners/sdam/verifier'
|
4
|
+
|
3
5
|
describe 'SDAM Monitoring' do
|
4
6
|
include Mongo::SDAM
|
5
7
|
|
@@ -72,12 +74,15 @@ describe 'SDAM Monitoring' do
|
|
72
74
|
expect(@subscriber.phase_events(phase_index).length).to eq(phase.outcome.events.length)
|
73
75
|
end
|
74
76
|
|
77
|
+
let(:verifier) do
|
78
|
+
Sdam::Verifier.new
|
79
|
+
end
|
80
|
+
|
75
81
|
phase.outcome.events.each_with_index do |expectation, index|
|
76
82
|
|
77
|
-
it "expects
|
78
|
-
|
79
|
-
|
80
|
-
expect(published_event).to match_sdam_monitoring_event(expectation)
|
83
|
+
it "expects event #{index+1} to be #{expectation.name}" do
|
84
|
+
verifier.verify_sdam_event(
|
85
|
+
phase.outcome.events, @subscriber.phase_events(phase_index), index)
|
81
86
|
end
|
82
87
|
end
|
83
88
|
end
|