-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Index Maintenance, Internal Code
-
None
-
Query Execution
The sorter's memory requirements depend on the buffer size of the index keys, but BSONObj::memUsageForSorter() uses the object size of the index keys. This requires the developer to ensure that the object size match the buffer size for index keys, or else the sorter's memory usage estimates will be off, and it can run out of memory. This leads to bugs like SERVER-25075 and SERVER-26488. It is still useful to optimize the buffer size for index keys for efficiency, but it would be better if forgetting to do so did not cause OOM failures.
We would have to consider the performance implications of storing the buffer size of a BSONObj.