diff options
-rw-r--r-- | db/pdfile.cpp | 11 |
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; |