[SERVER-25419] mongos doesn't recognize the $facet stage Created: 03/Aug/16  Updated: 13/Aug/16  Resolved: 04/Aug/16

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 3.3.9
Fix Version/s: 3.3.11

Type: Bug Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Max Hirschhorn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run the $facet stage against a sharded cluster through mongos on a database for which sharding has been enabled.

python buildscripts/resmoke.py --executor=sharding_jscore_passthrough jstests/aggregation/sources/facet/inner_lookup.js

Output

[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400 2016-08-02T21:45:30.030-0400 E QUERY    [thread1] Error: command failed: {
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400   "code" : 16436,
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400   "ok" : 0,
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400   "errmsg" : "Unrecognized pipeline stage name: '$facet'"
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400 } : aggregate failed :
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400 _getErrorWithCode@src/mongo/shell/utils.js:25:13
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400 doassert@src/mongo/shell/assert.js:13:14
[js_test:inner_lookup] 2016-08-02T21:45:30.031-0400 assert.commandWorked@src/mongo/shell/assert.js:264:5
[js_test:inner_lookup] 2016-08-02T21:45:30.032-0400 DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1299:5
[js_test:inner_lookup] 2016-08-02T21:45:30.032-0400 @jstests/aggregation/sources/facet/inner_lookup.js:25:34
[js_test:inner_lookup] 2016-08-02T21:45:30.032-0400 @jstests/aggregation/sources/facet/inner_lookup.js:5:2
[js_test:inner_lookup] 2016-08-02T21:45:30.032-0400
[js_test:inner_lookup] 2016-08-02T21:45:30.032-0400 failed to load: jstests/aggregation/sources/facet/inner_lookup.js

Sprint: Query 18 (08/05/16)
Participants:

 Description   

The mongo/s/commands/cluster_commands library in mongos depends on the mongo/db/pipeline/pipeline library, which doesn't include the $facet stage. Since the $facet stage depends on both the pipeline and document_source libraries, it exists as its own document_source_facet library. We should change mongos to link against the mongo/db/pipeline/aggregation library instead.

The jstests/aggregation/sources/facet/use_cases.js test runs the $facet stage against a sharded cluster through mongos, but failed to catch this issue for a couple of reasons:

  1. The implementation of the "aggregate" command in mongos skips parsing the pipeline when the database the command is being run on doesn't have sharding enabled.
  2. The test case for a $facet stage on a database with sharding enabled was expected to fail because it was designed to test that a $lookup on a sharded collection was still disallowed.


 Comments   
Comment by Githook User [ 04/Aug/16 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-25419 Make the dependency of mongos on aggregation explicit.
Branch: master
https://github.com/mongodb/mongo/commit/bb273eadd4d930ab9de07e5e1004a42f7ae0b4d4

Comment by Max Hirschhorn [ 03/Aug/16 ]

This issue was technically resolved by making the cluster_commands library depend on the mongo/db/views/views library as part of the changes from SERVER-24762 because the views library depends on the aggregation library. However, we should still make this dependency explicit instead of relying on it being a transitive dependency.

Generated at Thu Feb 08 04:09:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.