-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 7.0.13, 8.0.0-rc20
-
Component/s: Query Execution
-
None
-
Query Execution
-
Fully Compatible
-
ALL
-
v8.0, v7.0
-
-
QE 2024-09-30, QE 2024-10-14, QE 2024-10-28
The generateBatch() method in getmore_cmd.cpp code link allows creating a result batch BSON object of size 16 757 334 containing 28099 documents which is still within BSONObjMaxUserSize (16MB = 16 777 216), however, the reply object containing that batch is 16 798 526 which exceeds BSONObjMaxInternalSize (16MB + 16KB = 16 793 600) and so the query fails with BSONObjectTooLarge error.
The problem behind this issue is a large postBatchResumeToken (41 147 bytes) which is unaccounted when estimating the reply size. Change event resume tokens can be large (larger than 16KB "buffer" we accommodate in BSONObjMaxInternalSize), because they encode the document ID, which can also be large. This error is a bug since we are controlling how big batches can grow, and the proper solution in this case (without any error) is to go for a smaller batch, e.g., stop on 28098 documents.
The problem has manifested in mongosync internal test running the current v7.0 with enableTestCommands=1. The failure call stack:
#0 BSONObj::_assertInvalid() at bsonobj.cpp:94 #1 BSONObj::init<mongo::BSONObj::DefaultSizeTrait> () at bsonobj.h:720 #2 BSONObj::BSONObj<mongo::BSONObj::DefaultSizeTrait> () at bsonobj.h:144 #3 BSONObjBuilderBase<mongo::BSONObjBuilder, mongo::BufBuilder>::done<mongo::BSONObj::DefaultSizeTrait> () at bsonobjbuilder.h:579 #4 BSONObjBuilder::obj<mongo::BSONObj::DefaultSizeTrait> () at bsonobjbuilder.h:775 #5 BSONObj::removeField () at bsonobj.cpp:724 #6 (anonymous namespace)::GetMoreCmd::Invocation::validateResult () at getmore_cmd.cpp:800 #7 (anonymous namespace)::GetMoreCmd::Invocation::run () at getmore_cmd.cpp:792 ...
If test commands are not enabled it will fail somewhere else.
- is related to
-
SERVER-97466 Investigate if large PBRT can cause BSONObjTooLarge for non-get-more commands
- Open
-
SERVER-91313 Change streams with large document _ids may fail even with $changeStreamSplitLargeEvent
- Backlog