mongo 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +2 -0
  5. data/Rakefile +4 -1
  6. data/lib/mongo/address.rb +2 -1
  7. data/lib/mongo/client.rb +6 -51
  8. data/lib/mongo/cluster.rb +34 -4
  9. data/lib/mongo/cluster/reapers/socket_reaper.rb +1 -1
  10. data/lib/mongo/cluster/topology/replica_set.rb +3 -1
  11. data/lib/mongo/collection.rb +6 -6
  12. data/lib/mongo/collection/view.rb +2 -4
  13. data/lib/mongo/cursor.rb +9 -4
  14. data/lib/mongo/error.rb +2 -0
  15. data/lib/mongo/operation/uses_command_op_msg.rb +1 -1
  16. data/lib/mongo/server.rb +3 -0
  17. data/lib/mongo/server/description.rb +1 -1
  18. data/lib/mongo/server/description/features.rb +18 -12
  19. data/lib/mongo/server_selector/selectable.rb +5 -1
  20. data/lib/mongo/session.rb +38 -43
  21. data/lib/mongo/session/session_pool.rb +12 -30
  22. data/lib/mongo/socket.rb +24 -0
  23. data/lib/mongo/socket/tcp.rb +0 -1
  24. data/lib/mongo/uri.rb +26 -5
  25. data/lib/mongo/version.rb +1 -1
  26. data/spec/mongo/address_spec.rb +37 -2
  27. data/spec/mongo/bulk_write_spec.rb +4 -10
  28. data/spec/mongo/change_stream_examples_spec.rb +40 -0
  29. data/spec/mongo/client_spec.rb +47 -12
  30. data/spec/mongo/cluster/topology/replica_set_spec.rb +2 -0
  31. data/spec/mongo/collection/view/aggregation_spec.rb +2 -8
  32. data/spec/mongo/collection/view/change_stream_spec.rb +1 -5
  33. data/spec/mongo/collection/view/map_reduce_spec.rb +2 -8
  34. data/spec/mongo/collection/view/readable_spec.rb +1 -1
  35. data/spec/mongo/collection_spec.rb +11 -29
  36. data/spec/mongo/crud_spec.rb +6 -2
  37. data/spec/mongo/cursor_spec.rb +84 -1
  38. data/spec/mongo/database_spec.rb +2 -8
  39. data/spec/mongo/dns_seedlist_discovery_spec.rb +67 -63
  40. data/spec/mongo/max_staleness_spec.rb +1 -0
  41. data/spec/mongo/retryable_writes_spec.rb +7 -9
  42. data/spec/mongo/sdam_spec.rb +42 -24
  43. data/spec/mongo/server/description/features_spec.rb +3 -3
  44. data/spec/mongo/server_selection_spec.rb +2 -0
  45. data/spec/mongo/server_selector_spec.rb +2 -0
  46. data/spec/mongo/session/session_pool_spec.rb +16 -22
  47. data/spec/mongo/session_spec.rb +13 -8
  48. data/spec/mongo/uri/srv_protocol_spec.rb +481 -478
  49. data/spec/mongo/uri_spec.rb +1 -1
  50. data/spec/spec_helper.rb +11 -63
  51. data/spec/support/authorization.rb +35 -1
  52. data/spec/support/connection_string_tests/invalid-uris.yml +27 -11
  53. data/spec/support/event_subscriber.rb +66 -0
  54. data/spec/support/sdam/rs/compatible.yml +41 -0
  55. data/spec/support/sdam/rs/discover_arbiters.yml +3 -1
  56. data/spec/support/sdam/rs/discover_passives.yml +6 -2
  57. data/spec/support/sdam/rs/discover_primary.yml +3 -1
  58. data/spec/support/sdam/rs/discover_secondary.yml +3 -1
  59. data/spec/support/sdam/rs/discovery.yml +12 -4
  60. data/spec/support/sdam/rs/equal_electionids.yml +6 -2
  61. data/spec/support/sdam/rs/ghost_discovered.yml +3 -1
  62. data/spec/support/sdam/rs/hosts_differ_from_seeds.yml +3 -1
  63. data/spec/support/sdam/rs/ls_timeout.yml +169 -14
  64. data/spec/support/sdam/rs/member_reconfig.yml +6 -2
  65. data/spec/support/sdam/rs/member_standalone.yml +6 -2
  66. data/spec/support/sdam/rs/new_primary.yml +6 -2
  67. data/spec/support/sdam/rs/new_primary_new_electionid.yml +9 -3
  68. data/spec/support/sdam/rs/new_primary_new_setversion.yml +9 -3
  69. data/spec/support/sdam/rs/new_primary_wrong_set_name.yml +6 -2
  70. data/spec/support/sdam/rs/non_rs_member.yml +3 -2
  71. data/spec/support/sdam/rs/normalize_case.yml +3 -1
  72. data/spec/support/sdam/rs/null_election_id.yml +12 -4
  73. data/spec/support/sdam/rs/primary_becomes_standalone.yml +6 -4
  74. data/spec/support/sdam/rs/primary_changes_set_name.yml +6 -2
  75. data/spec/support/sdam/rs/primary_disconnect.yml +3 -1
  76. data/spec/support/sdam/rs/primary_disconnect_electionid.yml +15 -5
  77. data/spec/support/sdam/rs/primary_disconnect_setversion.yml +15 -5
  78. data/spec/support/sdam/rs/primary_hint_from_secondary_with_mismatched_me.yml +6 -2
  79. data/spec/support/sdam/rs/primary_mismatched_me.yml +26 -37
  80. data/spec/support/sdam/rs/primary_reports_new_member.yml +12 -4
  81. data/spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml +6 -2
  82. data/spec/support/sdam/rs/primary_wrong_set_name.yml +3 -1
  83. data/spec/support/sdam/rs/response_from_removed.yml +6 -2
  84. data/spec/support/sdam/rs/rsother_discovered.yml +6 -2
  85. data/spec/support/sdam/rs/sec_not_auth.yml +6 -2
  86. data/spec/support/sdam/rs/secondary_mismatched_me.yml +26 -37
  87. data/spec/support/sdam/rs/secondary_wrong_set_name.yml +3 -1
  88. data/spec/support/sdam/rs/secondary_wrong_set_name_with_primary.yml +6 -2
  89. data/spec/support/sdam/rs/setversion_without_electionid.yml +6 -2
  90. data/spec/support/sdam/rs/stepdown_change_set_name.yml +6 -2
  91. data/spec/support/sdam/rs/too_new.yml +41 -0
  92. data/spec/support/sdam/rs/too_old.yml +39 -0
  93. data/spec/support/sdam/rs/unexpected_mongos.yml +3 -1
  94. data/spec/support/sdam/rs/use_setversion_without_electionid.yml +9 -3
  95. data/spec/support/sdam/rs/wrong_set_name.yml +3 -1
  96. data/spec/support/server_discovery_and_monitoring.rb +13 -0
  97. data/spec/support/shared/session.rb +10 -30
  98. metadata +10 -2
  99. metadata.gz.sig +0 -0
