Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26507

BSONObj::memUsageForSorter() should use buffer size instead of object size

    XMLWordPrintable

    Details

      Description

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: