Skip to content

Commit

Permalink
chore(mongodb-explain-compat): add 7.2 mongos unsharded collection ex…
Browse files Browse the repository at this point in the history
…plain COMPASS-7603 (#5398)

It doesn't look like code changes are necessary for us, so just adding example data
as a test case here should be enough for this ticket.
  • Loading branch information
addaleax authored Feb 1, 2024
1 parent 9e100e0 commit 3e6190b
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"serverInfo": {
"host": "M-C02D23CNMD6R",
"port": 27017,
"version": "7.3.0-alpha1-184-gef22b28",
"gitVersion": "ef22b2853f29e36ff86c78e8f3d5627508252826"
},
"serverParameters": {
"internalQueryFacetBufferSizeBytes": 104857600,
"internalQueryFacetMaxOutputDocSizeBytes": 104857600,
"internalLookupStageIntermediateDocumentMaxSizeBytes": 104857600,
"internalDocumentSourceGroupMaxMemoryBytes": 104857600,
"internalQueryMaxBlockingSortMemoryUsageBytes": 104857600,
"internalQueryProhibitBlockingMergeOnMongoS": 0,
"internalQueryMaxAddToSetBytes": 104857600,
"internalDocumentSourceSetWindowFieldsMaxMemoryBytes": 104857600,
"internalQueryFrameworkControl": "trySbeRestricted"
},
"splitPipeline": null,
"shards": {
"replSet-a3becde9-cc49-4b7d-94c8-266bc36068ef": {
"host": "127.0.0.1:64745",
"stages": [
{
"$cursor": {
"queryPlanner": {
"namespace": "test.coll",
"indexFilterSet": false,
"parsedQuery": {},
"queryHash": "E0087D7B",
"planCacheKey": "2FE566FB",
"optimizationTimeMillis": 0,
"maxIndexedOrSolutionsReached": false,
"maxIndexedAndSolutionsReached": false,
"maxScansToExplodeReached": false,
"winningPlan": {
"isCached": false,
"stage": "PROJECTION_SIMPLE",
"transformBy": {
"_id": true,
"author": true,
"tags": true
},
"inputStage": {
"stage": "COLLSCAN",
"direction": "forward"
}
},
"rejectedPlans": []
}
}
},
{
"$unwind": {
"path": "$tags"
}
},
{
"$group": {
"_id": {
"tags": "$tags"
},
"authors": {
"$addToSet": "$author"
}
}
}
]
}
},
"command": {
"aggregate": "coll",
"pipeline": [
{
"$project": {
"author": 1,
"tags": 1
}
},
{
"$unwind": "$tags"
},
{
"$group": {
"_id": {
"tags": "$tags"
},
"authors": {
"$addToSet": "$author"
}
}
}
],
"cursor": {}
},
"ok": 1,
"$clusterTime": {
"clusterTime": {
"$timestamp": "7329888704586055681"
},
"signature": {
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"keyId": {
"low": 0,
"high": 0,
"unsigned": false
}
}
},
"operationTime": {
"$timestamp": "7329888691701153793"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"serverInfo": {
"host": "M-C02D23CNMD6R",
"port": 27017,
"version": "7.3.0-alpha1-184-gef22b28",
"gitVersion": "ef22b2853f29e36ff86c78e8f3d5627508252826"
},
"serverParameters": {
"internalQueryFacetBufferSizeBytes": 104857600,
"internalQueryFacetMaxOutputDocSizeBytes": 104857600,
"internalLookupStageIntermediateDocumentMaxSizeBytes": 104857600,
"internalDocumentSourceGroupMaxMemoryBytes": 104857600,
"internalQueryMaxBlockingSortMemoryUsageBytes": 104857600,
"internalQueryProhibitBlockingMergeOnMongoS": 0,
"internalQueryMaxAddToSetBytes": 104857600,
"internalDocumentSourceSetWindowFieldsMaxMemoryBytes": 104857600,
"internalQueryFrameworkControl": "trySbeRestricted"
},
"splitPipeline": null,
"shards": {
"replSet-a3becde9-cc49-4b7d-94c8-266bc36068ef": {
"host": "127.0.0.1:64745",
"stages": [
{
"$cursor": {
"queryPlanner": {
"namespace": "test.coll",
"indexFilterSet": false,
"parsedQuery": {},
"queryHash": "E0087D7B",
"planCacheKey": "2FE566FB",
"optimizationTimeMillis": 0,
"maxIndexedOrSolutionsReached": false,
"maxIndexedAndSolutionsReached": false,
"maxScansToExplodeReached": false,
"winningPlan": {
"isCached": false,
"stage": "PROJECTION_SIMPLE",
"transformBy": {
"_id": true,
"author": true,
"tags": true
},
"inputStage": {
"stage": "COLLSCAN",
"direction": "forward"
}
},
"rejectedPlans": []
}
}
},
{
"$unwind": {
"path": "$tags"
}
},
{
"$group": {
"_id": {
"tags": "$tags"
},
"authors": {
"$addToSet": "$author"
}
}
}
]
}
},
"command": {
"aggregate": "coll",
"pipeline": [
{
"$project": {
"author": 1,
"tags": 1
}
},
{
"$unwind": "$tags"
},
{
"$group": {
"_id": {
"tags": "$tags"
},
"authors": {
"$addToSet": "$author"
}
}
}
],
"cursor": {}
},
"ok": 1,
"$clusterTime": {
"clusterTime": {
"$timestamp": "7329888704586055681"
},
"signature": {
"hash": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"keyId": {
"low": 0,
"high": 0,
"unsigned": false
}
}
},
"operationTime": {
"$timestamp": "7329888691701153793"
}
}
6 changes: 6 additions & 0 deletions packages/mongodb-explain-compat/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ describe('convertExplainCompat', () => {
fixture('unsharded-find.sbe.out')
);
});
it('handles 7.2 (SERVER-79724) changes to mongos explain for unsharded collections', () => {
assert.deepStrictEqual(
convertExplainCompat(fixture('unsharded-aggregate-on-mongos.7.2.in')),
fixture('unsharded-aggregate-on-mongos.7.2.out')
);
});
});

describe('explain mode "queryPlanner"', function () {
Expand Down

0 comments on commit 3e6190b

Please sign in to comment.