[SERVER-6271] $group does not track memory usage Created: 02/Jul/12  Updated: 11/Jul/16  Resolved: 15/Jul/13

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.5.1

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Mathias Stearn
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-6862 improve usability of aggregation sort... Closed
Related
related to SERVER-9444 Use new Sorter for Aggregation $sort ... Closed
related to SERVER-6157 Refactor BSONObjExtSort Closed
Participants:

 Description   

Observed behavior: There is no bound on the amount of memory used by $group.
Expected behavior: $group errors out if it consumes over 10% of physical ram (the same behavior as $sort).

Test

c = db.c;
c.drop();
 
big = new Array( 10000 + 1 ).toString();
 
for( i = 0; i < 100000; ++i ) {
    c.save( { a:i, b:big } );
}
 
// Errs out due to running out of memory.
printjson( c.aggregate( { $sort:{ a:1 } }, { $limit:1 } ) );
 
// Does not err out.
printjson( c.aggregate( { $group:{ _id:'$a', c:{ $addToSet:'$b' } } }, { $limit:1 } ) );



 Comments   
Comment by Mathias Stearn [ 15/Jul/13 ]

Resolved with work on SERVER-9444

Generated at Thu Feb 08 03:11:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.