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

Move ownership of agg request structures to aggregation execution context

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration

      As of now, the the runAggregate() function takes in the AggregateCommandRequest and its associated parsed structures (LiteParsedPipeline & BSONObj) by lvalue reference.

       

      This pattern makes sense as these objects are created and referenced in the calling context, and we want to take them by reference because we don't want to copy or rebuild them in the runAggregate() context. However, we should go a step further and actually pass in these objects by rvalue so they can be move assigned internally in runAggregate(). This way its clear in the both the calling and runAggregate() context that runAggregate() now has full ownership of these objects and can manipulate them internally as needed. We do actually need to reassign these objects in the case of running an aggregate on a resolved view, which would be possible after these objects are owned internally.

       

      Also after the move assignment is complete, we should edit AggExState::AggregateCommandRequest to keep its internal objects by value, instead of by reference, so that _aggRequestDerivatives can be reassigned and not be wrapped in a pointer.

       

      As part of this ticket, see which other input variables can be passed in by rvalue and owned internal to runAggregate (such as PrivilegeVector).

            Assignee:
            Unassigned Unassigned
            Reporter:
            joseph.shalabi@mongodb.com Joe Shalabi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: