diff options
author | Kevin Cherkauer <kevin.cherkauer@mongodb.com> | 2022-12-20 22:42:30 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-12-20 23:42:55 +0000 |
commit | aa841fd244431e841b47232ad9deb668704cc402 (patch) | |
tree | 970dd99a3bd0b18fe7cbf2895e0ffdd59eb8b8ff | |
parent | eccc34a401de6bbb7fe56f6ad3a9aee3a2efe008 (diff) | |
download | mongo-aa841fd244431e841b47232ad9deb668704cc402.tar.gz |
SERVER-72280 Named Pipes: Remove $lookup tests
-rw-r--r-- | jstests/concurrency/fsm_workloads_no_passthrough_with_mongod/external_data_source.js | 74 | ||||
-rw-r--r-- | jstests/noPassthrough/external_data_source.js | 154 |
2 files changed, 5 insertions, 223 deletions
diff --git a/jstests/concurrency/fsm_workloads_no_passthrough_with_mongod/external_data_source.js b/jstests/concurrency/fsm_workloads_no_passthrough_with_mongod/external_data_source.js index afed422d8d1..9b31a4424c3 100644 --- a/jstests/concurrency/fsm_workloads_no_passthrough_with_mongod/external_data_source.js +++ b/jstests/concurrency/fsm_workloads_no_passthrough_with_mongod/external_data_source.js @@ -214,85 +214,21 @@ var $config = (function() { jsTestLog(`${this.tid} is done with group`); } - function lookup(db, collName) { - jsTestLog(`${this.tid} running lookup`); - - const localColl = this.localCollObjs; - const foreignColl = this.foreignCollObjs; - _writeTestPipeObjects( - this.pipeName2, foreignColl.length, foreignColl, this.kDefaultPipePath); - _writeTestPipeObjects( - this.pipeName1, localColl.length, localColl, this.kDefaultPipePath); - - const lookupTable = []; - foreignColl.forEach(obj => { - lookupTable[obj._id] = obj; - }); - const expectedRes = localColl.map(obj => { - let clone = Object.assign({}, obj); - clone.out = [lookupTable[obj.g]]; - return clone; - }); - - let resArr = db[this.vcollName1] - .aggregate( - [ - { - $lookup: { - from: this.vcollName2, - localField: "g", - foreignField: "_id", - as: "out" - } - } - ], - { - $_externalDataSources: [ - { - collName: this.vcollName1, - dataSources: [{ - url: kUrlProtocolFile + this.pipeName1, - storageType: "pipe", - fileType: "bson" - }] - }, - { - collName: this.vcollName2, - dataSources: [{ - url: kUrlProtocolFile + this.pipeName2, - storageType: "pipe", - fileType: "bson" - }] - } - ] - } - ).toArray(); - assert.eq(resArr.length, expectedRes.length); - for (let i = 0; i < expectedRes.length; ++i) { - assert.eq( - resArr[i], expectedRes[i], `Unexpected obj = ${tojson(resArr[i])} at ${i}`); - } - - jsTestLog(`${this.tid} is done with lookup`); - } - return { init: init, scan: scan, match: match, unionWith: unionWith, group: group, - lookup: lookup, }; })(); var transitions = { - init: {scan: 0.2, match: 0.2, unionWith: 0.2, group: 0.2, lookup: 0.2}, - scan: {scan: 0.2, match: 0.2, unionWith: 0.2, group: 0.2, lookup: 0.2}, - match: {scan: 0.2, match: 0.2, unionWith: 0.2, group: 0.2, lookup: 0.2}, - unionWith: {scan: 0.2, match: 0.2, unionWith: 0.2, group: 0.2, lookup: 0.2}, - group: {scan: 0.2, match: 0.2, unionWith: 0.2, group: 0.2, lookup: 0.2}, - lookup: {scan: 0.2, match: 0.2, unionWith: 0.2, group: 0.2, lookup: 0.2}, + init: {scan: 0.25, match: 0.25, unionWith: 0.25, group: 0.25}, + scan: {scan: 0.25, match: 0.25, unionWith: 0.25, group: 0.25}, + match: {scan: 0.25, match: 0.25, unionWith: 0.25, group: 0.25}, + unionWith: {scan: 0.25, match: 0.25, unionWith: 0.25, group: 0.25}, + group: {scan: 0.25, match: 0.25, unionWith: 0.25, group: 0.25}, }; function setup(db, collName, cluster) { diff --git a/jstests/noPassthrough/external_data_source.js b/jstests/noPassthrough/external_data_source.js index e92872fede4..dd4ec7ff749 100644 --- a/jstests/noPassthrough/external_data_source.js +++ b/jstests/noPassthrough/external_data_source.js @@ -113,22 +113,6 @@ assert.throwsWithCode(() => { }); }, 7039003); -// $lookup's 'from' collection is not an external data source -assert.throwsWithCode(() => { - db.coll.aggregate( - [ - {$match: {a: 1}}, - {$lookup: {from: "unknown2", localField: "a", foreignField: "b", as: "out"}} - ], - { - $_externalDataSources: [{ - collName: "coll", - dataSources: - [{url: kUrlProtocolFile + pipeName1, storageType: "pipe", fileType: "bson"}] - }] - }); -}, 7039004); - (function testSampleStageOverExternalDataSourceNotOptimized() { const explain = db.coll.explain().aggregate([{$sample: {size: 10}}], { $_externalDataSources: [{ @@ -242,76 +226,6 @@ function testSimpleAggregationsOverExternalDataSource(pipeDir) { } } - //////////////////////////////////////////////////////////////////////////////////////////////// - // Test successful lookup between two external data sources. - //////////////////////////////////////////////////////////////////////////////////////////////// - const kObjsToWrite1 = [{"localKey": 0}, {"localKey": 1}, {"localKey": 2}]; - const kObjsToWrite2 = - [{"foreignKey": 0, "foreignVal": "Zero"}, {"foreignKey": 2, "foreignVal": "Two"}]; - const kExpectedLookup = [ - {"localKey": 0, "out": [{"foreignKey": 0, "foreignVal": "Zero"}]}, - {"localKey": 1, "out": []}, - {"localKey": 2, "out": [{"foreignKey": 2, "foreignVal": "Two"}]} - ]; - - // $_externalDataSources specified in order (local, foreign). - _writeTestPipeObjects(pipeName1, kObjsToWrite1.length, kObjsToWrite1, pipeDir); // local - _writeTestPipeObjects(pipeName2, kObjsToWrite2.length, kObjsToWrite2, pipeDir); // foreign - cursor = db.local.aggregate( - [{ - $lookup: - {from: "foreign", localField: "localKey", foreignField: "foreignKey", as: "out"} - }], - { - $_externalDataSources: [ - { - collName: "local", - dataSources: - [{url: kUrlProtocolFile + pipeName1, storageType: "pipe", fileType: "bson"}] - }, - { - collName: "foreign", - dataSources: - [{url: kUrlProtocolFile + pipeName2, storageType: "pipe", fileType: "bson"}] - } - ] - }); - // Verify the $lookup result. - for (let expected = 0; expected < kExpectedLookup.length; ++expected) { - assert.eq(cursor.next(), - kExpectedLookup[expected], - "Lookup result " + expected + " does not match expected."); - } - - // $_externalDataSources specified in order (foreign, local). - _writeTestPipeObjects(pipeName1, kObjsToWrite1.length, kObjsToWrite1, pipeDir); // local - _writeTestPipeObjects(pipeName2, kObjsToWrite2.length, kObjsToWrite2, pipeDir); // foreign - cursor = db.local.aggregate( - [{ - $lookup: - {from: "foreign", localField: "localKey", foreignField: "foreignKey", as: "out"} - }], - { - $_externalDataSources: [ - { - collName: "foreign", - dataSources: - [{url: kUrlProtocolFile + pipeName2, storageType: "pipe", fileType: "bson"}] - }, - { - collName: "local", - dataSources: - [{url: kUrlProtocolFile + pipeName1, storageType: "pipe", fileType: "bson"}] - } - ] - }); - // Verify the $lookup result. - for (let expected = 0; expected < kExpectedLookup.length; ++expected) { - assert.eq(cursor.next(), - kExpectedLookup[expected], - "Lookup result " + expected + " does not match expected."); - } - // Prepares data for $match / $group / $unionWith / spill test cases. Random.setRandomSeed(); const collObjs = []; @@ -454,74 +368,6 @@ function testSimpleAggregationsOverExternalDataSource(pipeDir) { oldSbeGroupMaxMemory, })); })(); - - (function testSpillingLookupOverExternalDataSource() { - // Makes sure that SBE $lookup spill data. - const oldSbeLookupMaxMemory = - assert - .commandWorked(db.adminCommand({ - setParameter: 1, - internalQuerySlotBasedExecutionHashLookupApproxMemoryUseInBytesBeforeSpill: 1, - })) - .was; - - let foreignCollObjs = []; - for (let i = 0; i < kNumGroups; ++i) { - foreignCollObjs.push({ - _id: i, - desc1: "description_" + Random.randInt(kNumGroups), - desc2: "description_" + Random.randInt(kNumGroups), - }); - } - - _writeTestPipeObjects(pipeName2, foreignCollObjs.length, foreignCollObjs, pipeDir); - _writeTestPipeObjects(pipeName1, collObjs.length, collObjs, pipeDir); - - const lookupTable = []; - foreignCollObjs.forEach(obj => { - lookupTable[obj._id] = obj; - }); - const expectedRes = collObjs.map(obj => { - let clone = Object.assign({}, obj); - clone.out = [lookupTable[obj.g]]; - return clone; - }); - - const cursor = db.coll.aggregate( - [{$lookup: {from: "foreign", localField: "g", foreignField: "_id", as: "out"}}], { - $_externalDataSources: [ - { - collName: "coll", - dataSources: [{ - url: kUrlProtocolFile + pipeName1, - storageType: "pipe", - fileType: "bson" - }] - }, - { - collName: "foreign", - dataSources: [{ - url: kUrlProtocolFile + pipeName2, - storageType: "pipe", - fileType: "bson" - }] - } - ] - }); - const resArr = cursor.toArray(); - assert.eq(resArr.length, expectedRes.length); - for (let i = 0; i < expectedRes.length; ++i) { - assert.eq(resArr[i], - expectedRes[i], - `Expected ${tojson(expectedRes[i])} but got ${tojson(resArr[i])}`); - } - - assert.commandWorked(db.adminCommand({ - setParameter: 1, - internalQuerySlotBasedExecutionHashLookupApproxMemoryUseInBytesBeforeSpill: - oldSbeLookupMaxMemory, - })); - })(); } jsTestLog("Testing successful named pipe test cases"); |