@@ -14,7 +14,9 @@ phases: [
14
14
  setName: "rs",
15
15
  hosts: ["A:27017"],
16
16
  passives: ["B:27017"],
17
- arbiters: ["C:27017"]
17
+ arbiters: ["C:27017"],
18
+ minWireVersion: 0,
19
+ maxWireVersion: 6
18
20
  }]
19
21
  ],
20
22
 
@@ -12,7 +12,9 @@ phases: [
12
12
  ismaster: true,
13
13
  hosts: ["a:27017", "b:27017", "c:27017"],
14
14
  setVersion: 1,
15
- setName: "rs"
15
+ setName: "rs",
16
+ minWireVersion: 0,
17
+ maxWireVersion: 6
16
18
  }]
17
19
  ],
18
20
 
@@ -50,7 +52,9 @@ phases: [
50
52
  hosts: ["a:27017", "b:27017", "c:27017"],
51
53
  setName: "rs",
52
54
  setVersion: 1,
53
- electionId: {"$oid": "000000000000000000000002"}
55
+ electionId: {"$oid": "000000000000000000000002"},
56
+ minWireVersion: 0,
57
+ maxWireVersion: 6
54
58
  }]
55
59
  ],
56
60
 
@@ -87,7 +91,9 @@ phases: [
87
91
  ismaster: true,
88
92
  hosts: ["a:27017", "b:27017", "c:27017"],
89
93
  setVersion: 1,
90
- setName: "rs"
94
+ setName: "rs",
95
+ minWireVersion: 0,
96
+ maxWireVersion: 6
91
97
  }]
