summaryrefslogtreecommitdiff
path: root/db/mr.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-12-04 16:20:13 -0500
committerEliot Horowitz <eliot@10gen.com>2009-12-04 16:20:13 -0500
commitdf76570973552d78eea23512c270064f039bb147 (patch)
tree9f6bb64127eafdb034947e23202369080ac21aa3 /db/mr.cpp
parent851a94b853f044a4954f3463ce8da0b88a77dedb (diff)
downloadmongo-df76570973552d78eea23512c270064f039bb147.tar.gz
change map/reduce locking strategy
Diffstat (limited to 'db/mr.cpp')
-rw-r--r--db/mr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/db/mr.cpp b/db/mr.cpp
index 58d28164d12..00b0c295267 100644
--- a/db/mr.cpp
+++ b/db/mr.cpp
@@ -372,7 +372,6 @@ namespace mongo {
BSONObjBuilder countsBuilder;
BSONObjBuilder timingBuilder;
try {
- dbtemprelease temprlease;
MRState state( mr );
state.scope->injectNative( "emit" , fast_emit );
@@ -394,12 +393,13 @@ namespace mongo {
throw UserException( (string)"map invoke failed: " + state.scope->getError() );
if ( mr.verbose ) mapTime += mt.micros();
-
+
num++;
if ( num % 100 == 0 ){
Timer t;
mrtl->checkSize();
inReduce += t.micros();
+ dbtemprelease temprlease;
}
pm.hit();
@@ -407,7 +407,6 @@ namespace mongo {
break;
}
-
countsBuilder.append( "input" , num );
countsBuilder.append( "emit" , mrtl->numEmits );
if ( mrtl->numEmits )
@@ -429,6 +428,7 @@ namespace mongo {
ProgressMeter fpm( db.count( mr.incLong ) );
cursor = db.query( mr.incLong, Query().sort( sortKey ) );
+
while ( cursor->more() ){
BSONObj o = cursor->next().getOwned();
@@ -443,6 +443,7 @@ namespace mongo {
prev = o;
all.push_back( o );
fpm.hit();
+ dbtemprelease tl;
}
state.finalReduce( all );