mongo 2.2.1 → 2.2.2

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +1 -0
  4. data/lib/mongo/bson.rb +1 -1
  5. data/lib/mongo/cluster/topology/replica_set.rb +21 -4
  6. data/lib/mongo/collection/view/readable.rb +0 -1
  7. data/lib/mongo/error/operation_failure.rb +3 -1
  8. data/lib/mongo/grid/file.rb +14 -11
  9. data/lib/mongo/grid/file/chunk.rb +12 -10
  10. data/lib/mongo/grid/fs_bucket.rb +2 -2
  11. data/lib/mongo/grid/stream/read.rb +1 -1
  12. data/lib/mongo/grid/stream/write.rb +5 -5
  13. data/lib/mongo/options/mapper.rb +17 -0
  14. data/lib/mongo/protocol/message.rb +1 -1
  15. data/lib/mongo/server/connection.rb +3 -25
  16. data/lib/mongo/server/description.rb +19 -2
  17. data/lib/mongo/version.rb +1 -1
  18. data/lib/mongo/write_concern/normalizable.rb +2 -1
  19. data/spec/mongo/client_spec.rb +1 -1
  20. data/spec/mongo/collection/view/readable_spec.rb +18 -0
  21. data/spec/mongo/grid/file/chunk_spec.rb +1 -0
  22. data/spec/mongo/grid/file_spec.rb +25 -6
  23. data/spec/mongo/grid/stream/write_spec.rb +11 -0
  24. data/spec/mongo/protocol/reply_spec.rb +13 -0
  25. data/spec/mongo/server/connection_spec.rb +4 -4
  26. data/spec/mongo/write_concern_spec.rb +15 -0
  27. data/spec/support/command_monitoring.rb +3 -0
  28. data/spec/support/sdam/rs/equal_electionids.yml +4 -0
  29. data/spec/support/sdam/rs/new_primary_new_electionid.yml +7 -1
  30. data/spec/support/sdam/rs/new_primary_new_setversion.yml +101 -0
  31. data/spec/support/sdam/rs/null_election_id.yml +8 -1
  32. data/spec/support/sdam/rs/primary_disconnect_electionid.yml +37 -1
  33. data/spec/support/sdam/rs/primary_disconnect_setversion.yml +160 -0
  34. data/spec/support/sdam/rs/set_version_without_electionid.yml +69 -0
  35. data/spec/support/sdam/rs/setversion_without_electionid.yml +69 -0
  36. data/spec/support/sdam/rs/use_setversion_without_electionid.yml +99 -0
  37. metadata +36 -5
  38. metadata.gz.sig +1 -0
  39. data/lib/csasl/csasl.bundle +0 -0
