Permalink
Browse files

SERVER-3513 standardize on 32mb limit for scan and order

  • Loading branch information...
1 parent d8d05fd commit b7789923b374237054713ae255979c73ca937f23 @erh erh committed Aug 1, 2011
Showing with 5 additions and 3 deletions.
  1. +4 −2 db/scanandorder.cpp
  2. +1 −1 db/scanandorder.h
View
6 db/scanandorder.cpp
@@ -23,6 +23,8 @@
namespace mongo {
+ const unsigned ScanAndOrder::MaxScanAndOrderBytes = 32 * 1024 * 1024;
+
void ScanAndOrder::_add(BSONObj& k, BSONObj o, DiskLoc* loc) {
if (!loc) {
_best.insert(make_pair(k.getOwned(),o.getOwned()));
@@ -58,7 +60,7 @@ namespace mongo {
_approxSize += o.objsize();
/* note : adjust when bson return limit adjusts. note this limit should be a bit higher. */
- uassert( 10128 , "too much data for sort() with no index. add an index or specify a smaller limit", _approxSize < 32 * 1024 * 1024 );
+ uassert( 10128 , "too much data for sort() with no index. add an index or specify a smaller limit", _approxSize < MaxScanAndOrderBytes );
_add(k, o, loc);
return;
@@ -83,7 +85,7 @@ namespace mongo {
nFilled++;
if ( nFilled >= _limit )
break;
- uassert( 10129 , "too much data for sort() with no index", b.len() < 4000000 ); // appserver limit
+ uassert( 10129 , "too much data for sort() with no index", b.len() < (int)MaxScanAndOrderBytes ); // appserver limit
}
nout = nFilled;
}
View
2 db/scanandorder.h
@@ -78,7 +78,7 @@ namespace mongo {
typedef multimap<BSONObj,BSONObj,BSONObjCmp> BestMap;
class ScanAndOrder {
public:
- static const int MaxScanAndOrderBytes;
+ static const unsigned MaxScanAndOrderBytes;
ScanAndOrder(int startFrom, int limit, BSONObj order, const FieldRangeSet &frs) :
_best( BSONObjCmp( order ) ),

0 comments on commit b778992

Please sign in to comment.