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

Make HashAgg record store key owned

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc10, 6.0.0-rc11
    • Affects Version/s: 6.1.0-rc0
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.0
    • Hide
      (function() {
      "use strict";
      
      const memoryLimitMb = 1;
      const memoryLimitBytes = memoryLimitMb * 1024 * 1024;
      
      // Start mongod with reduced memory limit for the $group stage.
      const conn = MongoRunner.runMongod({
          setParameter: {
              internalDocumentSourceGroupMaxMemoryBytes: memoryLimitBytes,
              internalQuerySlotBasedExecutionHashAggApproxMemoryUseInBytesBeforeSpill: memoryLimitBytes
          }
      });
      const testDb = conn.getDB(jsTestName());
      
      // Create a collection exceeding the memory limit.
      testDb.largeColl.drop();
      const largeStr = "A".repeat(1024 * 1024);  // 1MB string
      for (let i = 0; i < memoryLimitMb + 1; ++i)
          assert.commandWorked(testDb.largeColl.insert({x: i, largeStr: largeStr + i}));
      
      const pipeline = [{$group: {_id: '$largeStr', minId: {$min: '$_id'}}}];
      // Make sure that the pipeline needs to spill to disk.
      assert.throwsWithCode(() => testDb.largeColl.aggregate(pipeline, {allowDiskUse: false}),
                            ErrorCodes.QueryExceededMemoryLimitNoDiskUseAllowed);
      testDb.largeColl.aggregate(pipeline);
      
      MongoRunner.stopMongod(conn);
      })();
      
      Show
      (function() { "use strict" ; const memoryLimitMb = 1; const memoryLimitBytes = memoryLimitMb * 1024 * 1024; // Start mongod with reduced memory limit for the $group stage. const conn = MongoRunner.runMongod({ setParameter: { internalDocumentSourceGroupMaxMemoryBytes: memoryLimitBytes, internalQuerySlotBasedExecutionHashAggApproxMemoryUseInBytesBeforeSpill: memoryLimitBytes } }); const testDb = conn.getDB(jsTestName()); // Create a collection exceeding the memory limit. testDb.largeColl.drop(); const largeStr = "A" .repeat(1024 * 1024); // 1MB string for (let i = 0; i < memoryLimitMb + 1; ++i) assert .commandWorked(testDb.largeColl.insert({x: i, largeStr: largeStr + i})); const pipeline = [{$group: {_id: '$largeStr' , minId: {$min: '$_id' }}}]; // Make sure that the pipeline needs to spill to disk. assert .throwsWithCode(() => testDb.largeColl.aggregate(pipeline, {allowDiskUse: false }), ErrorCodes.QueryExceededMemoryLimitNoDiskUseAllowed); testDb.largeColl.aggregate(pipeline); MongoRunner.stopMongod(conn); })();
    • QE 2022-06-13, QE 2022-06-27

          Assignee:
          eric.cox@mongodb.com Eric Cox (Inactive)
          Reporter:
          romans.kasperovics@mongodb.com Romans Kasperovics
          Votes:
          0 Vote for this issue
          Watchers:
          11 Start watching this issue

            Created:
            Updated:
            Resolved: