[CDRIVER-3230] command options not included in bson size estimate in opquery write commands Created: 11/Jul/19  Updated: 28/Oct/23  Resolved: 12/Aug/19

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.11.0
Fix Version/s: 1.15.0

Type: Bug Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: Kevin Albertson
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to CDRIVER-3310 OP_QUERY bulk write should not batch ... Backlog
Case:

 Description   

We split bulk writes into batches by creating and sending smaller individual write commands with subsets of the bulk write. We do this by adding the bulk write bson documents to each new write command until that write command is "full", so that we don't exceed the max bson size specified by the server. However, as of C driver 1.11, we append the write concern to the write command after we have deemed it "full." This can lead to an invalid bson document that exceeds the max bson size when it reaches the server.

This bug was introduced in this change:
https://github.com/mongodb/mongo-c-driver/commit/806cddb2acde03f5462460491f38fa21332b7d97#diff-48f831a7962c26b4ba6a9c1472b8184fL486



 Comments   
Comment by Githook User [ 12/Aug/19 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com', 'username': 'kevinAlbs'}

Message: CDRIVER-3230 fix opquery batch splitting

OP_QUERY batch splitting was not taking command options into account
when computing the size to split. So, for example, a write concern
document could put the batch over the maxBsonObjectSize + 16k limit.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/15a19850ce5ed8bec8ad1f44e32edd49442efc68

Comment by Kevin Albertson [ 23/Jul/19 ]

Hi dzacchi@amadeus.com, we're planning to address this in 1.15.0.

Comment by David Zacchi [ 22/Jul/19 ]

This prevents our migration to MongoDB 4.0 as the only mongocxx version compatible is 3.4 using libmongoc 1.11 containing this issue.

Please fix the libmongoc for us to be able to build our application with it.

Thanks in advance.

Generated at Wed Feb 07 21:17:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.