mongo 2.5.0 → 2.5.1
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/README.md +2 -0
- data/Rakefile +4 -1
- data/lib/mongo/address.rb +2 -1
- data/lib/mongo/client.rb +6 -51
- data/lib/mongo/cluster.rb +34 -4
- data/lib/mongo/cluster/reapers/socket_reaper.rb +1 -1
- data/lib/mongo/cluster/topology/replica_set.rb +3 -1
- data/lib/mongo/collection.rb +6 -6
- data/lib/mongo/collection/view.rb +2 -4
- data/lib/mongo/cursor.rb +9 -4
- data/lib/mongo/error.rb +2 -0
- data/lib/mongo/operation/uses_command_op_msg.rb +1 -1
- data/lib/mongo/server.rb +3 -0
- data/lib/mongo/server/description.rb +1 -1
- data/lib/mongo/server/description/features.rb +18 -12
- data/lib/mongo/server_selector/selectable.rb +5 -1
- data/lib/mongo/session.rb +38 -43
- data/lib/mongo/session/session_pool.rb +12 -30
- data/lib/mongo/socket.rb +24 -0
- data/lib/mongo/socket/tcp.rb +0 -1
- data/lib/mongo/uri.rb +26 -5
- data/lib/mongo/version.rb +1 -1
- data/spec/mongo/address_spec.rb +37 -2
- data/spec/mongo/bulk_write_spec.rb +4 -10
- data/spec/mongo/change_stream_examples_spec.rb +40 -0
- data/spec/mongo/client_spec.rb +47 -12
- data/spec/mongo/cluster/topology/replica_set_spec.rb +2 -0
- data/spec/mongo/collection/view/aggregation_spec.rb +2 -8
- data/spec/mongo/collection/view/change_stream_spec.rb +1 -5
- data/spec/mongo/collection/view/map_reduce_spec.rb +2 -8
- data/spec/mongo/collection/view/readable_spec.rb +1 -1
- data/spec/mongo/collection_spec.rb +11 -29
- data/spec/mongo/crud_spec.rb +6 -2
- data/spec/mongo/cursor_spec.rb +84 -1
- data/spec/mongo/database_spec.rb +2 -8
- data/spec/mongo/dns_seedlist_discovery_spec.rb +67 -63
- data/spec/mongo/max_staleness_spec.rb +1 -0
- data/spec/mongo/retryable_writes_spec.rb +7 -9
- data/spec/mongo/sdam_spec.rb +42 -24
- data/spec/mongo/server/description/features_spec.rb +3 -3
- data/spec/mongo/server_selection_spec.rb +2 -0
- data/spec/mongo/server_selector_spec.rb +2 -0
- data/spec/mongo/session/session_pool_spec.rb +16 -22
- data/spec/mongo/session_spec.rb +13 -8
- data/spec/mongo/uri/srv_protocol_spec.rb +481 -478
- data/spec/mongo/uri_spec.rb +1 -1
- data/spec/spec_helper.rb +11 -63
- data/spec/support/authorization.rb +35 -1
- data/spec/support/connection_string_tests/invalid-uris.yml +27 -11
- data/spec/support/event_subscriber.rb +66 -0
- data/spec/support/sdam/rs/compatible.yml +41 -0
- data/spec/support/sdam/rs/discover_arbiters.yml +3 -1
- data/spec/support/sdam/rs/discover_passives.yml +6 -2
- data/spec/support/sdam/rs/discover_primary.yml +3 -1
- data/spec/support/sdam/rs/discover_secondary.yml +3 -1
- data/spec/support/sdam/rs/discovery.yml +12 -4
- data/spec/support/sdam/rs/equal_electionids.yml +6 -2
- data/spec/support/sdam/rs/ghost_discovered.yml +3 -1
- data/spec/support/sdam/rs/hosts_differ_from_seeds.yml +3 -1
- data/spec/support/sdam/rs/ls_timeout.yml +169 -14
- data/spec/support/sdam/rs/member_reconfig.yml +6 -2
- data/spec/support/sdam/rs/member_standalone.yml +6 -2
- data/spec/support/sdam/rs/new_primary.yml +6 -2
- data/spec/support/sdam/rs/new_primary_new_electionid.yml +9 -3
- data/spec/support/sdam/rs/new_primary_new_setversion.yml +9 -3
- data/spec/support/sdam/rs/new_primary_wrong_set_name.yml +6 -2
- data/spec/support/sdam/rs/non_rs_member.yml +3 -2
- data/spec/support/sdam/rs/normalize_case.yml +3 -1
- data/spec/support/sdam/rs/null_election_id.yml +12 -4
- data/spec/support/sdam/rs/primary_becomes_standalone.yml +6 -4
- data/spec/support/sdam/rs/primary_changes_set_name.yml +6 -2
- data/spec/support/sdam/rs/primary_disconnect.yml +3 -1
- data/spec/support/sdam/rs/primary_disconnect_electionid.yml +15 -5
- data/spec/support/sdam/rs/primary_disconnect_setversion.yml +15 -5
- data/spec/support/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +6 -2
- data/spec/support/sdam/rs/primary_mismatched_me.yml +26 -37
- data/spec/support/sdam/rs/primary_reports_new_member.yml +12 -4
- data/spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml +6 -2
- data/spec/support/sdam/rs/primary_wrong_set_name.yml +3 -1
- data/spec/support/sdam/rs/response_from_removed.yml +6 -2
- data/spec/support/sdam/rs/rsother_discovered.yml +6 -2
- data/spec/support/sdam/rs/sec_not_auth.yml +6 -2
- data/spec/support/sdam/rs/secondary_mismatched_me.yml +26 -37
- data/spec/support/sdam/rs/secondary_wrong_set_name.yml +3 -1
- data/spec/support/sdam/rs/secondary_wrong_set_name_with_primary.yml +6 -2
- data/spec/support/sdam/rs/setversion_without_electionid.yml +6 -2
- data/spec/support/sdam/rs/stepdown_change_set_name.yml +6 -2
- data/spec/support/sdam/rs/too_new.yml +41 -0
- data/spec/support/sdam/rs/too_old.yml +39 -0
- data/spec/support/sdam/rs/unexpected_mongos.yml +3 -1
- data/spec/support/sdam/rs/use_setversion_without_electionid.yml +9 -3
- data/spec/support/sdam/rs/wrong_set_name.yml +3 -1
- data/spec/support/server_discovery_and_monitoring.rb +13 -0
- data/spec/support/shared/session.rb +10 -30
- metadata +10 -2
- metadata.gz.sig +0 -0
@@ -13,7 +13,9 @@ phases: [
|
|
13
13
|
hosts: ["a:27017", "b:27017"],
|
14
14
|
setName: "rs",
|
15
15
|
setVersion: 1,
|
16
|
-
electionId: {"$oid": "000000000000000000000001"}
|
16
|
+
electionId: {"$oid": "000000000000000000000001"},
|
17
|
+
minWireVersion: 0,
|
18
|
+
maxWireVersion: 6
|
17
19
|
}],
|
18
20
|
["b:27017", {
|
19
21
|
ok: 1,
|
@@ -21,7 +23,9 @@ phases: [
|
|
21
23
|
hosts: ["a:27017", "b:27017"],
|
22
24
|
setName: "rs",
|
23
25
|
setVersion: 1,
|
24
|
-
electionId: {"$oid": "000000000000000000000001"}
|
26
|
+
electionId: {"$oid": "000000000000000000000001"},
|
27
|
+
minWireVersion: 0,
|
28
|
+
maxWireVersion: 6
|
25
29
|
}]
|
26
30
|
],
|
27
31
|
|
@@ -3,31 +3,133 @@ description: "Parse logicalSessionTimeoutMinutes from replica set"
|
|
3
3
|
uri: "mongodb://a/?replicaSet=rs"
|
4
4
|
|
5
5
|
phases: [
|
6
|
-
|
6
|
+
# An RSPrimary responds with a non-null logicalSessionTimeoutMinutes
|
7
7
|
{
|
8
8
|
responses: [
|
9
|
-
|
9
|
+
["a:27017", {
|
10
10
|
ok: 1,
|
11
11
|
ismaster: true,
|
12
|
-
hosts: ["a:27017", "b:27017"],
|
12
|
+
hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
|
13
13
|
setName: "rs",
|
14
|
-
logicalSessionTimeoutMinutes:
|
14
|
+
logicalSessionTimeoutMinutes: 3,
|
15
|
+
minWireVersion: 0,
|
16
|
+
maxWireVersion: 6
|
17
|
+
}],
|
18
|
+
],
|
19
|
+
outcome: {
|
20
|
+
servers: {
|
21
|
+
"a:27017": {
|
22
|
+
type: "RSPrimary",
|
23
|
+
setName: "rs"
|
24
|
+
},
|
25
|
+
"b:27017": {
|
26
|
+
type: "Unknown",
|
27
|
+
},
|
28
|
+
"c:27017": {
|
29
|
+
type: "Unknown",
|
30
|
+
},
|
31
|
+
"d:27017": {
|
32
|
+
type: "Unknown",
|
33
|
+
},
|
34
|
+
"e:27017": {
|
35
|
+
type: "Unknown",
|
36
|
+
}
|
37
|
+
|
38
|
+
},
|
39
|
+
topologyType: "ReplicaSetWithPrimary",
|
40
|
+
logicalSessionTimeoutMinutes: 3,
|
41
|
+
setName: "rs",
|
42
|
+
}
|
43
|
+
},
|
44
|
+
# An RSGhost responds without a logicalSessionTimeoutMinutes
|
45
|
+
{
|
46
|
+
responses: [
|
47
|
+
["d:27017", {
|
48
|
+
ok: 1,
|
49
|
+
ismaster: false,
|
50
|
+
isreplicaset: true,
|
15
51
|
minWireVersion: 0,
|
16
52
|
maxWireVersion: 6
|
17
53
|
}],
|
54
|
+
],
|
55
|
+
outcome: {
|
56
|
+
servers: {
|
57
|
+
"a:27017": {
|
58
|
+
type: "RSPrimary",
|
59
|
+
setName: "rs"
|
60
|
+
},
|
61
|
+
"b:27017": {
|
62
|
+
type: "Unknown",
|
63
|
+
},
|
64
|
+
"c:27017": {
|
65
|
+
type: "Unknown",
|
66
|
+
},
|
67
|
+
"d:27017": {
|
68
|
+
type: "RSGhost",
|
69
|
+
},
|
70
|
+
"e:27017": {
|
71
|
+
type: "Unknown",
|
72
|
+
}
|
73
|
+
|
74
|
+
},
|
75
|
+
topologyType: "ReplicaSetWithPrimary",
|
76
|
+
logicalSessionTimeoutMinutes: 3,
|
77
|
+
setName: "rs",
|
78
|
+
}
|
79
|
+
},
|
80
|
+
# An RSArbiter responds without a logicalSessionTimeoutMinutes
|
81
|
+
{
|
82
|
+
responses: [
|
83
|
+
["e:27017", {
|
84
|
+
ok: 1,
|
85
|
+
ismaster: false,
|
86
|
+
hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
|
87
|
+
setName: "rs",
|
88
|
+
arbiterOnly: true,
|
89
|
+
minWireVersion: 0,
|
90
|
+
maxWireVersion: 6
|
91
|
+
}]
|
92
|
+
],
|
93
|
+
outcome: {
|
94
|
+
servers: {
|
95
|
+
"a:27017": {
|
96
|
+
type: "RSPrimary",
|
97
|
+
setName: "rs"
|
98
|
+
},
|
99
|
+
"b:27017": {
|
100
|
+
type: "Unknown",
|
101
|
+
},
|
102
|
+
"c:27017": {
|
103
|
+
type: "Unknown",
|
104
|
+
},
|
105
|
+
"d:27017": {
|
106
|
+
type: "RSGhost",
|
107
|
+
},
|
108
|
+
"e:27017": {
|
109
|
+
type: "RSArbiter",
|
110
|
+
setName: "rs"
|
111
|
+
}
|
112
|
+
|
113
|
+
},
|
114
|
+
topologyType: "ReplicaSetWithPrimary",
|
115
|
+
logicalSessionTimeoutMinutes: 3,
|
116
|
+
setName: "rs",
|
117
|
+
}
|
118
|
+
},
|
119
|
+
# An RSSecondary responds with a lower logicalSessionTimeoutMinutes
|
120
|
+
{
|
121
|
+
responses: [
|
18
122
|
["b:27017", {
|
19
123
|
ok: 1,
|
20
124
|
ismaster: false,
|
21
125
|
secondary: true,
|
22
|
-
hosts: ["a:27017", "b:27017"],
|
126
|
+
hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
|
23
127
|
setName: "rs",
|
24
128
|
logicalSessionTimeoutMinutes: 2,
|
25
129
|
minWireVersion: 0,
|
26
130
|
maxWireVersion: 6
|
27
|
-
}]
|
131
|
+
}],
|
28
132
|
],
|
29
|
-
|
30
|
-
# logicalSessionTimeoutMinutes is the minimum of the two
|
31
133
|
outcome: {
|
32
134
|
servers: {
|
33
135
|
"a:27017": {
|
@@ -37,30 +139,72 @@ phases: [
|
|
37
139
|
"b:27017": {
|
38
140
|
type: "RSSecondary",
|
39
141
|
setName: "rs"
|
142
|
+
},
|
143
|
+
"c:27017": {
|
144
|
+
type: "Unknown",
|
145
|
+
},
|
146
|
+
"d:27017": {
|
147
|
+
type: "RSGhost",
|
148
|
+
},
|
149
|
+
"e:27017": {
|
150
|
+
type: "RSArbiter",
|
151
|
+
setName: "rs"
|
40
152
|
}
|
153
|
+
|
41
154
|
},
|
42
155
|
topologyType: "ReplicaSetWithPrimary",
|
43
|
-
logicalSessionTimeoutMinutes:
|
156
|
+
logicalSessionTimeoutMinutes: 2,
|
44
157
|
setName: "rs",
|
45
158
|
}
|
46
159
|
},
|
47
|
-
#
|
160
|
+
# An RSOther responds with an even lower logicalSessionTimeoutMinutes, which is ignored
|
48
161
|
{
|
49
162
|
responses: [
|
50
|
-
["
|
163
|
+
["c:27017", {
|
51
164
|
ok: 1,
|
52
|
-
ismaster:
|
53
|
-
hosts: ["a:27017", "b:27017"],
|
165
|
+
ismaster: false,
|
54
166
|
setName: "rs",
|
167
|
+
hidden: true,
|
55
168
|
logicalSessionTimeoutMinutes: 1,
|
56
169
|
minWireVersion: 0,
|
57
170
|
maxWireVersion: 6
|
58
171
|
}],
|
172
|
+
],
|
173
|
+
outcome: {
|
174
|
+
servers: {
|
175
|
+
"a:27017": {
|
176
|
+
type: "RSPrimary",
|
177
|
+
setName: "rs"
|
178
|
+
},
|
179
|
+
"b:27017": {
|
180
|
+
type: "RSSecondary",
|
181
|
+
setName: "rs"
|
182
|
+
},
|
183
|
+
"c:27017": {
|
184
|
+
type: "RSOther",
|
185
|
+
setName: "rs"
|
186
|
+
},
|
187
|
+
"d:27017": {
|
188
|
+
type: "RSGhost",
|
189
|
+
},
|
190
|
+
"e:27017": {
|
191
|
+
type: "RSArbiter",
|
192
|
+
setName: "rs"
|
193
|
+
}
|
194
|
+
},
|
195
|
+
topologyType: "ReplicaSetWithPrimary",
|
196
|
+
logicalSessionTimeoutMinutes: 2,
|
197
|
+
setName: "rs",
|
198
|
+
}
|
199
|
+
},
|
200
|
+
# Now the RSSecondary responds with no logicalSessionTimeoutMinutes
|
201
|
+
{
|
202
|
+
responses: [
|
59
203
|
["b:27017", {
|
60
204
|
ok: 1,
|
61
205
|
ismaster: false,
|
62
206
|
secondary: true,
|
63
|
-
hosts: ["a:27017", "b:27017"],
|
207
|
+
hosts: ["a:27017", "b:27017", "c:27017", "d:27017", "e:27017"],
|
64
208
|
setName: "rs",
|
65
209
|
logicalSessionTimeoutMinutes: null,
|
66
210
|
minWireVersion: 0,
|
@@ -78,6 +222,17 @@ phases: [
|
|
78
222
|
"b:27017": {
|
79
223
|
type: "RSSecondary",
|
80
224
|
setName: "rs"
|
225
|
+
},
|
226
|
+
"c:27017": {
|
227
|
+
type: "RSOther",
|
228
|
+
setName: "rs"
|
229
|
+
},
|
230
|
+
"d:27017": {
|
231
|
+
type: "RSGhost",
|
232
|
+
},
|
233
|
+
"e:27017": {
|
234
|
+
type: "RSArbiter",
|
235
|
+
setName: "rs"
|
81
236
|
}
|
82
237
|
},
|
83
238
|
topologyType: "ReplicaSetWithPrimary",
|
@@ -12,7 +12,9 @@ phases: [
|
|
12
12
|
ok: 1,
|
13
13
|
ismaster: true,
|
14
14
|
setName: "rs",
|
15
|
-
hosts: ["a:27017", "b:27017"]
|
15
|
+
hosts: ["a:27017", "b:27017"],
|
16
|
+
minWireVersion: 0,
|
17
|
+
maxWireVersion: 6
|
16
18
|
}]
|
17
19
|
],
|
18
20
|
|
@@ -46,7 +48,9 @@ phases: [
|
|
46
48
|
ok: 1,
|
47
49
|
ismaster: true,
|
48
50
|
setName: "rs",
|
49
|
-
hosts: ["a:27017"]
|
51
|
+
hosts: ["a:27017"],
|
52
|
+
minWireVersion: 0,
|
53
|
+
maxWireVersion: 6
|
50
54
|
}]
|
51
55
|
],
|
52
56
|
|
@@ -10,7 +10,9 @@ phases: [
|
|
10
10
|
["b:27017", {
|
11
11
|
|
12
12
|
ok: 1,
|
13
|
-
ismaster: true
|
13
|
+
ismaster: true,
|
14
|
+
minWireVersion: 0,
|
15
|
+
maxWireVersion: 6
|
14
16
|
}]
|
15
17
|
],
|
16
18
|
|
@@ -38,7 +40,9 @@ phases: [
|
|
38
40
|
ok: 1,
|
39
41
|
ismaster: true,
|
40
42
|
setName: "rs",
|
41
|
-
hosts: ["a:27017"]
|
43
|
+
hosts: ["a:27017"],
|
44
|
+
minWireVersion: 0,
|
45
|
+
maxWireVersion: 6
|
42
46
|
}]
|
43
47
|
],
|
44
48
|
|
@@ -12,7 +12,9 @@ phases: [
|
|
12
12
|
ok: 1,
|
13
13
|
ismaster: true,
|
14
14
|
setName: "rs",
|
15
|
-
hosts: ["a:27017", "b:27017"]
|
15
|
+
hosts: ["a:27017", "b:27017"],
|
16
|
+
minWireVersion: 0,
|
17
|
+
maxWireVersion: 6
|
16
18
|
}]
|
17
19
|
],
|
18
20
|
|
@@ -46,7 +48,9 @@ phases: [
|
|
46
48
|
ok: 1,
|
47
49
|
ismaster: true,
|
48
50
|
setName: "rs",
|
49
|
-
hosts: ["a:27017", "b:27017"]
|
51
|
+
hosts: ["a:27017", "b:27017"],
|
52
|
+
minWireVersion: 0,
|
53
|
+
maxWireVersion: 6
|
50
54
|
}]
|
51
55
|
],
|
52
56
|
|
@@ -13,7 +13,9 @@ phases: [
|
|
13
13
|
hosts: ["a:27017", "b:27017"],
|
14
14
|
setName: "rs",
|
15
15
|
setVersion: 1,
|
16
|
-
electionId: {"$oid": "000000000000000000000001"}
|
16
|
+
electionId: {"$oid": "000000000000000000000001"},
|
17
|
+
minWireVersion: 0,
|
18
|
+
maxWireVersion: 6
|
17
19
|
}]
|
18
20
|
],
|
19
21
|
|
@@ -46,7 +48,9 @@ phases: [
|
|
46
48
|
hosts: ["a:27017", "b:27017"],
|
47
49
|
setName: "rs",
|
48
50
|
setVersion: 1,
|
49
|
-
electionId: {"$oid": "000000000000000000000002"}
|
51
|
+
electionId: {"$oid": "000000000000000000000002"},
|
52
|
+
minWireVersion: 0,
|
53
|
+
maxWireVersion: 6
|
50
54
|
}]
|
51
55
|
],
|
52
56
|
|
@@ -79,7 +83,9 @@ phases: [
|
|
79
83
|
hosts: ["a:27017", "b:27017"],
|
80
84
|
setName: "rs",
|
81
85
|
setVersion: 1,
|
82
|
-
electionId: {"$oid": "000000000000000000000001"}
|
86
|
+
electionId: {"$oid": "000000000000000000000001"},
|
87
|
+
minWireVersion: 0,
|
88
|
+
maxWireVersion: 6
|
83
89
|
}]
|
84
90
|
],
|
85
91
|
outcome: {
|
@@ -13,7 +13,9 @@ phases: [
|
|
13
13
|
hosts: ["a:27017", "b:27017"],
|
14
14
|
setName: "rs",
|
15
15
|
setVersion: 1,
|
16
|
-
electionId: {"$oid": "000000000000000000000001"}
|
16
|
+
electionId: {"$oid": "000000000000000000000001"},
|
17
|
+
minWireVersion: 0,
|
18
|
+
maxWireVersion: 6
|
17
19
|
}]
|
18
20
|
],
|
19
21
|
|
@@ -46,7 +48,9 @@ phases: [
|
|
46
48
|
hosts: ["a:27017", "b:27017"],
|
47
49
|
setName: "rs",
|
48
50
|
setVersion: 2,
|
49
|
-
electionId: {"$oid": "000000000000000000000001"}
|
51
|
+
electionId: {"$oid": "000000000000000000000001"},
|
52
|
+
minWireVersion: 0,
|
53
|
+
maxWireVersion: 6
|
50
54
|
}]
|
51
55
|
],
|
52
56
|
|
@@ -79,7 +83,9 @@ phases: [
|
|
79
83
|
hosts: ["a:27017", "b:27017"],
|
80
84
|
setName: "rs",
|
81
85
|
setVersion: 1,
|
82
|
-
electionId: {"$oid": "000000000000000000000001"}
|
86
|
+
electionId: {"$oid": "000000000000000000000001"},
|
87
|
+
minWireVersion: 0,
|
88
|
+
maxWireVersion: 6
|
83
89
|
}]
|
84
90
|
],
|
85
91
|
outcome: {
|
@@ -13,7 +13,9 @@ phases: [
|
|
13
13
|
ok: 1,
|
14
14
|
ismaster: true,
|
15
15
|
hosts: ["a:27017", "b:27017"],
|
16
|
-
setName: "rs"
|
16
|
+
setName: "rs",
|
17
|
+
minWireVersion: 0,
|
18
|
+
maxWireVersion: 6
|
17
19
|
}]
|
18
20
|
],
|
19
21
|
|
@@ -49,7 +51,9 @@ phases: [
|
|
49
51
|
ok: 1,
|
50
52
|
ismaster: true,
|
51
53
|
hosts: ["a:27017"],
|
52
|
-
setName: "wrong"
|
54
|
+
setName: "wrong",
|
55
|
+
minWireVersion: 0,
|
56
|
+
maxWireVersion: 6
|
53
57
|
}]
|
54
58
|
],
|
55
59
|
|