@@ -0,0 +1,160 @@
1
+ description: "Disconnected from primary, reject primary with stale setVersion"
2
+
3
+ uri: "mongodb://a/?replicaSet=rs"
4
+
5
+ phases: [
6
+
7
+ # A is elected, then B after a reconfig.
8
+ {
9
+ responses: [
10
+ ["a:27017", {
11
+ ok: 1,
12
+ ismaster: true,
13
+ hosts: ["a:27017", "b:27017"],
14
+ setName: "rs",
15
+ setVersion: 1,
16
+ electionId: {"$oid": "000000000000000000000001"}
17
+ }],
18
+ ["b:27017", {
19
+ ok: 1,
20
+ ismaster: true,
21
+ hosts: ["a:27017", "b:27017"],
22
+ setName: "rs",
23
+ setVersion: 2,
24
+ electionId: {"$oid": "000000000000000000000001"}
25
+ }]
26
+ ],
27
+
28
+ outcome: {
29
+ servers: {
30
+ "a:27017": {
31
+ type: "Unknown",
32
+ setName: ,
33
+ electionId:
34
+ },
35
+ "b:27017": {
36
+ type: "RSPrimary",
37
+ setName: "rs",
38
+ setVersion: 2,
39
+ electionId: {"$oid": "000000000000000000000001"}
40
+ }
41
+ },
42
+ topologyType: "ReplicaSetWithPrimary",
43
+ setName: "rs",
44
+ }
45
+ },
46
+
47
+ # Disconnected from B.
48
+ {
49
+ responses: [
50
+ ["b:27017", {}]
51
+ ],
52
+ outcome: {
53
+ servers: {
54
+ "a:27017": {
55
+ type: "Unknown",
56
+ setName: ,
57
+ electionId:
58
+ },
59
+ "b:27017": {
60
+ type: "Unknown",
61
+ setName: ,
62
+ electionId:
63
+ }
64
+ },
65
+ topologyType: "ReplicaSetNoPrimary",
66
+ setName: "rs",
67
+ }
68
+ },
69
+
70
+ # A still claims to be primary but it's ignored.
71
+ {
72
+ responses: [
73
+ ["a:27017", {
74
+ ok: 1,
75
+ ismaster: true,
76
+ hosts: ["a:27017", "b:27017"],
77
+ setName: "rs",
78
+ setVersion: 1,
79
+ electionId: {"$oid": "000000000000000000000001"}
80
+ }]
81
+ ],
82
+ outcome: {
83
+ servers: {
84
+ "a:27017": {
85
+ type: "Unknown",
86
+ setName: ,
87
+ electionId:
88
+ },
89
+ "b:27017": {
90
+ type: "Unknown",
91
+ setName: ,
92
+ electionId:
93
+ }
94
+ },
95
+ topologyType: "ReplicaSetNoPrimary",
96
+ setName: "rs",
97
+ }
98
+ },
99
+
100
+ # Now A is re-elected.
101
+ {
102
+ responses: [
103
+ ["a:27017", {
104
+ ok: 1,
105
+ ismaster: true,
106
+ hosts: ["a:27017", "b:27017"],
107
+ setName: "rs",
108
+ setVersion: 2,
109
+ electionId: {"$oid": "000000000000000000000002"}
110
+ }]
111
+ ],
112
+ outcome: {
113
+ servers: {
114
+ "a:27017": {
115
+ type: "RSPrimary",
116
+ setName: "rs",
117
+ setVersion: 2,
118
+ electionId: {"$oid": "000000000000000000000002"}
119
+ },
120
+ "b:27017": {
121
+ type: "Unknown",
122
+ setName: ,
123
+ electionId:
124
+ }
125
+ },
126
+ topologyType: "ReplicaSetWithPrimary",
127
+ setName: "rs",
128
+ }
129
+ },
130
+
131
+ # B comes back as secondary.
132
+ {
133
+ responses: [
134
+ ["b:27017", {
135
+ ok: 1,
136
+ ismaster: false,
137
+ secondary: true,
138
+ hosts: ["a:27017", "b:27017"],
139
+ setName: "rs",
140
+ setVersion: 2
141
+ }]
142
+ ],
143
+ outcome: {
144
+ servers: {
145
+ "a:27017": {
146
+ type: "RSPrimary",
147
+ setName: "rs",
148
+ setVersion: 2,
149
+ electionId: {"$oid": "000000000000000000000002"}
150
+ },
151
+ "b:27017": {
152
+ type: "RSSecondary",
153
+ setName: "rs"
154
+ }
155
+ },
156
+ topologyType: "ReplicaSetWithPrimary",
157
+ setName: "rs",
158
+ }
159
+ }
160
+ ]
@@ -0,0 +1,69 @@
1
+ description: "setVersion is ignored if there is no electionId"
2
+
3
+ uri: "mongodb://a/?replicaSet=rs"
4
+
5
+ phases: [
6
+
7
+ # Primary A is discovered and tells us about B.
8
+ {
9
+ responses: [
10
+ ["a:27017", {
11
+ ok: 1,
12
+ ismaster: true,
13
+ hosts: ["a:27017", "b:27017"],
14
+ setName: "rs",
15
+ setVersion: 2
16
+ }]
17
+ ],
18
+
19
+ outcome: {
20
+ servers: {
21
+ "a:27017": {
22
+ type: "RSPrimary",
23
+ setName: "rs",
24
+ setVersion: 2 ,
25
+ electionId:
26
+ },
27
+ "b:27017": {
28
+ type: "Unknown",
29
+ setName: ,
30
+ electionId:
31
+ }
32
+ },
33
+ topologyType: "ReplicaSetWithPrimary",
34
+ setName: "rs",
35
+ }
36
+ },
37
+
38
+ # B is elected, its setVersion is older but we believe it anyway, because
39
+ # setVersion is only used in conjunction with electionId.
40
+ {
41
+ responses: [
42
+ ["b:27017", {
43
+ ok: 1,
44
+ ismaster: true,
45
+ hosts: ["a:27017", "b:27017"],
46
+ setName: "rs",
47
+ setVersion: 1
48
+ }]
49
+ ],
50
+
51
+ outcome: {
52
+ servers: {
53
+ "a:27017": {
54
+ type: "Unknown",
55
+ setName: ,
56
+ electionId:
57
+ },
58
+ "b:27017": {
59
+ type: "RSPrimary",
60
+ setName: "rs",
61
+ setVersion: 1,
62
+ electionId:
63
+ }
64
+ },
65
+ topologyType: "ReplicaSetWithPrimary",
66
+ setName: "rs",
67
+ }
68
+ }
69
+ ]
@@ -0,0 +1,69 @@
1
+ description: "setVersion is ignored if there is no electionId"
2
+
3
+ uri: "mongodb://a/?replicaSet=rs"
4
+
5
+ phases: [
6
+
7
+ # Primary A is discovered and tells us about B.
8
+ {
9
+ responses: [
10
+ ["a:27017", {
11
+ ok: 1,
12
+ ismaster: true,
13
+ hosts: ["a:27017", "b:27017"],
14
+ setName: "rs",
15
+ setVersion: 2
16
+ }]
17
+ ],
18
+
19
+ outcome: {
20
+ servers: {
21
+ "a:27017": {
22
+ type: "RSPrimary",
23
+ setName: "rs",
24
+ setVersion: 2 ,
25
+ electionId:
26
+ },
27
+ "b:27017": {
28
+ type: "Unknown",
29
+ setName: ,
30
+ electionId:
31
+ }
32
+ },
33
+ topologyType: "ReplicaSetWithPrimary",
34
+ setName: "rs",
35
+ }
36
+ },
37
+
38
+ # B is elected, its setVersion is older but we believe it anyway, because
39
+ # setVersion is only used in conjunction with electionId.
40
+ {
41
+ responses: [
42
+ ["b:27017", {
43
+ ok: 1,
44
+ ismaster: true,
45
+ hosts: ["a:27017", "b:27017"],
46
+ setName: "rs",
47
+ setVersion: 1
48
+ }]
49
+ ],
50
+
51
+ outcome: {
52
+ servers: {
53
+ "a:27017": {
54
+ type: "Unknown",
55
+ setName: ,
56
+ electionId:
57
+ },
58
+ "b:27017": {
59
+ type: "RSPrimary",
60
+ setName: "rs",
61
+ setVersion: 1,
62
+ electionId:
63
+ }
64
+ },
65
+ topologyType: "ReplicaSetWithPrimary",
66
+ setName: "rs",
67
+ }
68
+ }
69
+ ]
@@ -0,0 +1,99 @@
1
+ description: "Record max setVersion, even from primary without electionId"
2
+
3
+ uri: "mongodb://a/?replicaSet=rs"
4
+
5
+ phases: [
6
+
7
+ # Primary A has setVersion and electionId, tells us about B.
8
+ {
9
+ responses: [
10
+ ["a:27017", {
11
+ ok: 1,
12
+ ismaster: true,
13
+ hosts: ["a:27017", "b:27017"],
14
+ setName: "rs",
15
+ setVersion: 1,
16
+ electionId: {"$oid": "000000000000000000000001"}
17
+ }]
18
+ ],
19
+
20
+ outcome: {
21
+ servers: {
22
+ "a:27017": {
23
+ type: "RSPrimary",
24
+ setName: "rs",
25
+ setVersion: 1,
26
+ electionId: {"$oid": "000000000000000000000001"}
27
+ },
28
+ "b:27017": {
29
+ type: "Unknown",
30
+ setName: ,
31
+ electionId:
32
+ }
33
+ },
34
+ topologyType: "ReplicaSetWithPrimary",
35
+ setName: "rs",
36
+ }
37
+ },
38
+
39
+ # Reconfig the set and elect B, it has a new setVersion but no electionId.
40
+ {
41
+ responses: [
42
+ ["b:27017", {
43
+ ok: 1,
44
+ ismaster: true,
45
+ hosts: ["a:27017", "b:27017"],
46
+ setName: "rs",
47
+ setVersion: 2
48
+ }]
49
+ ],
50
+
51
+ outcome: {
52
+ servers: {
53
+ "a:27017": {
54
+ type: "Unknown",
55
+ setName: ,
56
+ electionId:
57
+ },
58
+ "b:27017": {
59
+ type: "RSPrimary",
60
+ setName: "rs",
61
+ setVersion: 2
62
+ }
63
+ },
64
+ topologyType: "ReplicaSetWithPrimary",
65
+ setName: "rs",
66
+ }
67
+ },
68
+
69
+ # Delayed response from A, reporting its reelection. Its setVersion shows
70
+ # the election preceded B's so we ignore it.
71
+ {
72
+ responses: [
73
+ ["a:27017", {
74
+ ok: 1,
75
+ ismaster: true,
76
+ hosts: ["a:27017", "b:27017"],
77
+ setName: "rs",
78
+ setVersion: 1,
79
+ electionId: {"$oid": "000000000000000000000002"}
80
+ }]
81
+ ],
82
+ outcome: {
83
+ servers: {
84
+ "a:27017": {
85
+ type: "Unknown",
86
+ setName: ,
87
+ electionId:
88
+ },
89
+ "b:27017": {
90
+ type: "RSPrimary",
91
+ setName: "rs",
92
+ setVersion: 2
93
+ }
94
+ },
95
+ topologyType: "ReplicaSetWithPrimary",
96
+ setName: "rs",
97
+ }
98
+ }
99
+ ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Brock
@@ -9,8 +9,30 @@ authors:
9
9
  - Durran Jordan
10
10
  autorequire:
11
11
  bindir: bin
12
- cert_chain: []
13
- date: 2015-12-16 00:00:00.000000000 Z
12
+ cert_chain:
13
+ - |
14
+ -----BEGIN CERTIFICATE-----
15
+ MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtkcml2
16
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mtUEbgI5A+N7pakJPUKKK1zXzADflsx51jjP5rZJJltnoVsBBgN
32
+ EhIn2f8suSc9QAqYt7w4T+PMtjxWTVcXs+Uy2PbDtjhtEBz6ZsP6YSsOpJbrCjCV
33
+ wZtXjpRUvWz86V5vjhHCTE8fqfEb85aeDwUCckPzpio=
34
+ -----END CERTIFICATE-----
35
+ date: 2016-01-25 00:00:00.000000000 Z
14
36
  dependencies:
15
37
  - !ruby/object:Gem::Dependency
16
38
  name: bson
@@ -37,7 +59,6 @@ files:
37
59
  - README.md
38
60
  - Rakefile
39
61
  - bin/mongo_console
40
- - lib/csasl/csasl.bundle
41
62
  - lib/mongo.rb
42
63
  - lib/mongo/address.rb
43
64
  - lib/mongo/address/ipv4.rb
@@ -456,6 +477,7 @@ files:
456
477
  - spec/support/sdam/rs/member_standalone.yml
457
478
  - spec/support/sdam/rs/new_primary.yml
458
479
  - spec/support/sdam/rs/new_primary_new_electionid.yml
480
+ - spec/support/sdam/rs/new_primary_new_setversion.yml
459
481
  - spec/support/sdam/rs/new_primary_wrong_set_name.yml
460
482
  - spec/support/sdam/rs/non_rs_member.yml
461
483
  - spec/support/sdam/rs/normalize_case.yml
@@ -464,6 +486,7 @@ files:
464
486
  - spec/support/sdam/rs/primary_changes_set_name.yml
465
487
  - spec/support/sdam/rs/primary_disconnect.yml
466
488
  - spec/support/sdam/rs/primary_disconnect_electionid.yml
489
+ - spec/support/sdam/rs/primary_disconnect_setversion.yml
467
490
  - spec/support/sdam/rs/primary_mismatched_me.yml
468
491
  - spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml
469
492
  - spec/support/sdam/rs/primary_wrong_set_name.yml
@@ -473,8 +496,11 @@ files:
473
496
  - spec/support/sdam/rs/secondary_mismatched_me.yml
474
497
  - spec/support/sdam/rs/secondary_wrong_set_name.yml
475
498
  - spec/support/sdam/rs/secondary_wrong_set_name_with_primary.yml
499
+ - spec/support/sdam/rs/set_version_without_electionid.yml
500
+ - spec/support/sdam/rs/setversion_without_electionid.yml
476
501
  - spec/support/sdam/rs/stepdown_change_set_name.yml
477
502
  - spec/support/sdam/rs/unexpected_mongos.yml
503
+ - spec/support/sdam/rs/use_setversion_without_electionid.yml
478
504
  - spec/support/sdam/rs/wrong_set_name.yml
479
505
  - spec/support/sdam/sharded/mongos_disconnect.yml
480
506
  - spec/support/sdam/sharded/multiple_mongoses.yml
@@ -549,7 +575,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
549
575
  version: '0'
550
576
  requirements: []
551
577
  rubyforge_project:
552
- rubygems_version: 2.4.5.1
578
+ rubygems_version: 2.5.1
553
579
  signing_key:
554
580
  specification_version: 4
555
581
  summary: Ruby driver for MongoDB
@@ -739,6 +765,7 @@ test_files:
739
765
  - spec/support/sdam/rs/member_standalone.yml
740
766
  - spec/support/sdam/rs/new_primary.yml
741
767
  - spec/support/sdam/rs/new_primary_new_electionid.yml
768
+ - spec/support/sdam/rs/new_primary_new_setversion.yml
742
769
  - spec/support/sdam/rs/new_primary_wrong_set_name.yml
743
770
  - spec/support/sdam/rs/non_rs_member.yml
744
771
  - spec/support/sdam/rs/normalize_case.yml
@@ -747,6 +774,7 @@ test_files:
747
774
  - spec/support/sdam/rs/primary_changes_set_name.yml
748
775
  - spec/support/sdam/rs/primary_disconnect.yml
749
776
  - spec/support/sdam/rs/primary_disconnect_electionid.yml
777
+ - spec/support/sdam/rs/primary_disconnect_setversion.yml
750
778
  - spec/support/sdam/rs/primary_mismatched_me.yml
751
779
  - spec/support/sdam/rs/primary_to_no_primary_mismatched_me.yml
752
780
  - spec/support/sdam/rs/primary_wrong_set_name.yml
@@ -756,8 +784,11 @@ test_files:
756
784
  - spec/support/sdam/rs/secondary_mismatched_me.yml
757
785
  - spec/support/sdam/rs/secondary_wrong_set_name.yml
758
786
  - spec/support/sdam/rs/secondary_wrong_set_name_with_primary.yml
787
+ - spec/support/sdam/rs/set_version_without_electionid.yml
788
+ - spec/support/sdam/rs/setversion_without_electionid.yml
759
789
  - spec/support/sdam/rs/stepdown_change_set_name.yml
760
790
  - spec/support/sdam/rs/unexpected_mongos.yml
791
+ - spec/support/sdam/rs/use_setversion_without_electionid.yml
761
792
  - spec/support/sdam/rs/wrong_set_name.yml
762
793
  - spec/support/sdam/sharded/mongos_disconnect.yml
763
794
  - spec/support/sdam/sharded/multiple_mongoses.yml