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

Change query unit tests to not create multiple service contexts

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor - P4 Minor - P4
    • 4.7.0
    • 4.1.10
    • Querying
    • Fully Compatible
    • Query 2020-02-24, Query 2020-03-09

    Description

      ExpressionContextForTest owns a service context. DocumentSourceMock will create an ExpressionContextForTest in its create() methods. This means that each time a DocumentSourceMock is created, we go through all of the work of creating an entire service context.

       

      At the same time, the AggregationContextFixture inherits from ServiceContextFixture, which already makes a global ServiceContext available. This means that many of the aggregation stage unit tests actually have (at least) two service contexts: one globally and another as part of the ExpressionContextForTest.

      While there is no immediate bug here, this was responsible for:

      SERVER-41053

      And also caused a lot of confusion while doing investigations for

      SERVER-41042 and SERVER-39447

       

      The ownership hierarchy should probably changed so that there's just one ServiceContext for the lifetime of the test which is threaded through ExpressionContextForTest.

      Attachments

        Activity

          People

            ruoxin.xu@mongodb.com Ruoxin Xu
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: