diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-03-16 00:09:52 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-03-16 00:09:52 -0400 |
commit | c09ded578037bab3cd1d3ac6b215cda001f2c899 (patch) | |
tree | 37bb8c9d10ecbc0d6813213081312515e933934b | |
parent | 3f6d78ca29529446362440c5ae209c40019f8cbe (diff) | |
download | mongo-c09ded578037bab3cd1d3ac6b215cda001f2c899.tar.gz |
make killOp work for map reduce SERVER-387
-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() ); |