92
98
  ],
93
99
  outcome: {
@@ -125,7 +131,9 @@ phases: [
125
131
  hosts: ["a:27017", "b:27017", "c:27017"],
126
132
  setName: "rs",
127
133
  setVersion: 1,
128
- electionId: {"$oid": "000000000000000000000001"}
134
+ electionId: {"$oid": "000000000000000000000001"},
135
+ minWireVersion: 0,
136
+ maxWireVersion: 6
129
137
  }]
130
138
  ],
131
139
  outcome: {
@@ -12,7 +12,9 @@ phases: [
12
12
  ok: 1,
13
13
  ismaster: true,
14
14
  hosts: ["a:27017"],
15
- setName: "rs"
15
+ setName: "rs",
16
+ minWireVersion: 0,
17
+ maxWireVersion: 6
16
18
  }]
17
19
  ],
18
20
 
@@ -34,10 +36,10 @@ phases: [
34
36
 
35
37
  {
36
38
  responses: [
37
-
38
39
  ["a:27017", {
39
-
40
- ok: 1
40
+ ok: 1,
41
+ minWireVersion: 0,
42
+ maxWireVersion: 6
41
43
  }]
42
44
  ],
43
45
 
@@ -13,7 +13,9 @@ phases: [
13
13
  ok: 1,
14
14
  ismaster: true,
15
15
  hosts: ["a:27017"],
16
- setName: "rs"
16
+ setName: "rs",
17
+ minWireVersion: 0,
18
+ maxWireVersion: 6
17
19
  }]
18
20
  ],
19
21
 
@@ -42,7 +44,9 @@ phases: [
42
44
  ok: 1,
43
45
  ismaster: true,
44
46
  hosts: ["a:27017"],
45
- setName: "wrong"
47
+ setName: "wrong",
48
+ minWireVersion: 0,
49
+ maxWireVersion: 6
46
50
  }]
47
51
  ],
48
52
 
@@ -12,7 +12,9 @@ phases: [
12
12
  ok: 1,
13
13
  ismaster: true,
14
14
  hosts: ["a:27017"],
15
- setName: "rs"
15
+ setName: "rs",
16
+ minWireVersion: 0,
17
+ maxWireVersion: 6
16
18
  }]
17
19
  ],
18
20
 
@@ -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": "000000000000000000000002"}
26
+ electionId: {"$oid": "000000000000000000000002"},
27
+ minWireVersion: 0,
28
+ maxWireVersion: 6
25
29
  }]
26
30
  ],
27
31
 
@@ -78,7 +82,9 @@ phases: [
78
82
  hosts: ["a:27017", "b:27017"],
79
83
  setName: "rs",
80
84
  setVersion: 1,
81
- electionId: {"$oid": "000000000000000000000001"}
85
+ electionId: {"$oid": "000000000000000000000001"},
86
+ minWireVersion: 0,
87
+ maxWireVersion: 6
82
88
  }]
83
89
  ],
84
90
  outcome: {
@@ -109,7 +115,9 @@ phases: [
109
115
  hosts: ["a:27017", "b:27017"],
110
116
  setName: "rs",
111
117
  setVersion: 1,
112
- electionId: {"$oid": "000000000000000000000003"}
118
+ electionId: {"$oid": "000000000000000000000003"},
119
+ minWireVersion: 0,
120
+ maxWireVersion: 6
113
121
  }]
114
122
  ],
115
123
  outcome: {
@@ -140,7 +148,9 @@ phases: [
140
148
  ismaster: false,
141
149
  secondary: true,
142
150
  hosts: ["a:27017", "b:27017"],
143
- setName: "rs"
151
+ setName: "rs",
152
+ minWireVersion: 0,
153
+ maxWireVersion: 6
144
154
  }]
145
155
  ],
146
156
  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
  ["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: 2,
24
- electionId: {"$oid": "000000000000000000000001"}
26
+ electionId: {"$oid": "000000000000000000000001"},
27
+ minWireVersion: 0,
28
+ maxWireVersion: 6
25
29
  }]
