|
Observed behavior: A memory assertion is not triggered if the combined memory usage of several stages exceeds 10% of physical ram, so long as no single sort stage exceeds 10% of physical ram.
Expected behavior: A memory assertion is triggered if the combined memory usage exceeds 10% of physical ram.
Right now memory usage is only tracked separately for each sort stage.
Test
c = db.c;
|
c.drop();
|
|
big = new Array( 10000 + 1 ).toString();
|
|
for( i = 0; i < 40000; ++i ) {
|
c.save( { x:i, y:i, z:i, b:big } );
|
}
|
|
printjson( c.aggregate( { $sort:{ x:1 } }, { $sort:{ y:1 } }, { $sort:{ z:1 } }, { $limit:1 } ) );
|
The test ran on a machine where the total data size was between 5% and 10% of physical ram. Each sort stage separately warned of memory usage exceeding 5% of physical ram, but the combined memory usage of the sort stages was not calculated or reported on.
Mon Jul 2 06:55:58 [conn6] warning: warning, 5% of physical RAM used for [ { $sort: { x: 1 } } ]
|
warning, 5% of physical RAM used for [ { $sort: { y: 1 } } ]
|
warning, 5% of physical RAM used for [ { $sort: { z: 1 } } ]
|
|