summaryrefslogtreecommitdiff
path: root/db/extsort.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'db/extsort.cpp')
-rw-r--r--db/extsort.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/db/extsort.cpp b/db/extsort.cpp
index 751c63e650f..0f317f7a00c 100644
--- a/db/extsort.cpp
+++ b/db/extsort.cpp
@@ -88,10 +88,20 @@ namespace mongo {
_cur = new InMemory();
}
- _cur->push_back( pair<BSONObj,DiskLoc>( o.getOwned() , loc ) );
+ BSONObj toadd = o;
+ if ( toadd.isOwned() ){
+ // hack to handle buffer problems
+ if ( toadd.objsize() < 100 )
+ toadd = toadd.copy();
+ }
+ else {
+ toadd = toadd.getOwned();
+ }
+
+ _cur->push_back( pair<BSONObj,DiskLoc>( o , loc ) );
long size = o.objsize();
- _curSizeSoFar += size + sizeof( DiskLoc );
+ _curSizeSoFar += size + sizeof( DiskLoc ) + sizeof( BSONObj );
if ( _curSizeSoFar > _maxFilesize )
finishMap();