mongo 1.10.0-java → 1.10.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cc3ce7b36f61b8784629e34051b56e16aaf9b45
4
- data.tar.gz: dcfb781eb48c4e0dc0d175fd51a23beaaaeb286f
3
+ metadata.gz: ae88c8e129b138162459577c3d5aab3464be2aa5
4
+ data.tar.gz: c362c3a5f77295bb68227c8263dc9418c26e464d
5
5
  SHA512:
6
- metadata.gz: b3e5d83a165dfb3fae3d7b79183e8575a3edc8a6cab643d19aeeef414e7fd33f038c5c5a85f58079d20330bc58d6a7e3d856220781bc3555e68c34c89412db5e
7
- data.tar.gz: 113ee10195244e9fc19fac38c455b02d0936d781e729394c0ed021a794b0b05613acc05f433910e580439349459e36094cdfb1efa963f69767dfe52e2f03b45d
6
+ metadata.gz: 83d37ce49373264e0089500c7ae049301bbd29d440a995f86723ffd4a746579f79288d5454212e9305260d35e72b90d929c71b5fa4f6a0ebfdab46f5dde91ec5
7
+ data.tar.gz: aabe35188da7ba722769546d9344ddb16607098a09d3ef8c585ae18546c858bcfb68e95294914c590531c25b6b818990f0189fa174c047dcabd2e3f0cdaed4a1
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.10.0
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
 
@@ -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 ex.error_code == Mongo::ErrorCode::COMMAND_NOT_FOUND || ex.error_code.nil?
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 ex.error_code == Mongo::ErrorCode::COMMAND_NOT_FOUND || ex.error_code.nil?
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 ex.error_code == Mongo::ErrorCode::COMMAND_NOT_FOUND || ex.error_code.nil?
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
- memo[key.downcase.to_sym] = value.strip.downcase
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
@@ -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
@@ -855,11 +855,12 @@ class CollectionTest < Test::Unit::TestCase
855
855
  end
856
856
  end
857
857
 
858
- def test_wnote_raises_exception
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
@@ -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
- @db.profiling_level = :all
323
- @coll.find()
324
- @db.profiling_level = :off
325
-
326
- info = @db.profiling_info
327
- assert_kind_of Array, info
328
- assert info.length >= 1
329
- first = info.first
330
- assert_kind_of Time, first['ts']
331
- assert_kind_of Numeric, first['millis']
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
@@ -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
@@ -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
- Process.kill("KILL", hung_node.pid) if hung_node
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: java
6
6
  authors:
7
7
  - Emily Stolfo
@@ -34,7 +34,7 @@ cert_chain:
34
34
  JrZM8w8wGbIOeLtoQqa7HB/jOYbTahH7KMNh2LHAbOR93hNIJxVRa4iwxiMQ75tN
35
35
  9WUIAJ4AEtjwRg1Bz0OwDo3aucPCBpx77+/FWhv7JYY=
36
36
  -----END CERTIFICATE-----
37
- date: 2014-04-23 00:00:00.000000000 Z
37
+ date: 2014-05-16 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: bson
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.10.0
45
+ version: 1.10.1
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - ~>
49
49
  - !ruby/object:Gem::Version
50
- version: 1.10.0
50
+ version: 1.10.1
51
51
  prerelease: false
52
52
  type: :runtime
53
53
  description: A Ruby driver for MongoDB. For more information about Mongo, see http://www.mongodb.org.
metadata.gz.sig CHANGED
Binary file