26
30
  ],
27
31
 
@@ -78,7 +82,9 @@ phases: [
78
82
  hosts: ["a:27017", "b:27017"],
79
83
  setName: "rs",
80
84
  setVersion: 1,
81
- electionId: {"$oid": "000000000000000000000001"}
85
+ electionId: {"$oid": "000000000000000000000001"},
86
+ minWireVersion: 0,
87
+ maxWireVersion: 6
82
88
  }]
83
89
  ],
84
90
  outcome: {
@@ -109,7 +115,9 @@ phases: [
109
115
  hosts: ["a:27017", "b:27017"],
110
116
  setName: "rs",
111
117
  setVersion: 2,
112
- electionId: {"$oid": "000000000000000000000002"}
118
+ electionId: {"$oid": "000000000000000000000002"},
119
+ minWireVersion: 0,
120
+ maxWireVersion: 6
113
121
  }]
114
122
  ],
115
123
  outcome: {
@@ -140,7 +148,9 @@ phases: [
140
148
  ismaster: false,
141
149
  secondary: true,
142
150
  hosts: ["a:27017", "b:27017"],
143
- setName: "rs"
151
+ setName: "rs",
152
+ minWireVersion: 0,
153
+ maxWireVersion: 6
144
154
  }]
145
155
  ],
146
156
  outcome: {
@@ -14,7 +14,9 @@ phases: [
14
14
  me: "c:27017",
15
15
  hosts: ["b:27017"],
16
16
  setName: "rs",
17
- primary: "b:27017"
17
+ primary: "b:27017",
18
+ minWireVersion: 0,
19
+ maxWireVersion: 6
18
20
  }]
19
21
  ],
20
22
 
@@ -39,7 +41,9 @@ phases: [
39
41
  ismaster: true,
40
42
  me: "b:27017",
41
43
  hosts: ["b:27017"],
42
- setName: "rs"
44
+ setName: "rs",
45
+ minWireVersion: 0,
46
+ maxWireVersion: 6
43
47
  }]
44
48
  ],
45
49
 
@@ -1,37 +1,26 @@
1
- {
2
- "description": "Primary mismatched me",
3
- "phases": [
4
- {
5
- "outcome": {
6
- "servers": {
7
- "a:27017": {
8
- "setName": null,
9
- "type": "Unknown"
10
- },
11
- "b:27017": {
12
- "setName": null,
13
- "type": "Unknown"
14
- }
15
- },
16
- "setName": "rs",
17
- "topologyType": "ReplicaSetNoPrimary"
18
- },
19
- "responses": [
20
- [
21
- "localhost:27017",
22
- {
23
- "me": "a:27017",
24
- "hosts": [
25
- "a:27017",
26
- "b:27017"
27
- ],
28
- "ismaster": true,
29
- "ok": 1,
30
- "setName": "rs"
31
- }
32
- ]
33
- ]
34
- }
35
- ],
36
- "uri": "mongodb://localhost:27017/?replicaSet=rs"
37
- }
1
+ description: Primary mismatched me
2
+ phases:
3
+ - outcome:
4
+ servers:
5
+ 'a:27017':
6
+ setName: null
7
+ type: Unknown
8
+ 'b:27017':
9
+ setName: null
10
+ type: Unknown
11
+ setName: rs
12
+ topologyType: ReplicaSetNoPrimary
13
+ logicalSessionTimeoutMinutes: null
14
+ responses:
15
+ - - 'localhost:27017'
16
+ - me: 'a:27017'
17
+ hosts:
18
+ - 'a:27017'
19
+ - 'b:27017'
20
+ ismaster: true
21
+ ok: 1
22
+ setName: rs
23
+ minWireVersion: 0
24
+ maxWireVersion: 6
25
+ uri: 'mongodb://localhost:27017/?replicaSet=rs'
26
+
@@ -14,7 +14,9 @@ phases: [
14
14
  ismaster: false,
15
15
  secondary: true,
16
16
  setName: "rs",
17
- hosts: ["a:27017", "b:27017"]
17
+ hosts: ["a:27017", "b:27017"],
18
+ minWireVersion: 0,
19
+ maxWireVersion: 6
18
20
  }]
19
21
  ],
20
22
 
