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

Make DocumentSource::usedDisk() const

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      DocumentSource::usedDisk() is (subjectively) expected to be const, however it is not.

      Most stages cannot spill to disk, so the result is always false.

      Some stages can spill and the method returns _stats.planSummaryStats.usedDisk, where _stats is some stage specific statistics object, which can also be retrieved with DocumentSource::getSpecificStats() method.

      Some stages with sub-pipelines don't update their statistics during the execution, within the usedDisk() non-const method, which makes the API contextual and prone to errors.

      Updating _stats.planSummaryStats.usedDisk should probably be done when the pipeline is officially 'closed' and there will be no more 'getNext()' calls. This will allow making DocumentSource::usedDisk() method const, or remove it completely, as suggested in SERVER-53759.

      This minor improvement is related to SPM-4106, but it is out of scope of the project.

            Assignee:
            Unassigned Unassigned
            Reporter:
            romans.kasperovics@mongodb.com Romans Kasperovics
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: