-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
None
-
Fully Compatible
-
ALL
-
ISSUE SUMMARY
The aggregate command only respects the slaveOk bit if the collection the aggregate command is run against is sharded. For unsharded collections aggregate is always sent to the primary.
USER IMPACT
This only impacts unsharded collections in a sharded cluster. A user can inadvertently send aggregate commands via mongos to unsharded collections to a primary replica set member when they were intended for a secondary member. This could cause unexpected load on the shard primary node and impact performance. It is present in versions of MongoDB prior to and including v2.4.6.
SOLUTION
Pass the query options to the aggregate command
WORKAROUNDS
No workaround.
PATCHES
Production release v2.4.7 contains the fix for this issue, and production release v2.6.0 will contain the fix as well.
Original Description
The summary says it all. The aggregate command only respects the slaveOk bit if the collection the aggregate command is run against is sharded. For unsharded collections aggregate is always sent to the primary.
The problem only seems to exist with the aggregate command. Commands like count and distinct seem to respect slaveOk properly.
- is depended on by
-
PYTHON-559 Aggregations are not performed on a secondary with SECONDARY_PREFERRED
- Closed
- related to
-
SERVER-9441 Secondaries execute distinct/aggregate commands irrespective of slaveOk bit
- Closed