summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-21 17:17:20 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-21 17:17:20 -0400
commit93382dd24ebce3268417ee73bd015d102fedebea (patch)
treec7545d069cf0c4a718457874b5aa775ac330692c
parent4be8bfc8054131a7dc092ff09c7d05bde086ef3f (diff)
downloadmongo-93382dd24ebce3268417ee73bd015d102fedebea.tar.gz
fix case where there is a large object early in a collection that is bigger than an early sized extent
-rw-r--r--db/pdfile.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/db/pdfile.cpp b/db/pdfile.cpp
index ad1a7eaefd1..9f054bbc05c 100644
--- a/db/pdfile.cpp
+++ b/db/pdfile.cpp
@@ -1282,9 +1282,18 @@ assert( !eloc.isNull() );
if ( loc.isNull() ) {
// out of space
if ( d->capped == 0 ) { // size capped doesn't grow
- log(1) << "allocating new extent for " << ns << " padding:" << d->paddingFactor << endl;
+ log(1) << "allocating new extent for " << ns << " padding:" << d->paddingFactor << " lenWHdr: " << lenWHdr << endl;
database->newestFile()->allocExtent(ns, followupExtentSize(len, d->lastExtentSize));
loc = d->alloc(ns, lenWHdr, extentLoc);
+ if ( loc.isNull() ){
+ log() << " alloc failed after allocating new extent. lenWHdr: " << lenWHdr << " last extent size:" << d->lastExtentSize << " trying again" << endl;
+ for ( int zzz=0; zzz<10 && lenWHdr > d->lastExtentSize; zzz++ ){
+ database->newestFile()->allocExtent(ns, followupExtentSize(len, d->lastExtentSize));
+ loc = d->alloc(ns, lenWHdr, extentLoc);
+ if ( ! loc.isNull() )
+ break;
+ }
+ }
}
if ( loc.isNull() ) {
log() << "out of space in datafile " << ns << " capped:" << d->capped << endl;