mongo 2.17.2 → 2.17.3
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -2
- data/lib/mongo/bulk_write.rb +1 -1
- data/lib/mongo/cursor.rb +6 -1
- data/lib/mongo/operation/shared/sessions_supported.rb +7 -3
- data/lib/mongo/version.rb +1 -1
- data/spec/integration/bulk_write_spec.rb +16 -0
- data/spec/mongo/cursor_spec.rb +50 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: d91b7c77d8d5e9d9298baf6aae6789f164fc9f61cb58e27c5f096ccb775fe7bd
|
4
|
+
data.tar.gz: 6ea13c72698ac64aac21a29ee083fb483c56b51afbe9c2a1afd75ced4cefdded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b037dab0a527f76219b85159117c875e3b5b9a8cffe64689df71caeb344efedffa6d04a8c9232bd9a20aa1484da0b4a9690f00c126e4095931dd682328ca341
|
7
|
+
data.tar.gz: 0c4b32a82ebbf64d6eccbcc0356d289e913393467c640fdf1aa7d19c2cd4150fc0a924d5815f45e59ca62a85be832012b21caf524cadda666bbd07f1d187d342
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
W�Kt����+��vKcǐEE(_�TV!������̧gpP;mT���HaY��(-�:�-�X>.WwG��Mh�)��G��|R����z�S��/�@�RS���'mW]UՠO�K���U
|
2
|
+
qD�K�������QE�U.��<zrvk�K�
|
3
|
+
UY"x����&�s��Z��u�"|����/*�IC;]���:��gg�Ӓ6�L���!�<����Mޯ"T�ʝ�ҝ���������/@�5u���|��
|
data/lib/mongo/bulk_write.rb
CHANGED
@@ -222,7 +222,7 @@ module Mongo
|
|
222
222
|
def split_execute(name, values, connection, context, operation_id, result_combiner, session, txn_num)
|
223
223
|
execute_operation(name, values.shift(values.size / 2), connection, context, operation_id, result_combiner, session, txn_num)
|
224
224
|
|
225
|
-
txn_num = session.next_txn_num if txn_num
|
225
|
+
txn_num = session.next_txn_num if txn_num && !session.in_transaction?
|
226
226
|
execute_operation(name, values, connection, context, operation_id, result_combiner, session, txn_num)
|
227
227
|
end
|
228
228
|
|
data/lib/mongo/cursor.rb
CHANGED
@@ -253,7 +253,12 @@ module Mongo
|
|
253
253
|
#
|
254
254
|
# @since 2.2.0
|
255
255
|
def batch_size
|
256
|
-
@view.batch_size && @view.batch_size > 0 ? @view.batch_size : limit
|
256
|
+
value = @view.batch_size && @view.batch_size > 0 ? @view.batch_size : limit
|
257
|
+
if value == 0
|
258
|
+
nil
|
259
|
+
else
|
260
|
+
value
|
261
|
+
end
|
257
262
|
end
|
258
263
|
|
259
264
|
# Is the cursor closed?
|
@@ -257,10 +257,14 @@ module Mongo
|
|
257
257
|
super.tap do |message|
|
258
258
|
if session = context.session
|
259
259
|
# Serialize the message to detect client-side problems,
|
260
|
-
# such as invalid BSON keys
|
260
|
+
# such as invalid BSON keys or too large messages.
|
261
|
+
# The message will be serialized again
|
261
262
|
# later prior to being sent to the connection.
|
262
|
-
|
263
|
-
|
263
|
+
buf = BSON::ByteBuffer.new
|
264
|
+
message.serialize(buf)
|
265
|
+
if buf.length > connection.max_message_size
|
266
|
+
raise Error::MaxMessageSize.new(connection.max_message_size)
|
267
|
+
end
|
264
268
|
session.update_state!
|
265
269
|
end
|
266
270
|
end
|
data/lib/mongo/version.rb
CHANGED
@@ -18,6 +18,22 @@ describe 'Bulk writes' do
|
|
18
18
|
authorized_collection.bulk_write(operations)
|
19
19
|
end.not_to raise_error
|
20
20
|
end
|
21
|
+
|
22
|
+
context 'in transaction' do
|
23
|
+
require_transaction_support
|
24
|
+
min_server_version "4.4"
|
25
|
+
|
26
|
+
it 'succeeds' do
|
27
|
+
authorized_collection.create
|
28
|
+
expect do
|
29
|
+
authorized_collection.client.start_session do |session|
|
30
|
+
session.with_transaction do
|
31
|
+
authorized_collection.bulk_write(operations, { session: session })
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end.not_to raise_error
|
35
|
+
end
|
36
|
+
end
|
21
37
|
end
|
22
38
|
|
23
39
|
context 'when bulk write needs to be split' do
|
data/spec/mongo/cursor_spec.rb
CHANGED
@@ -698,4 +698,54 @@ describe Mongo::Cursor do
|
|
698
698
|
end
|
699
699
|
end
|
700
700
|
end
|
701
|
+
|
702
|
+
describe '#batch_size' do
|
703
|
+
let(:subscriber) { Mrss::EventSubscriber.new }
|
704
|
+
|
705
|
+
let(:subscribed_client) do
|
706
|
+
authorized_client.tap do |client|
|
707
|
+
client.subscribe(Mongo::Monitoring::COMMAND, subscriber)
|
708
|
+
end
|
709
|
+
end
|
710
|
+
|
711
|
+
let(:collection) do
|
712
|
+
subscribed_client[TEST_COLL]
|
713
|
+
end
|
714
|
+
|
715
|
+
let(:view) do
|
716
|
+
collection.find({}, limit: limit)
|
717
|
+
end
|
718
|
+
|
719
|
+
before do
|
720
|
+
collection.drop
|
721
|
+
collection.insert_many([].fill({ "bar": "baz" }, 0, 102))
|
722
|
+
end
|
723
|
+
|
724
|
+
context 'when limit is 0 and batch_size is not set' do
|
725
|
+
let(:limit) do
|
726
|
+
0
|
727
|
+
end
|
728
|
+
|
729
|
+
it 'does not set batch_size' do
|
730
|
+
view.to_a
|
731
|
+
get_more_commands = subscriber.started_events.select { |e| e.command_name == 'getMore' }
|
732
|
+
expect(get_more_commands.length).to eq(1)
|
733
|
+
expect(get_more_commands.first.command.keys).not_to include('batchSize')
|
734
|
+
end
|
735
|
+
end
|
736
|
+
|
737
|
+
context 'when limit is not zero and batch_size is not set' do
|
738
|
+
let(:limit) do
|
739
|
+
1000
|
740
|
+
end
|
741
|
+
|
742
|
+
it 'sets batch_size' do
|
743
|
+
view.to_a
|
744
|
+
get_more_commands = subscriber.started_events.select { |e| e.command_name == 'getMore' }
|
745
|
+
|
746
|
+
expect(get_more_commands.length).to eq(1)
|
747
|
+
expect(get_more_commands.first.command.keys).to include('batchSize')
|
748
|
+
end
|
749
|
+
end
|
750
|
+
end
|
701
751
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.17.
|
4
|
+
version: 2.17.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
32
32
|
+WyKQ+QTIdtDiyf2LQmxWnxt/W1CmScjdLS7/yXGkkB/D9Uy+sJD747O/B9P238Q
|
33
33
|
XnerrtyOu04RsWDvaZkCwSDVzoqfICh4CP1mlde73Ts=
|
34
34
|
-----END CERTIFICATE-----
|
35
|
-
date: 2022-
|
35
|
+
date: 2022-08-02 00:00:00.000000000 Z
|
36
36
|
dependencies:
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bson
|
metadata.gz.sig
CHANGED
Binary file
|