Add an assertion that the in-use bytes are zero in the MemoryTracker destructor

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • 0

      The work of this ticket will involve
      1) adding the assertion in the destructor
      2) removing the checkInUseMemBytesResets parameter from memory tracking tests

      The checkInUseMemBytesResets parameter was added to get $setWindowFields to skip a test case in our memory tracking suite where we check that the current memory tally goes to zero when the cursor is exhausted.

      This ticket will involve investigating how we can reset inUseMemBytes when $setWindowFields (and other memory-tracked stages) are done processing and removing this check.

      We tried to force the current memory tally to go to zero by calling memoryTracker.resetCurrent() in setWindowField's doDispose() method, but that triggered an underflow in memory when testing a $setWindowFields when followed by a $limit that forced the $setWindowFields to return early.

          const pipeline = [
              {$match: {symbol: "AAPL"}},
              {
                  $setWindowFields: {
                      sortBy: {date: 1},
                      output: {
                          "movingAvgPrice": {$avg: "$price", window: {documents: [-5, 0]}},
                          "cumulativeVolume":
                              {$sum: "$volume", window: {documents: ["unbounded", "current"]}}
                      }
                  }
              },
              {$limit: 3},
          ];
          jsTestLog("Running pipeline with $limit " + tojson(pipeline));
      
          runMemoryStatsTest(db,
                             collName,
                             pipeline,
                             "memory stats setWindowFields test", /*pipelineComment*/
                             "_internalSetWindowFields",          /*stageName*/
                             3 /*expectedNumGetMores*/);
      

            Assignee:
            Unassigned
            Reporter:
            Erin Liang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: