diff options
Diffstat (limited to 'db/pdfile.cpp')
-rw-r--r-- | db/pdfile.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 1c4608c..e46ffb7 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -45,6 +45,8 @@ _ disallow system* manipulations from the database. namespace mongo { + const int MaxExtentSize = 0x7ff00000; + map<string, unsigned> BackgroundOperation::dbsInProg; set<string> BackgroundOperation::nsInProg; @@ -357,7 +359,7 @@ namespace mongo { Extent* MongoDataFile::createExtent(const char *ns, int approxSize, bool newCapped, int loops) { massert( 10357 , "shutdown in progress", !goingAway ); - massert( 10358 , "bad new extent size", approxSize >= 0 && approxSize <= 0x7ff00000 ); + massert( 10358 , "bad new extent size", approxSize >= 0 && approxSize <= MaxExtentSize ); massert( 10359 , "header==0 on new extent: 32 bit mmap space exceeded?", header ); // null if file open failed int ExtentSize = approxSize <= header->unusedLength ? approxSize : header->unusedLength; DiskLoc loc; @@ -919,11 +921,19 @@ namespace mongo { } int followupExtentSize(int len, int lastExtentLen) { + assert( len < MaxExtentSize ); int x = initialExtentSize(len); int y = (int) (lastExtentLen < 4000000 ? lastExtentLen * 4.0 : lastExtentLen * 1.2); int sz = y > x ? y : x; + + if ( sz < lastExtentLen ) + sz = lastExtentLen; + else if ( sz > MaxExtentSize ) + sz = MaxExtentSize; + sz = ((int)sz) & 0xffffff00; assert( sz > len ); + return sz; } @@ -1141,7 +1151,7 @@ namespace mongo { break; } } - progress.done(); + progress.finished(); return n; } @@ -1192,7 +1202,7 @@ namespace mongo { // throws DBException static void buildAnIndex(string ns, NamespaceDetails *d, IndexDetails& idx, int idxNo, bool background) { - log() << "building new index on " << idx.keyPattern() << " for " << ns << endl; + log() << "building new index on " << idx.keyPattern() << " for " << ns << ( background ? " background" : "" ) << endl; Timer t; unsigned long long n; |