summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-09-24 17:24:45 -0400
committerEliot Horowitz <eliot@10gen.com>2009-09-24 17:24:45 -0400
commit1981f140a85848869ea6ae3d0de49be86ed51555 (patch)
tree345d706e1bb30d3a28c8e895bcad593fc23219fc /db
parentd1ba3c244ab784d1745fbbc8f65bd754795f522f (diff)
downloadmongo-1981f140a85848869ea6ae3d0de49be86ed51555.tar.gz
extsort cleaning
Diffstat (limited to 'db')
-rw-r--r--db/extsort.cpp10
-rw-r--r--db/extsort.h2
2 files changed, 4 insertions, 8 deletions
diff --git a/db/extsort.cpp b/db/extsort.cpp
index 781a87a9bb5..d5951055549 100644
--- a/db/extsort.cpp
+++ b/db/extsort.cpp
@@ -28,8 +28,8 @@
namespace mongo {
BSONObjExternalSorter::BSONObjExternalSorter( const BSONObj & order , long maxFileSize )
- : _order( order ) , _maxFilesize( maxFileSize ) ,
- _map(0), _mapSizeSoFar(0), _largestObject(0), _sorted(0){
+ : _order( order.getOwned() ) , _maxFilesize( maxFileSize ) ,
+ _map(0), _mapSizeSoFar(0), _sorted(0){
stringstream rootpath;
rootpath << dbpath;
@@ -77,12 +77,10 @@ namespace mongo {
_map = new InMemory( _order );
}
- _map->insert( pair<BSONObj,DiskLoc>( o , loc ) );
+ _map->insert( pair<BSONObj,DiskLoc>( o.getOwned() , loc ) );
long size = o.objsize();
_mapSizeSoFar += size + sizeof( DiskLoc );
- if ( size > _largestObject )
- _largestObject = size;
if ( _mapSizeSoFar > _maxFilesize )
finishMap();
@@ -101,7 +99,7 @@ namespace mongo {
string file = ss.str();
ofstream out;
- out.open( file.c_str() );
+ out.open( file.c_str() , ios_base::out | ios_base::binary );
uassert( (string)"couldn't open file: " + file , out.good() );
int num = 0;
diff --git a/db/extsort.h b/db/extsort.h
index 1e1b1e43071..244fedc1e61 100644
--- a/db/extsort.h
+++ b/db/extsort.h
@@ -107,8 +107,6 @@ namespace mongo {
InMemory * _map;
long _mapSizeSoFar;
- long _largestObject;
-
list<string> _files;
bool _sorted;
};