diff options
-rw-r--r-- | db/curop.h | 4 | ||||
-rw-r--r-- | db/mr.cpp | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/db/curop.h b/db/curop.h index 86c0cdcfbc1..e5d38d7f258 100644 --- a/db/curop.h +++ b/db/curop.h @@ -264,12 +264,12 @@ namespace mongo { future: maybe use this as a "going away" thing on process termination with a higher flag value */ extern class KillCurrentOp { - enum { Off, On, All } state; + enum { Off, On, All } state; AtomicUInt toKill; public: void killAll() { state = All; } void kill(AtomicUInt i) { toKill = i; state = On; } - + void checkForInterrupt() { if( state != Off ) { if( state == All ) diff --git a/db/mr.cpp b/db/mr.cpp index 9e5220e6b82..6d863ff3642 100644 --- a/db/mr.cpp +++ b/db/mr.cpp @@ -432,6 +432,7 @@ namespace mongo { Timer t; mrtl->checkSize(); inReduce += t.micros(); + killCurrentOp.checkForInterrupt(); dbtemprelease temprlease; } pm.hit(); @@ -441,8 +442,8 @@ namespace mongo { } pm.finished(); - countsBuilder.append( "input" , num ); - countsBuilder.append( "emit" , mrtl->numEmits ); + countsBuilder.appendNumber( "input" , num ); + countsBuilder.appendNumber( "emit" , mrtl->numEmits ); if ( mrtl->numEmits ) shouldHaveData = true; @@ -479,6 +480,7 @@ namespace mongo { prev = o; all.push_back( o ); pm.hit(); + killCurrentOp.checkForInterrupt(); dbtemprelease tl; } state.finalReduce( all ); @@ -500,7 +502,7 @@ namespace mongo { result.append( "result" , mr.finalShort ); result.append( "timeMillis" , t.millis() ); - countsBuilder.append( "output" , finalCount ); + countsBuilder.appendNumber( "output" , finalCount ); if ( mr.verbose ) result.append( "timing" , timingBuilder.obj() ); result.append( "counts" , countsBuilder.obj() ); |