mongo 1.10.0 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/VERSION +1 -1
- data/lib/mongo.rb +7 -1
- data/lib/mongo/collection.rb +1 -1
- data/lib/mongo/cursor.rb +1 -1
- data/lib/mongo/db.rb +2 -2
- data/lib/mongo/functional/uri_parser.rb +8 -1
- data/lib/mongo/mongo_replica_set_client.rb +2 -1
- data/lib/mongo/networking.rb +1 -1
- data/mongo.gemspec +6 -1
- data/test/functional/collection_test.rb +2 -1
- data/test/functional/db_test.rb +13 -11
- data/test/functional/uri_test.rb +12 -0
- data/test/helpers/test_unit.rb +7 -0
- data/test/replica_set/basic_test.rb +14 -0
- data/test/replica_set/client_test.rb +5 -1
- data/test/replica_set/cursor_test.rb +3 -0
- data/test/replica_set/max_values_test.rb +6 -0
- metadata +7 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c4b605a3e5313f94d6b6ea757c823eff8474def
|
4
|
+
data.tar.gz: 91e2b48a46fda17e05c59dbec5a2fd8f6ea7ada1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12c90d51b5f44b11721f85e043565238dbfa483301c7448df034516a4facd51aa3c486feb2a4b60e822c9f10f154a2d2ea92bf2aebefa6a33ea8e1c3bf78258f
|
7
|
+
data.tar.gz: 9d3ffaa70dec92c43b5dcc43cc14183a9a7537ed0e2f1526f63e4ff9b2e648e99fff7b280828a0bb0e31d1740df86ba76320c33a24a2181a635028d8b8cae6bc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.10.
|
1
|
+
1.10.1
|
data/lib/mongo.rb
CHANGED
@@ -62,9 +62,15 @@ module Mongo
|
|
62
62
|
BAD_VALUE = 2
|
63
63
|
UNKNOWN_ERROR = 8
|
64
64
|
INVALID_BSON = 22
|
65
|
-
COMMAND_NOT_FOUND = 59
|
66
65
|
WRITE_CONCERN_FAILED = 64
|
67
66
|
MULTIPLE_ERRORS_OCCURRED = 65
|
67
|
+
|
68
|
+
# mongod/s 2.6 and above return code 59 when a command doesn't exist.
|
69
|
+
# mongod versions previous to 2.6 and mongos 2.4.x return no error code
|
70
|
+
# when a command does exist.
|
71
|
+
# mongos versions previous to 2.4.0 return code 13390 when a command
|
72
|
+
# does not exist.
|
73
|
+
COMMAND_NOT_FOUND_CODES = [nil, 59, 13390]
|
68
74
|
end
|
69
75
|
end
|
70
76
|
|
data/lib/mongo/collection.rb
CHANGED
@@ -1130,7 +1130,7 @@ module Mongo
|
|
1130
1130
|
cmd = BSON::OrderedHash[:createIndexes, @name, :indexes, [selector]]
|
1131
1131
|
@db.command(cmd)
|
1132
1132
|
rescue Mongo::OperationFailure => ex
|
1133
|
-
if
|
1133
|
+
if Mongo::ErrorCode::COMMAND_NOT_FOUND_CODES.include?(ex.error_code)
|
1134
1134
|
selector[:ns] = "#{@db.name}.#{@name}"
|
1135
1135
|
send_write(:insert, nil, selector, false, {:w => 1}, Mongo::DB::SYSTEM_INDEX_COLLECTION)
|
1136
1136
|
else
|
data/lib/mongo/cursor.rb
CHANGED
@@ -139,7 +139,7 @@ module Mongo
|
|
139
139
|
doc = @cache.shift
|
140
140
|
|
141
141
|
if doc && (err = doc['errmsg'] || doc['$err']) # assignment
|
142
|
-
code = doc['code']
|
142
|
+
code = doc['code'] || doc['assertionCode']
|
143
143
|
|
144
144
|
# If the server has stopped being the master (e.g., it's one of a
|
145
145
|
# pair but it has died or something like that) then we close that
|
data/lib/mongo/db.rb
CHANGED
@@ -225,7 +225,7 @@ module Mongo
|
|
225
225
|
# MongoDB 2.4.7 so we assume that a nil error code means the usersInfo
|
226
226
|
# command doesn't exist and we should fall back to the legacy add user code.
|
227
227
|
rescue OperationFailure => ex
|
228
|
-
raise ex unless
|
228
|
+
raise ex unless Mongo::ErrorCode::COMMAND_NOT_FOUND_CODES.include?(ex.error_code)
|
229
229
|
return legacy_add_user(username, password, read_only, opts)
|
230
230
|
end
|
231
231
|
|
@@ -246,7 +246,7 @@ module Mongo
|
|
246
246
|
begin
|
247
247
|
command(:dropUser => username)
|
248
248
|
rescue OperationFailure => ex
|
249
|
-
raise ex unless
|
249
|
+
raise ex unless Mongo::ErrorCode::COMMAND_NOT_FOUND_CODES.include?(ex.error_code)
|
250
250
|
response = self[SYSTEM_USER_COLLECTION].remove({:user => username}, :w => 1)
|
251
251
|
response.key?('n') && response['n'] > 0 ? response : false
|
252
252
|
end
|
@@ -125,6 +125,12 @@ module Mongo
|
|
125
125
|
:wtimeoutms => lambda { |arg| arg.to_i }
|
126
126
|
}
|
127
127
|
|
128
|
+
OPT_CASE_SENSITIVE = [ :authsource,
|
129
|
+
:gssapiservicename,
|
130
|
+
:replicaset,
|
131
|
+
:w
|
132
|
+
]
|
133
|
+
|
128
134
|
attr_reader :auths,
|
129
135
|
:authmechanism,
|
130
136
|
:authsource,
|
@@ -348,7 +354,8 @@ module Mongo
|
|
348
354
|
|
349
355
|
opts = CGI.parse(string_opts).inject({}) do |memo, (key, value)|
|
350
356
|
value = value.first
|
351
|
-
|
357
|
+
key_sym = key.downcase.to_sym
|
358
|
+
memo[key_sym] = OPT_CASE_SENSITIVE.include?(key_sym) ? value.strip : value.strip.downcase
|
352
359
|
memo
|
353
360
|
end
|
354
361
|
|
@@ -471,7 +471,8 @@ module Mongo
|
|
471
471
|
end
|
472
472
|
|
473
473
|
def max_write_batch_size
|
474
|
-
local_manager && local_manager.primary_pool && local_manager.primary_pool.node.max_write_batch_size
|
474
|
+
local_manager && local_manager.primary_pool && local_manager.primary_pool.node.max_write_batch_size ||
|
475
|
+
DEFAULT_MAX_WRITE_BATCH_SIZE
|
475
476
|
end
|
476
477
|
|
477
478
|
private
|
data/lib/mongo/networking.rb
CHANGED
@@ -100,7 +100,7 @@ module Mongo
|
|
100
100
|
if error && error.include?("not master")
|
101
101
|
close
|
102
102
|
raise ConnectionFailure.new(docs[0]['code'].to_s + ': ' + error, docs[0]['code'], docs[0])
|
103
|
-
elsif (note = docs[0]['jnote'] || docs[0]['wnote']) # assignment
|
103
|
+
elsif (!error.nil? && note = docs[0]['jnote'] || docs[0]['wnote']) # assignment
|
104
104
|
code = docs[0]['code'] || Mongo::ErrorCode::BAD_VALUE # as of server version 2.5.5
|
105
105
|
raise WriteConcernError.new(code.to_s + ': ' + note, code, docs[0])
|
106
106
|
elsif error
|
data/mongo.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
|
4
4
|
s.version = File.read(File.join(File.dirname(__FILE__), 'VERSION'))
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
|
-
s.authors = ['
|
6
|
+
s.authors = ['Emily Stolfo', 'Durran Jordan', 'Gary Murakami', 'Tyler Brock', 'Brandon Black']
|
7
7
|
s.email = 'mongodb-dev@googlegroups.com'
|
8
8
|
s.homepage = 'http://www.mongodb.org'
|
9
9
|
s.summary = 'Ruby driver for MongoDB'
|
@@ -22,6 +22,11 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.files += ['README.md', 'Rakefile', 'bin/mongo_console']
|
23
23
|
s.files += ['lib/mongo.rb'] + Dir['lib/mongo/**/*.rb']
|
24
24
|
|
25
|
+
if RUBY_PLATFORM =~ /java/
|
26
|
+
s.platform = 'java'
|
27
|
+
s.files << 'ext/jsasl/target/jsasl.jar'
|
28
|
+
end
|
29
|
+
|
25
30
|
s.test_files = Dir['test/**/*.rb'] - Dir['test/bson/*']
|
26
31
|
s.executables = ['mongo_console']
|
27
32
|
s.require_paths = ['lib']
|
@@ -855,11 +855,12 @@ class CollectionTest < Test::Unit::TestCase
|
|
855
855
|
end
|
856
856
|
end
|
857
857
|
|
858
|
-
def
|
858
|
+
def test_wnote_raises_exception_with_err_not_nil
|
859
859
|
ex = assert_raise Mongo::WriteConcernError do
|
860
860
|
@@test.insert({:foo => 1}, :w => 2)
|
861
861
|
end
|
862
862
|
result = ex.result
|
863
|
+
assert_not_nil result["err"]
|
863
864
|
assert_true result.has_key?("wnote")
|
864
865
|
end
|
865
866
|
end
|
data/test/functional/db_test.rb
CHANGED
@@ -189,7 +189,7 @@ class DBTest < Test::Unit::TestCase
|
|
189
189
|
@@db.command(command)
|
190
190
|
rescue => ex
|
191
191
|
raised = true
|
192
|
-
assert ex.message.include?("forced error"),
|
192
|
+
assert ex.message.include?("forced error") || ex.result.has_key?("assertion") && ex.result["assertion"].include?("forced error"),
|
193
193
|
"error message does not contain 'forced error'"
|
194
194
|
assert_equal 10038, ex.error_code
|
195
195
|
|
@@ -319,16 +319,18 @@ class DBTest < Test::Unit::TestCase
|
|
319
319
|
end
|
320
320
|
|
321
321
|
should "return profiling info" do
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
322
|
+
if @@version >= "2.2"
|
323
|
+
@db.profiling_level = :all
|
324
|
+
@coll.find()
|
325
|
+
@db.profiling_level = :off
|
326
|
+
|
327
|
+
info = @db.profiling_info
|
328
|
+
assert_kind_of Array, info
|
329
|
+
assert info.length >= 1
|
330
|
+
first = info.first
|
331
|
+
assert_kind_of Time, first['ts']
|
332
|
+
assert_kind_of Numeric, first['millis']
|
333
|
+
end
|
332
334
|
end
|
333
335
|
|
334
336
|
should "validate collection" do
|
data/test/functional/uri_test.rb
CHANGED
@@ -327,4 +327,16 @@ class URITest < Test::Unit::TestCase
|
|
327
327
|
assert_equal true, parser.auths.first[:extra][:canonicalize_host_name]
|
328
328
|
end
|
329
329
|
|
330
|
+
def test_opts_case_sensitivity
|
331
|
+
# options gssapiservicename, authsource, replicaset, w should be case sensitive
|
332
|
+
uri = "mongodb://localhost?gssapiServiceName=MongoDB;" +
|
333
|
+
"authSource=FooBar;" +
|
334
|
+
"replicaSet=Foo;" +
|
335
|
+
"w=Majority"
|
336
|
+
parser = Mongo::URIParser.new(uri)
|
337
|
+
assert_equal 'MongoDB', parser.gssapiservicename
|
338
|
+
assert_equal 'FooBar', parser.authsource
|
339
|
+
assert_equal 'Foo', parser.replicaset
|
340
|
+
assert_equal :Majority, parser.w
|
341
|
+
end
|
330
342
|
end
|
data/test/helpers/test_unit.rb
CHANGED
@@ -306,6 +306,13 @@ class Test::Unit::TestCase
|
|
306
306
|
def batch_commands?(wire_version)
|
307
307
|
wire_version >= Mongo::MongoClient::BATCH_COMMANDS
|
308
308
|
end
|
309
|
+
|
310
|
+
def subject_to_server_4754?(client)
|
311
|
+
# Until SERVER-4754 is resolved, profiling info is not collected
|
312
|
+
# when mongod is started with --auth in versions < 2.2
|
313
|
+
cmd_line_args = client['admin'].command({ :getCmdLineOpts => 1 })['parsed']
|
314
|
+
client.server_version < '2.2' && cmd_line_args.include?('auth')
|
315
|
+
end
|
309
316
|
end
|
310
317
|
|
311
318
|
# Before and after hooks for the entire test run
|
@@ -100,6 +100,20 @@ class ReplicaSetBasicTest < Test::Unit::TestCase
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
+
def test_wnote_does_not_raise_exception_with_err_nil
|
104
|
+
@client = MongoReplicaSetClient.new(@rs.repl_set_seeds, :name => @rs.repl_set_name)
|
105
|
+
if @client.server_version < '2.5.5'
|
106
|
+
@coll = @client[TEST_DB]['test-wnote']
|
107
|
+
begin
|
108
|
+
result = @coll.remove({:foo => 1}, :w => 2)
|
109
|
+
rescue => ex
|
110
|
+
assert(false, "should not raise an exception for a wnote response field from a remove that does not match any documents")
|
111
|
+
end
|
112
|
+
assert_nil result["err"]
|
113
|
+
assert_true result.has_key?("wnote")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
103
117
|
context "Socket pools" do
|
104
118
|
context "checking out writers" do
|
105
119
|
setup do
|
@@ -206,7 +206,11 @@ class ReplicaSetClientTest < Test::Unit::TestCase
|
|
206
206
|
assert ['localhost:29999'] != @client.primary
|
207
207
|
assert !@client.secondaries.include?('localhost:29999')
|
208
208
|
ensure
|
209
|
-
|
209
|
+
begin
|
210
|
+
Process.kill("KILL", hung_node.pid) if hung_node
|
211
|
+
rescue
|
212
|
+
# the process ended, was killed already, or the system doesn't support nc
|
213
|
+
end
|
210
214
|
end
|
211
215
|
end
|
212
216
|
|
@@ -132,6 +132,7 @@ class ReplicaSetCursorTest < Test::Unit::TestCase
|
|
132
132
|
# batch from send_initial_query is 101 documents
|
133
133
|
# check that you get n_docs back from the query, with the same port
|
134
134
|
def cursor_get_more_test(read=:primary)
|
135
|
+
return if subject_to_server_4754?(@client)
|
135
136
|
set_read_client_and_tag(read)
|
136
137
|
10.times do
|
137
138
|
# assert that the query went to the correct member
|
@@ -152,6 +153,7 @@ class ReplicaSetCursorTest < Test::Unit::TestCase
|
|
152
153
|
|
153
154
|
# batch from get_more can be huge, so close after send_initial_query
|
154
155
|
def kill_cursor_test(read=:primary)
|
156
|
+
return if subject_to_server_4754?(@client)
|
155
157
|
set_read_client_and_tag(read)
|
156
158
|
10.times do
|
157
159
|
# assert that the query went to the correct member
|
@@ -171,6 +173,7 @@ class ReplicaSetCursorTest < Test::Unit::TestCase
|
|
171
173
|
end
|
172
174
|
|
173
175
|
def assert_cursors_on_members(read=:primary)
|
176
|
+
return if subject_to_server_4754?(@client)
|
174
177
|
set_read_client_and_tag(read)
|
175
178
|
# assert that the query went to the correct member
|
176
179
|
route_query(read)
|
@@ -141,5 +141,11 @@ class MaxValuesTest < Test::Unit::TestCase
|
|
141
141
|
@client.local_manager.primary_pool.node.stubs(:max_write_batch_size).returns(999)
|
142
142
|
assert_equal 999, @client.max_write_batch_size
|
143
143
|
end
|
144
|
+
|
145
|
+
def test_max_write_batch_size_no_manager
|
146
|
+
# Simulate no local manager being set yet - RUBY-759
|
147
|
+
@client.stubs(:local_manager).returns(nil)
|
148
|
+
assert_equal Mongo::MongoClient::DEFAULT_MAX_WRITE_BATCH_SIZE, @client.max_write_batch_size
|
149
|
+
end
|
144
150
|
end
|
145
151
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Tyler Brock
|
8
|
-
- Gary Murakami
|
9
7
|
- Emily Stolfo
|
10
|
-
- Brandon Black
|
11
8
|
- Durran Jordan
|
9
|
+
- Gary Murakami
|
10
|
+
- Tyler Brock
|
11
|
+
- Brandon Black
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain:
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
JrZM8w8wGbIOeLtoQqa7HB/jOYbTahH7KMNh2LHAbOR93hNIJxVRa4iwxiMQ75tN
|
35
35
|
9WUIAJ4AEtjwRg1Bz0OwDo3aucPCBpx77+/FWhv7JYY=
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2014-
|
37
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: bson
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - "~>"
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.10.
|
45
|
+
version: 1.10.1
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 1.10.
|
52
|
+
version: 1.10.1
|
53
53
|
description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
|
54
54
|
email: mongodb-dev@googlegroups.com
|
55
55
|
executables:
|
metadata.gz.sig
CHANGED
Binary file
|