summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-02-19 14:27:25 -0500
committerEliot Horowitz <eliot@10gen.com>2010-02-20 16:40:27 -0500
commitbf7640dfa8474784486a00d24381b934cb4e0207 (patch)
treea1ddfe4d5eeec1802ee19047ba0f86cee0c6c816
parentd95fa41f505267d179d335588a2c5ebe3a190e45 (diff)
downloadmongo-bf7640dfa8474784486a00d24381b934cb4e0207.tar.gz
more tweaks for determining maxPasses SERVER-649
-rw-r--r--db/namespace.cpp8
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 );