diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-10-10 20:00:30 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-10-10 20:01:17 -0400 |
commit | d3c3b8a9032e3cd125ebb09bec967441f1451753 (patch) | |
tree | 90e11d693c59117b80d6563efa8616376f375822 /bson | |
parent | f6141d9bac74be42762c234769b44a661cc1f77c (diff) | |
download | mongo-d3c3b8a9032e3cd125ebb09bec967441f1451753.tar.gz |
using BSONObjMaxSize everywhere bson size comes into play
still 4mb, this is just prep for changing SERVER-431
Diffstat (limited to 'bson')
-rw-r--r-- | bson/bsoninlines.h | 2 | ||||
-rw-r--r-- | bson/bsonobj.h | 2 | ||||
-rw-r--r-- | bson/util/builder.h | 15 |
3 files changed, 15 insertions, 4 deletions
diff --git a/bson/bsoninlines.h b/bson/bsoninlines.h index f35bbf7fc8c..cbd3a99ee46 100644 --- a/bson/bsoninlines.h +++ b/bson/bsoninlines.h @@ -99,7 +99,7 @@ namespace mongo { inline bool BSONObj::isValid(){ int x = objsize(); - return x > 0 && x <= 1024 * 1024 * 8; + return x > 0 && x <= BSONObjMaxSize; } inline bool BSONObj::getObjectID(BSONElement& e) const { diff --git a/bson/bsonobj.h b/bson/bsonobj.h index f18bcb63b3f..6c6e374d41b 100644 --- a/bson/bsonobj.h +++ b/bson/bsonobj.h @@ -27,8 +27,6 @@ namespace mongo { typedef set< BSONElement, BSONElementCmpWithoutField > BSONElementSet; - const int BSONObjMaxSize = 32 * 1024 * 1024; - /** C++ representation of a "BSON" object -- that is, an extended JSON-style object in a binary representation. diff --git a/bson/util/builder.h b/bson/util/builder.h index bcdadd9422b..c20c0a5dc28 100644 --- a/bson/util/builder.h +++ b/bson/util/builder.h @@ -27,6 +27,19 @@ namespace mongo { + /* Note the limit here is rather arbitrary and is simply a standard. generally the code works + with any object that fits in ram. + + Also note that the server has some basic checks to enforce this limit but those checks are not exhaustive + for example need to check for size too big after + update $push (append) operation + various db.eval() type operations + + Note also we sometimes do work with objects slightly larger - an object in the replication local.oplog + could be slightly larger. + */ + const int BSONObjMaxSize = 4 * 1024 * 1024; + class StringBuilder; void msgasserted(int msgid, const char *msg); @@ -138,7 +151,7 @@ namespace mongo { a = 512; if ( l > a ) a = l + 16 * 1024; - if( a > 64 * 1024 * 1024 ) + if ( a > 2 * BSONObjMaxSize ) msgasserted(10000, "BufBuilder grow() > 64MB"); data = (char *) realloc(data, a); size= a; |