diff options
Diffstat (limited to 'db/namespace.cpp')
-rw-r--r-- | db/namespace.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/db/namespace.cpp b/db/namespace.cpp index dc8f13ee93f..b460f789de9 100644 --- a/db/namespace.cpp +++ b/db/namespace.cpp @@ -448,7 +448,11 @@ namespace mongo { assert( len < 400000000 ); int passes = 0; - const int maxPasses = len / 30; // 30 is about the smallest entry that could go in the oplog + int maxPasses = len / 32; // 30 is about the smallest entry that could go in the oplog + if ( maxPasses < 5000 ){ + // this is for bacwards safety since 5000 was the old value + maxPasses = 5000; + } DiskLoc loc; // delete records until we have room and the max # objects limit achieved. @@ -497,7 +501,7 @@ namespace mongo { DiskLoc fr = theCapExtent()->firstRecord; theDataFileMgr.deleteRecord(ns, fr.rec(), fr, true); compact(); - if( ++passes >= maxPasses ) { + if( ++passes > maxPasses ) { log() << "passes ns:" << ns << " len:" << len << " maxPasses: " << maxPasses << '\n'; log() << "passes max:" << max << " nrecords:" << nrecords << " datasize: " << datasize << endl; massert( "passes >= maxPasses in capped collection alloc", false ); |