mongo 2.17.2 → 2.17.3

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
  SHA256:
3
- metadata.gz: dcc9a0fe9a28483f4237193871e81741d79878d2620a1620285ace2ab1cc84e9
4
- data.tar.gz: 73692e39fb1d28041c38086571874cc285454c14425f666fbd242924fd5cac5f
3
+ metadata.gz: d91b7c77d8d5e9d9298baf6aae6789f164fc9f61cb58e27c5f096ccb775fe7bd
4
+ data.tar.gz: 6ea13c72698ac64aac21a29ee083fb483c56b51afbe9c2a1afd75ced4cefdded
5
5
  SHA512:
6
- metadata.gz: be915ceb9516a15b7f1317e43a20e578758f2b4c6da718ebcaa20b5ec4deedafe1d4ae0354875a89a0e2ca48c40c40ef76206cd6aa7c61e78d77876d780f9c5a
7
- data.tar.gz: 1d50c87d9072259331b5b28076c2527bdce00425bc2965641aaf13e5d1238db5ffe17f5bc398c6eb944e5487acf99eb037d25fb359eea6871a1082b0f0ca8a66
6
+ metadata.gz: 1b037dab0a527f76219b85159117c875e3b5b9a8cffe64689df71caeb344efedffa6d04a8c9232bd9a20aa1484da0b4a9690f00c126e4095931dd682328ca341
7
+ data.tar.gz: 0c4b32a82ebbf64d6eccbcc0356d289e913393467c640fdf1aa7d19c2cd4150fc0a924d5815f45e59ca62a85be832012b21caf524cadda666bbd07f1d187d342
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- rx�I‚���bdj4�
2
- sߦ�֝}ш���vgST IG�����dq��8ɂ����](�v8+�0�hָ�?�.�e>���`B�E�魷B�p��l�&5&#�HB����佺�S����H@���
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�������QEU.��<zrvkK
3
+ UY"x����&�s��Z��u�"|����/ *�IC;]���:��gg�Ӓ6�L���!�<����Mޯ"T�ʝ�ҝ���������/@�5u���|��
@@ -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. The message will be serialized again
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
- message.serialize(BSON::ByteBuffer.new)
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
@@ -20,5 +20,5 @@ module Mongo
20
20
  # The current version of the driver.
21
21
  #
22
22
  # @since 2.0.0
23
- VERSION = '2.17.2'.freeze
23
+ VERSION = '2.17.3'.freeze
24
24
  end
@@ -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
@@ -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.2
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-07-19 00:00:00.000000000 Z
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