[SERVER-77182] Validate that there are <= maxWriteBatchSize ops in bulkWrite command Created: 16/May/23  Updated: 29/Oct/23  Resolved: 24/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Kaitlin Mahar Assignee: Sean Zimmerman
Resolution: Fixed Votes: 0
Labels: milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Backwards Compatibility: Fully Compatible
Sprint: Repl 2023-05-29
Participants:

 Description   

For other write commands, e.g. insert, we validate on mongod that there are <= maxWriteBatchSize ops in an incoming command, using checkOpCountForCommand (here). For example, InsertOp::validate (here) calls this.

However, we don't appear to enforce this limit for bulkWrite right now.

As far as I can tell, we don't enforce the limit for incoming commands on mongos, though we do ensure that outgoing commands on mongos respect the limit. So we likely only need to make a change on mongod, though it might be worth confirming this with the sharding team to make sure we didn't miss any logic around this. Update: Testing and further investigation revealed that the limits are in fact enforced on mongos. E.g. for insert, ClusterInsertCmdBase::parse calls BatchedCommandRequest::parseInsert which ends up calling down through to InsertOp::parse which calls validate and checks the op count.



 Comments   
Comment by Githook User [ 25/May/23 ]

Author:

{'name': 'seanzimm', 'email': 'sean.zimmerman@mongodb.com', 'username': 'seanzimm'}

Message: SERVER-77182: Fix interrupt error in bulkWrite test
Branch: master
https://github.com/mongodb/mongo/commit/dcb1902e54f9aadd175cfdf14af028d9506669dd

Comment by Githook User [ 24/May/23 ]

Author:

{'name': 'seanzimm', 'email': 'sean.zimmerman@mongodb.com', 'username': 'seanzimm'}

Message: SERVER-77182: Add maxWriteBatchSize check to bulkWrite
Branch: master
https://github.com/mongodb/mongo/commit/d06b88768a5832ea22d70eac5e2ae97db8a8514a

Generated at Thu Feb 08 06:34:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.