@@ -49,7 +51,9 @@ phases: [
49
51
  ok: 1,
50
52
  ismaster: true,
51
53
  setName: "rs",
52
- hosts: ["a:27017", "b:27017"]
54
+ hosts: ["a:27017", "b:27017"],
55
+ minWireVersion: 0,
56
+ maxWireVersion: 6
53
57
  }]
54
58
  ],
55
59
 
@@ -84,7 +88,9 @@ phases: [
84
88
  ok: 1,
85
89
  ismaster: true,
86
90
  setName: "rs",
87
- hosts: ["a:27017", "b:27017", "c:27017"]
91
+ hosts: ["a:27017", "b:27017", "c:27017"],
92
+ minWireVersion: 0,
93
+ maxWireVersion: 6
88
94
  }]
89
95
  ],
90
96
 
@@ -128,7 +134,9 @@ phases: [
128
134
  secondary: true,
129
135
  setName: "rs",
130
136
  primary: "b:27017",
131
- hosts: ["a:27017", "b:27017", "c:27017"]
137
+ hosts: ["a:27017", "b:27017", "c:27017"],
138
+ minWireVersion: 0,
139
+ maxWireVersion: 6
132
140
  }]
133
141
  ],
134
142
 
@@ -13,7 +13,9 @@ phases: [
13
13
  ismaster: true,
14
14
  hosts: ["a:27017", "b:27017"],
15
15
  me: "a:27017",
16
- setName: "rs"
16
+ setName: "rs",
17
+ minWireVersion: 0,
18
+ maxWireVersion: 6
17
19
  }]
18
20
  ],
19
21
 
@@ -47,7 +49,9 @@ phases: [
47
49
  ismaster: true,
48
50
  hosts: ["c:27017", "d:27017"],
49
51
  me : "c:27017",
50
- setName: "rs"
52
+ setName: "rs",
53
+ minWireVersion: 0,
54
+ maxWireVersion: 6
51
55
  }]
52
56
  ],
53
57
 
@@ -12,7 +12,9 @@ phases: [
12
12
  ok: 1,
13
13
  ismaster: true,
14
14
  hosts: ["a:27017"],
15
- setName: "wrong"
15
+ setName: "wrong",
16
+ minWireVersion: 0,
17
+ maxWireVersion: 6
16
18
  }]
17
19
  ],
18
20
 
@@ -12,7 +12,9 @@ phases: [
12
12
  ok: 1,
13
13
  ismaster: true,
14
14
  setName: "rs",
15
- hosts: ["a:27017"]
15
+ hosts: ["a:27017"],
16
+ minWireVersion: 0,
17
+ maxWireVersion: 6
16
18
  }]
17
19
  ],
18
20
 
@@ -41,7 +43,9 @@ phases: [
41
43
  ismaster: false,
42
44
  secondary: true,
43
45
  setName: "rs",
44
- hosts: ["a:27017", "b:27017"]
46
+ hosts: ["a:27017", "b:27017"],
47
+ minWireVersion: 0,
48
+ maxWireVersion: 6
45
49
  }]
46
50
  ],
47
51
 
@@ -14,7 +14,9 @@ phases: [
14
14
  secondary: true,
15
15
  hidden: true,
16
16
  hosts: ["c:27017", "d:27017"],
17
- setName: "rs"
17
+ setName: "rs",
18
+ minWireVersion: 0,
19
+ maxWireVersion: 6
18
20
  }],
19
21
  ["b:27017", {
20
22
 
@@ -22,7 +24,9 @@ phases: [
22
24
  ismaster: false,
23
25
  secondary: false,
24
26
  hosts: ["c:27017", "d:27017"],
25
- setName: "rs"
27
+ setName: "rs",
28
+ minWireVersion: 0,
29
+ maxWireVersion: 6
26
30
  }]
27
31
  ],
28
32
 
@@ -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
  ["b:27017", {
@@ -21,7 +23,9 @@ phases: [
21
23
  ismaster: false,
22
24
  secondary: true,
23
25
  setName: "rs",
24
- hosts: ["b:27017", "c:27017"]
26
+ hosts: ["b:27017", "c:27017"],
27
+ minWireVersion: 0,
28
+ maxWireVersion: 6
25
29
  }]
26
30
  ],
27
31