mongo 2.16.0.alpha1 → 2.16.2
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/lib/mongo/collection/view/builder/map_reduce.rb +7 -4
- data/lib/mongo/collection/view/map_reduce.rb +14 -1
- data/lib/mongo/server/push_monitor.rb +4 -1
- data/lib/mongo/version.rb +1 -1
- data/spec/lite_spec_helper.rb +7 -0
- data/spec/mongo/collection/view/map_reduce_spec.rb +16 -0
- data/spec/mongo/server/monitor/connection_spec.rb +22 -0
- data/spec/mongo/server/push_monitor_spec.rb +101 -0
- data/spec/runners/auth.rb +1 -1
- data/spec/runners/change_streams/spec.rb +1 -1
- data/spec/runners/cmap.rb +1 -1
- data/spec/runners/command_monitoring.rb +1 -1
- data/spec/runners/connection_string.rb +1 -1
- data/spec/runners/crud/spec.rb +1 -3
- data/spec/runners/gridfs.rb +1 -1
- data/spec/runners/read_write_concern_document.rb +1 -1
- data/spec/runners/sdam.rb +1 -1
- data/spec/runners/server_selection.rb +1 -1
- data/spec/runners/server_selection_rtt.rb +1 -1
- data/spec/runners/unified/support_operations.rb +10 -2
- data/spec/runners/unified/test_group.rb +1 -1
- data/spec/shared/lib/mrss/cluster_config.rb +6 -1
- data/spec/shared/share/Dockerfile.erb +3 -3
- data/spec/spec_tests/seed_list_discovery_spec.rb +1 -1
- data/spec/support/spec_config.rb +1 -1
- data/spec/support/utils.rb +31 -0
- data.tar.gz.sig +1 -2
- metadata +995 -992
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2708181386dc2ec2ea46e5ffe3f96967c3ea1e23dfd6f0d6d6ef15fbbde3877a
|
4
|
+
data.tar.gz: 017f64d2a62cc0215b6234cef24c8f0be74f75ed5fa688d32155047dbd56a7e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2488655223e41488f275a7c8d1cd8b4c416a44a92c31cba63ab3fca21b27ec8f545b5feaa953aefb50035dbc68fe47db4f3aebb97fcb1de4e0e5fc6e3b186014
|
7
|
+
data.tar.gz: 671ae924600e906df4a2c209b7c491be445ef5c7c7030f6869fa991c53bd49a7cb728a718c8667b5c948022fb2912d45af437c1cf5b82f8b7ec0f0c849916045
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -115,11 +115,14 @@ module Mongo
|
|
115
115
|
end
|
116
116
|
command.update(view_options)
|
117
117
|
command.update(Utils.slice_hash(options, :collation))
|
118
|
+
|
118
119
|
# Read preference isn't simply passed in the command payload
|
119
|
-
# (it may need to be converted to wire protocol flags)
|
120
|
-
#
|
121
|
-
#
|
122
|
-
|
120
|
+
# (it may need to be converted to wire protocol flags).
|
121
|
+
# Ideally it should be removed here, however due to Mongoid 7
|
122
|
+
# using this method and requiring :read to be returned from it,
|
123
|
+
# we cannot do this just yet - see RUBY-2932.
|
124
|
+
#command.delete(:read)
|
125
|
+
|
123
126
|
command.merge!(Options::Mapper.transform_documents(options, MAPPINGS))
|
124
127
|
command
|
125
128
|
end
|
@@ -248,7 +248,20 @@ module Mongo
|
|
248
248
|
end
|
249
249
|
|
250
250
|
def initial_query_op(session)
|
251
|
-
|
251
|
+
spec = map_reduce_spec(session)
|
252
|
+
# Read preference isn't simply passed in the command payload
|
253
|
+
# (it may need to be converted to wire protocol flags).
|
254
|
+
# Passing it in command payload produces errors on at least
|
255
|
+
# 5.0 mongoses.
|
256
|
+
# In the future map_reduce_command should remove :read
|
257
|
+
# from its return value, however we cannot do this right now
|
258
|
+
# due to Mongoid 7 relying on :read being returned as part of
|
259
|
+
# the command - see RUBY-2932.
|
260
|
+
# Delete :read here for now because it cannot be sent to mongos this way.
|
261
|
+
spec = spec.dup
|
262
|
+
spec[:selector] = spec[:selector].dup
|
263
|
+
spec[:selector].delete(:read)
|
264
|
+
Operation::MapReduce.new(spec)
|
252
265
|
end
|
253
266
|
|
254
267
|
def valid_server?(server)
|
@@ -110,7 +110,7 @@ module Mongo
|
|
110
110
|
if new_description.topology_version
|
111
111
|
@topology_version = new_description.topology_version
|
112
112
|
end
|
113
|
-
rescue Mongo::Error => exc
|
113
|
+
rescue IOError, SocketError, SystemCallError, Mongo::Error => exc
|
114
114
|
stop_requested = @lock.synchronize { @stop_requested }
|
115
115
|
if stop_requested
|
116
116
|
# Ignore the exception, see RUBY-2771.
|
@@ -123,6 +123,9 @@ module Mongo
|
|
123
123
|
log_prefix: options[:log_prefix],
|
124
124
|
bg_error_backtrace: options[:bg_error_backtrace],
|
125
125
|
)
|
126
|
+
|
127
|
+
# Avoid tight looping in push monitor - see RUBY-2806.
|
128
|
+
sleep(0.5)
|
126
129
|
end
|
127
130
|
|
128
131
|
def check
|
data/lib/mongo/version.rb
CHANGED
data/spec/lite_spec_helper.rb
CHANGED
@@ -157,6 +157,13 @@ RSpec.configure do |config|
|
|
157
157
|
end
|
158
158
|
|
159
159
|
if SpecConfig.instance.active_support?
|
160
|
+
require "active_support/version"
|
161
|
+
if ActiveSupport.version >= Gem::Version.new(7)
|
162
|
+
# ActiveSupport wants us to require ALL of it all of the time.
|
163
|
+
# See: https://github.com/rails/rails/issues/43851,
|
164
|
+
# https://github.com/rails/rails/issues/43889, etc.
|
165
|
+
require 'active_support'
|
166
|
+
end
|
160
167
|
require "active_support/time"
|
161
168
|
require 'mongo/active_support'
|
162
169
|
end
|
@@ -865,4 +865,20 @@ describe Mongo::Collection::View::MapReduce do
|
|
865
865
|
end
|
866
866
|
end
|
867
867
|
end
|
868
|
+
|
869
|
+
describe '#map_reduce_spec' do
|
870
|
+
context 'when read preference is given' do
|
871
|
+
let(:view_options) do
|
872
|
+
{ read: {mode: :secondary} }
|
873
|
+
end
|
874
|
+
|
875
|
+
context 'selector' do
|
876
|
+
# For compatibility with released versions of Mongoid, this method
|
877
|
+
# must return read preference under the :read key.
|
878
|
+
it 'contains read preference' do
|
879
|
+
map_reduce_spec[:selector][:read].should == {'mode' => :secondary}
|
880
|
+
end
|
881
|
+
end
|
882
|
+
end
|
883
|
+
end
|
868
884
|
end
|
@@ -136,6 +136,28 @@ describe Mongo::Server::Monitor::Connection do
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
+
describe '#connect!' do
|
140
|
+
|
141
|
+
let(:options) do
|
142
|
+
SpecConfig.instance.test_options.merge(
|
143
|
+
app_metadata: monitor_app_metadata,
|
144
|
+
)
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'when address resolution fails' do
|
148
|
+
let(:connection) { described_class.new(server.address, options) }
|
149
|
+
|
150
|
+
it 'propagates the exception' do
|
151
|
+
connection
|
152
|
+
|
153
|
+
expect(Socket).to receive(:getaddrinfo).and_raise(SocketError.new('Test exception'))
|
154
|
+
lambda do
|
155
|
+
connection.connect!
|
156
|
+
end.should raise_error(SocketError, 'Test exception')
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
139
161
|
describe '#check_document' do
|
140
162
|
context 'with API version' do
|
141
163
|
let(:meta) do
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe Mongo::Server::PushMonitor do
|
7
|
+
before(:all) do
|
8
|
+
ClientRegistry.instance.close_all_clients
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:address) do
|
12
|
+
default_address
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:listeners) do
|
16
|
+
Mongo::Event::Listeners.new
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:monitor_options) do
|
20
|
+
{}
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:monitor_app_metadata) do
|
24
|
+
Mongo::Server::Monitor::AppMetadata.new(
|
25
|
+
server_api: SpecConfig.instance.ruby_options[:server_api],
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
let(:cluster) do
|
30
|
+
double('cluster').tap do |cluster|
|
31
|
+
allow(cluster).to receive(:run_sdam_flow)
|
32
|
+
allow(cluster).to receive(:heartbeat_interval).and_return(1000)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
let(:server) do
|
37
|
+
Mongo::Server.new(address, cluster, Mongo::Monitoring.new, listeners,
|
38
|
+
monitoring_io: false)
|
39
|
+
end
|
40
|
+
|
41
|
+
let(:monitor) do
|
42
|
+
register_background_thread_object(
|
43
|
+
Mongo::Server::Monitor.new(server, listeners, Mongo::Monitoring.new,
|
44
|
+
SpecConfig.instance.test_options.merge(cluster: cluster).merge(monitor_options).update(
|
45
|
+
app_metadata: monitor_app_metadata,
|
46
|
+
push_monitor_app_metadata: monitor_app_metadata))
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:topology_version) do
|
51
|
+
Mongo::TopologyVersion.new('processId' => BSON::ObjectId.new, 'counter' => 1)
|
52
|
+
end
|
53
|
+
|
54
|
+
let(:check_document) do
|
55
|
+
{hello: 1}
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:push_monitor) do
|
59
|
+
described_class.new(monitor, topology_version, monitor.monitoring,
|
60
|
+
**monitor.options.merge(check_document: check_document))
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#do_work' do
|
64
|
+
it 'works' do
|
65
|
+
lambda do
|
66
|
+
push_monitor.do_work
|
67
|
+
end.should_not raise_error
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'network error during check' do
|
71
|
+
it 'does not propagate the exception' do
|
72
|
+
push_monitor
|
73
|
+
|
74
|
+
expect(Socket).to receive(:getaddrinfo).and_raise(SocketError.new('Test exception'))
|
75
|
+
lambda do
|
76
|
+
push_monitor.do_work
|
77
|
+
end.should_not raise_error
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'throttles checks' do
|
81
|
+
push_monitor
|
82
|
+
|
83
|
+
start = Mongo::Utils.monotonic_time
|
84
|
+
|
85
|
+
expect(Socket).to receive(:getaddrinfo).and_raise(SocketError.new('Test exception'))
|
86
|
+
lambda do
|
87
|
+
push_monitor.do_work
|
88
|
+
end.should_not raise_error
|
89
|
+
|
90
|
+
expect(Socket).to receive(:getaddrinfo).and_raise(SocketError.new('Test exception'))
|
91
|
+
lambda do
|
92
|
+
push_monitor.do_work
|
93
|
+
end.should_not raise_error
|
94
|
+
|
95
|
+
elapsed = Mongo::Utils.monotonic_time - start
|
96
|
+
elapsed.should > 0.5
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
data/spec/runners/auth.rb
CHANGED
@@ -32,7 +32,7 @@ module Mongo
|
|
32
32
|
#
|
33
33
|
# @since 2.6.0
|
34
34
|
def initialize(test_path)
|
35
|
-
@spec =
|
35
|
+
@spec = ::Utils.load_spec_yaml_file(test_path)
|
36
36
|
@description = File.basename(test_path)
|
37
37
|
@spec_tests = @spec['tests']
|
38
38
|
@collection_name = @spec['collection_name']
|
data/spec/runners/cmap.rb
CHANGED
@@ -40,7 +40,7 @@ module Mongo
|
|
40
40
|
#
|
41
41
|
# @param [ String ] test_path The path to the file.
|
42
42
|
def initialize(test_path)
|
43
|
-
@test =
|
43
|
+
@test = ::Utils.load_spec_yaml_file(test_path)
|
44
44
|
|
45
45
|
@description = @test['description']
|
46
46
|
@pool_options = ::Utils.snakeize_hash(process_options(@test['poolOptions']))
|
data/spec/runners/crud/spec.rb
CHANGED
@@ -12,9 +12,7 @@ module Mongo
|
|
12
12
|
#
|
13
13
|
# @since 2.0.0
|
14
14
|
def initialize(test_path)
|
15
|
-
|
16
|
-
|
17
|
-
@spec = YAML.load(contents)
|
15
|
+
@spec = ::Utils.load_spec_yaml_file(test_path)
|
18
16
|
@description = File.basename(test_path)
|
19
17
|
@data = BSON::ExtJSON.parse_obj(@spec['data'])
|
20
18
|
@tests = @spec['tests']
|
data/spec/runners/gridfs.rb
CHANGED
data/spec/runners/sdam.rb
CHANGED
@@ -64,7 +64,7 @@ module Mongo
|
|
64
64
|
#
|
65
65
|
# @since 2.0.0
|
66
66
|
def initialize(test_path)
|
67
|
-
@test =
|
67
|
+
@test = ::Utils.load_spec_yaml_file(test_path)
|
68
68
|
@description = "#{@test['topology_description']['type']}: #{File.basename(test_path)}"
|
69
69
|
@heartbeat_frequency = @test['heartbeatFrequencyMS'] / 1000 if @test['heartbeatFrequencyMS']
|
70
70
|
@read_preference = @test['read_preference']
|
@@ -28,7 +28,7 @@ module Mongo
|
|
28
28
|
#
|
29
29
|
# @since 2.0.0
|
30
30
|
def initialize(test_path)
|
31
|
-
@test =
|
31
|
+
@test = ::Utils.load_spec_yaml_file(test_path)
|
32
32
|
@description = "#{File.basename(test_path)}: avg_rtt_ms: #{@test['avg_rtt_ms']}, new_rtt_ms: #{@test['new_rtt_ms']}," +
|
33
33
|
" new_avg_rtt: #{@test['new_avg_rtt']}"
|
34
34
|
@average_rtt = @test['avg_rtt_ms'] == 'NULL' ? nil : @test['avg_rtt_ms'].to_f / 1000
|
@@ -208,12 +208,20 @@ module Unified
|
|
208
208
|
else
|
209
209
|
raise
|
210
210
|
end
|
211
|
+
rescue Interrupt
|
212
|
+
raise
|
211
213
|
rescue => e
|
212
|
-
if
|
214
|
+
if store_failures
|
215
|
+
STDERR.puts "Error: #{e.class}: #{e} (reporting as failure)"
|
216
|
+
entities.get(:failure_list, store_failures) << {
|
217
|
+
error: "#{e.class}: #{e}",
|
218
|
+
time: Time.now.to_f,
|
219
|
+
}
|
220
|
+
elsif store_errors
|
213
221
|
STDERR.puts "Error: #{e.class}: #{e}"
|
214
222
|
entities.get(:error_list, store_errors) << {
|
215
223
|
error: "#{e.class}: #{e}",
|
216
|
-
|
224
|
+
time: Time.now.to_f,
|
217
225
|
}
|
218
226
|
else
|
219
227
|
raise
|
@@ -209,7 +209,12 @@ module Mrss
|
|
209
209
|
@server_version = build_info['version']
|
210
210
|
@enterprise = build_info['modules'] && build_info['modules'].include?('enterprise')
|
211
211
|
|
212
|
-
@server_parameters =
|
212
|
+
@server_parameters = begin
|
213
|
+
client.use(:admin).command(getParameter: '*').first
|
214
|
+
rescue => e
|
215
|
+
STDERR.puts("WARNING: Failed to obtain server parameters: #{e.class}: #{e.message}")
|
216
|
+
{}
|
217
|
+
end
|
213
218
|
|
214
219
|
if !sharded_ish? && short_server_version >= '3.4'
|
215
220
|
rv = @server_parameters['featureCompatibilityVersion']
|
@@ -55,7 +55,7 @@ FROM <%= base_image %>
|
|
55
55
|
# Ruby runtime dependencies: libyaml-0-2
|
56
56
|
# Compiling ruby libraries: gcc make
|
57
57
|
# Compiling pyhton packages: python2.7-dev
|
58
|
-
# JRuby: openjdk-8-
|
58
|
+
# JRuby: openjdk-8-jdk-headless
|
59
59
|
# Server dependencies: libsnmp30 libcurl3/libcurl4
|
60
60
|
# Determining OS we are running on: lsb-release
|
61
61
|
# Load balancer testing: haproxy
|
@@ -104,11 +104,11 @@ FROM <%= base_image %>
|
|
104
104
|
<% end %>
|
105
105
|
|
106
106
|
<% if distro =~ /debian10/ %>
|
107
|
-
<% packages << 'openjdk-11-
|
107
|
+
<% packages << 'openjdk-11-jdk-headless' %>
|
108
108
|
<% elsif distro =~ /ubuntu1404/ %>
|
109
109
|
# Ubuntu 14.04 only has openjdk 7, this is too old to be useful
|
110
110
|
<% else %>
|
111
|
-
<% packages << 'openjdk-8-
|
111
|
+
<% packages << 'openjdk-8-jdk-headless' %>
|
112
112
|
<% end %>
|
113
113
|
|
114
114
|
# ubuntu1404, ubuntu1604: libcurl3
|
data/spec/support/spec_config.rb
CHANGED
@@ -13,7 +13,7 @@ class SpecConfig
|
|
13
13
|
@uri_options = {}
|
14
14
|
@ruby_options = {}
|
15
15
|
if ENV['MONGODB_URI']
|
16
|
-
@mongodb_uri = Mongo::URI.
|
16
|
+
@mongodb_uri = Mongo::URI.get(ENV['MONGODB_URI'])
|
17
17
|
@uri_options = Mongo::Options::Mapper.transform_keys_to_symbols(@mongodb_uri.uri_options)
|
18
18
|
if ENV['TOPOLOGY'] == 'load-balanced'
|
19
19
|
@addresses = @mongodb_uri.servers
|
data/spec/support/utils.rb
CHANGED
@@ -595,4 +595,35 @@ module Utils
|
|
595
595
|
end
|
596
596
|
end
|
597
597
|
end
|
598
|
+
|
599
|
+
module_function def load_spec_yaml_file(path)
|
600
|
+
permitted_classes = [
|
601
|
+
BigDecimal,
|
602
|
+
Date,
|
603
|
+
Time,
|
604
|
+
Range,
|
605
|
+
Regexp,
|
606
|
+
Symbol,
|
607
|
+
BSON::Binary,
|
608
|
+
BSON::Code,
|
609
|
+
BSON::CodeWithScope,
|
610
|
+
BSON::DbPointer,
|
611
|
+
BSON::Decimal128,
|
612
|
+
BSON::Int32,
|
613
|
+
BSON::Int64,
|
614
|
+
BSON::MaxKey,
|
615
|
+
BSON::MinKey,
|
616
|
+
BSON::ObjectId,
|
617
|
+
BSON::Regexp::Raw,
|
618
|
+
BSON::Symbol::Raw,
|
619
|
+
BSON::Timestamp,
|
620
|
+
BSON::Undefined,
|
621
|
+
]
|
622
|
+
if RUBY_VERSION < '2.6'
|
623
|
+
YAML.safe_load(File.read(path), permitted_classes, [], true)
|
624
|
+
else
|
625
|
+
# Here we have Ruby 2.6+ that supports the new syntax of `safe_load``.
|
626
|
+
YAML.safe_load(File.read(path), permitted_classes: permitted_classes, aliases: true)
|
627
|
+
end
|
628
|
+
end
|
598
629
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
_�"�XA�G �w����>�{*�U��)��-y�?��Y�P2��^r�4T�6���*|C�d_��S�J�}�@�s��=��c��+n�L�k�>����(��vPk�cXT�j!9��fx��(\���6IGe�6�)�g<�T�egf�9�e
|
1
|
+
��l�i'#���X�aBY�-�TRM�ZA�k�xe���#֑��Kt2-����z�}er;����_3XM�4�k��D�����6��@��9�'����d�����)I>�Ua9��$�m�^e�7���P�P���,��w�0��2E1�m�o�*��d��wF_��o"Y������!i��#�sJ���_A��(�l��l��D�a*D[�Y+��B���T����t���
|