mongo 1.8.3 → 1.8.4.rc0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/VERSION +1 -1
- data/lib/mongo.rb +11 -0
- data/lib/mongo/collection.rb +54 -49
- data/lib/mongo/cursor.rb +8 -4
- data/lib/mongo/db.rb +107 -112
- data/lib/mongo/mongo_client.rb +18 -14
- data/lib/mongo/mongo_replica_set_client.rb +17 -10
- data/lib/mongo/util/pool.rb +0 -19
- data/lib/mongo/util/pool_manager.rb +0 -21
- data/lib/mongo/util/read_preference.rb +40 -12
- data/lib/mongo/util/uri_parser.rb +2 -2
- data/mongo.gemspec +1 -0
- data/test/auxillary/pool_reuse_test.rb +0 -0
- data/test/bson/object_id_test.rb +7 -1
- data/test/functional/collection_test.rb +24 -1
- data/test/functional/connection_test.rb +7 -7
- data/test/functional/db_api_test.rb +5 -6
- data/test/functional/uri_test.rb +16 -16
- data/test/replica_set/basic_test.rb +1 -1
- data/test/replica_set/pinning_test.rb +41 -0
- data/test/replica_set/refresh_test.rb +0 -0
- data/test/sharded_cluster/basic_test.rb +0 -0
- data/test/unit/client_test.rb +2 -2
- data/test/unit/collection_test.rb +1 -1
- data/test/unit/connection_test.rb +2 -2
- data/test/unit/db_test.rb +0 -1
- data/test/unit/pool_manager_test.rb +0 -0
- metadata +41 -30
- metadata.gz.sig +5 -2
@@ -68,7 +68,7 @@ class BasicTest < Test::Unit::TestCase
|
|
68
68
|
assert_equal 2, client.secondaries.length
|
69
69
|
assert_equal 2, client.secondary_pools.length
|
70
70
|
assert_equal @rs.repl_set_name, client.replica_set_name
|
71
|
-
assert client.secondary_pools.include?(client.read_pool(:secondary))
|
71
|
+
assert client.secondary_pools.include?(client.read_pool({:mode => :secondary}))
|
72
72
|
assert_equal 90, client.refresh_interval
|
73
73
|
assert_equal client.refresh_mode, false
|
74
74
|
client.close
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ReplicaSetPinningTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
ensure_cluster(:rs)
|
6
|
+
@client = MongoReplicaSetClient.new(@rs.repl_set_seeds, :name => @rs.repl_set_name)
|
7
|
+
@db = @client.db(MONGO_TEST_DB)
|
8
|
+
@coll = @db.collection("test-sets")
|
9
|
+
@coll.insert({:a => 1})
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_unpinning
|
13
|
+
# pin primary
|
14
|
+
@coll.find_one
|
15
|
+
assert_equal @client.pinned_pool[:pool], @client.primary_pool
|
16
|
+
|
17
|
+
# pin secondary
|
18
|
+
@coll.find_one({}, :read => :secondary_preferred)
|
19
|
+
assert @client.secondary_pools.include? @client.pinned_pool[:pool]
|
20
|
+
|
21
|
+
# repin primary
|
22
|
+
@coll.find_one({}, :read => :primary_preferred)
|
23
|
+
assert_equal @client.pinned_pool[:pool], @client.primary_pool
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_pinned_pool_is_local_to_thread
|
27
|
+
threads = []
|
28
|
+
30.times do |i|
|
29
|
+
threads << Thread.new do
|
30
|
+
if i % 2 == 0
|
31
|
+
@coll.find_one({}, :read => :secondary_preferred)
|
32
|
+
assert @client.secondary_pools.include? @client.pinned_pool[:pool]
|
33
|
+
else
|
34
|
+
@coll.find_one({}, :read => :primary_preferred)
|
35
|
+
assert_equal @client.pinned_pool[:pool], @client.primary_pool
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
threads.each(&:join)
|
40
|
+
end
|
41
|
+
end
|
File without changes
|
File without changes
|
data/test/unit/client_test.rb
CHANGED
@@ -128,7 +128,7 @@ class ClientTest < Test::Unit::TestCase
|
|
128
128
|
should "parse a uri with a hyphen & underscore in the username or password" do
|
129
129
|
@client = MongoClient.from_uri("mongodb://hyphen-user_name:p-s_s@localhost:27017/db", :connect => false)
|
130
130
|
assert_equal ['localhost', 27017], @client.host_port
|
131
|
-
auth_hash = {
|
131
|
+
auth_hash = { :db_name => 'db', :username => 'hyphen-user_name', :password => 'p-s_s' }
|
132
132
|
assert_equal auth_hash, @client.auths[0]
|
133
133
|
end
|
134
134
|
|
@@ -211,7 +211,7 @@ class ClientTest < Test::Unit::TestCase
|
|
211
211
|
ENV['MONGODB_URI'] = "mongodb://hyphen-user_name:p-s_s@localhost:27017/db?connect=false"
|
212
212
|
@client = MongoClient.new
|
213
213
|
assert_equal ['localhost', 27017], @client.host_port
|
214
|
-
auth_hash = {
|
214
|
+
auth_hash = { :db_name => 'db', :username => 'hyphen-user_name', :password => 'p-s_s' }
|
215
215
|
assert_equal auth_hash, @client.auths[0]
|
216
216
|
end
|
217
217
|
|
@@ -106,7 +106,7 @@ class CollectionTest < Test::Unit::TestCase
|
|
106
106
|
@coll.ensure_index [["x", Mongo::DESCENDING]]
|
107
107
|
end
|
108
108
|
|
109
|
-
should "call generate_indexes for a new
|
109
|
+
should "call generate_indexes for a new type on the same field for ensure_index" do
|
110
110
|
@client = MongoClient.new('localhost', 27017, :logger => @logger, :connect => false)
|
111
111
|
@db = @client['testing']
|
112
112
|
@coll = @db.collection('books')
|
@@ -122,7 +122,7 @@ class ConnectionTest < Test::Unit::TestCase
|
|
122
122
|
should "parse a uri with a hyphen & underscore in the username or password" do
|
123
123
|
@connection = Mongo::Connection.from_uri("mongodb://hyphen-user_name:p-s_s@localhost:27017/db", :connect => false)
|
124
124
|
assert_equal ['localhost', 27017], @connection.host_port
|
125
|
-
auth_hash = {
|
125
|
+
auth_hash = { :db_name => 'db', :username => 'hyphen-user_name', :password => 'p-s_s' }
|
126
126
|
assert_equal auth_hash, @connection.auths[0]
|
127
127
|
end
|
128
128
|
|
@@ -205,7 +205,7 @@ class ConnectionTest < Test::Unit::TestCase
|
|
205
205
|
ENV['MONGODB_URI'] = "mongodb://hyphen-user_name:p-s_s@localhost:27017/db?connect=false"
|
206
206
|
@connection = Mongo::Connection.new
|
207
207
|
assert_equal ['localhost', 27017], @connection.host_port
|
208
|
-
auth_hash = {
|
208
|
+
auth_hash = { :db_name => 'db', :username => 'hyphen-user_name', :password => 'p-s_s' }
|
209
209
|
assert_equal auth_hash, @connection.auths[0]
|
210
210
|
end
|
211
211
|
|
data/test/unit/db_test.rb
CHANGED
@@ -81,7 +81,6 @@ class DBTest < Test::Unit::TestCase
|
|
81
81
|
end
|
82
82
|
|
83
83
|
should "raise an error if collection creation fails" do
|
84
|
-
@db.expects(:collection_names).returns([])
|
85
84
|
@db.expects(:command).returns({'ok' => 0})
|
86
85
|
assert_raise Mongo::MongoDBError do
|
87
86
|
@db.create_collection("foo")
|
File without changes
|
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: 1.8.
|
4
|
+
version: 1.8.4.rc0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -12,28 +12,35 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain:
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
15
|
+
- !binary |-
|
16
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURPRENDQWlDZ0F3SUJB
|
17
|
+
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJDTVJRd0VnWURWUVFEREF0a2Nt
|
18
|
+
bDIKWlhJdGNuVmllVEVWTUJNR0NnbVNKb21UOGl4a0FSa1dCVEV3WjJWdU1S
|
19
|
+
TXdFUVlLQ1pJbWlaUHlMR1FCR1JZRApZMjl0TUI0WERURXpNREl3TVRFME1U
|
20
|
+
RXpOMW9YRFRFME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nQKZEtTUS9SVW5hSEp1eGg4SFd2V3ViUDhFQllU
|
36
|
+
dWYrSTFERm5SdjY0OElGM01SMXRDUXVtVkwwWGNZTXZaY3hCagphL3ArOERv
|
37
|
+
bVdUUXFVZE5iTm9HeXd3anRWQldmRGR3RlY4UG8xWGNOL0F0cElMT0pRZDlK
|
38
|
+
NzdJTklHR0NIeFpvCjZTT0hIYU5rbmxFOUgwdzZxMFNWeFpLWkk4LysyYzQ0
|
39
|
+
N1YwTnJISXcxUWhlMHRBR0o5VjF1M2t5OGd5eGUwU00KOHY3ekxGMlhsaVli
|
40
|
+
ZnVyWUl3a2NYczh5UG44Z2dBcEJJeTliWDZWSnhScy9sMitVdnF6YUhJRmFG
|
41
|
+
eS9GOC9HUApSTlR1WHNWRzVOREFDbzdRCi0tLS0tRU5EIENFUlRJRklDQVRF
|
42
|
+
LS0tLS0K
|
43
|
+
date: 2013-03-19 00:00:00.000000000 Z
|
37
44
|
dependencies:
|
38
45
|
- !ruby/object:Gem::Dependency
|
39
46
|
name: bson
|
@@ -41,14 +48,14 @@ dependencies:
|
|
41
48
|
requirements:
|
42
49
|
- - ~>
|
43
50
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.8.
|
51
|
+
version: 1.8.4.rc0
|
45
52
|
type: :runtime
|
46
53
|
prerelease: false
|
47
54
|
version_requirements: !ruby/object:Gem::Requirement
|
48
55
|
requirements:
|
49
56
|
- - ~>
|
50
57
|
- !ruby/object:Gem::Version
|
51
|
-
version: 1.8.
|
58
|
+
version: 1.8.4.rc0
|
52
59
|
description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
|
53
60
|
email: mongodb-dev@googlegroups.com
|
54
61
|
executables:
|
@@ -135,6 +142,7 @@ files:
|
|
135
142
|
- test/replica_set/count_test.rb
|
136
143
|
- test/replica_set/cursor_test.rb
|
137
144
|
- test/replica_set/insert_test.rb
|
145
|
+
- test/replica_set/pinning_test.rb
|
138
146
|
- test/replica_set/query_test.rb
|
139
147
|
- test/replica_set/read_preference_test.rb
|
140
148
|
- test/replica_set/refresh_test.rb
|
@@ -160,7 +168,8 @@ files:
|
|
160
168
|
- test/unit/util_test.rb
|
161
169
|
- test/unit/write_concern_test.rb
|
162
170
|
homepage: http://www.mongodb.org
|
163
|
-
licenses:
|
171
|
+
licenses:
|
172
|
+
- Apache License Version 2.0
|
164
173
|
metadata: {}
|
165
174
|
post_install_message:
|
166
175
|
rdoc_options: []
|
@@ -168,17 +177,17 @@ require_paths:
|
|
168
177
|
- lib
|
169
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
170
179
|
requirements:
|
171
|
-
- - '>='
|
180
|
+
- - ! '>='
|
172
181
|
- !ruby/object:Gem::Version
|
173
182
|
version: '0'
|
174
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
184
|
requirements:
|
176
|
-
- - '
|
185
|
+
- - ! '>'
|
177
186
|
- !ruby/object:Gem::Version
|
178
|
-
version:
|
187
|
+
version: 1.3.1
|
179
188
|
requirements: []
|
180
189
|
rubyforge_project: mongo
|
181
|
-
rubygems_version: 2.0.
|
190
|
+
rubygems_version: 2.0.3
|
182
191
|
signing_key:
|
183
192
|
specification_version: 4
|
184
193
|
summary: Ruby driver for MongoDB
|
@@ -225,6 +234,7 @@ test_files:
|
|
225
234
|
- test/replica_set/count_test.rb
|
226
235
|
- test/replica_set/cursor_test.rb
|
227
236
|
- test/replica_set/insert_test.rb
|
237
|
+
- test/replica_set/pinning_test.rb
|
228
238
|
- test/replica_set/query_test.rb
|
229
239
|
- test/replica_set/read_preference_test.rb
|
230
240
|
- test/replica_set/refresh_test.rb
|
@@ -249,3 +259,4 @@ test_files:
|
|
249
259
|
- test/unit/safe_test.rb
|
250
260
|
- test/unit/util_test.rb
|
251
261
|
- test/unit/write_concern_test.rb
|
262
|
+
has_rdoc: yard
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
�Է��L�B�Id�5�ao`1�S�7w��P]ډ�g�Y����ٖW�vK��ȩա����O_=H���� ���}vT<y'2���҉�~�h���R�L]��0��l�����
|
2
|
+
(�L�j���ߞw
|
3
|
+
���?B�h�
|
4
|
+
���%�t:��7ە�8R���RT7������s?b�S����>�)0�-��
|
5
|
+
�H���"i��.���3 �n�ݔ
|