Permalink
Browse files

SERVER-4549: MR: using both jsMode and inline mode does not yield any…

… output
  • Loading branch information...
1 parent 0e5d68e commit 0e95e3627ec7a81f4bcd6975ac292668ac98b10b @agirbal agirbal committed Feb 15, 2012
Showing with 10 additions and 9 deletions.
  1. +8 −8 jstests/mr2.js
  2. +1 −1 src/mongo/db/commands/mr.cpp
  3. +1 −0 src/mongo/db/commands/mr.h
View
16 jstests/mr2.js
@@ -72,12 +72,12 @@ assert.eq( 16 , x.b.avg , "A2" );
assert.eq( 18 , x.c.avg , "A3" );
res.drop();
-//res = t.mapReduce( m , r , { finalize : f , out : { inline : 1 }, jsMode: true } );
-//printjson( res )
-//x = reformat( res );
-//assert.eq( 9 , x.a.avg , "B1" );
-//assert.eq( 16 , x.b.avg , "B2" );
-//assert.eq( 18 , x.c.avg , "B3" );
-//res.drop();
-//assert( ! ( "result" in res ) , "B4" )
+res = t.mapReduce( m , r , { finalize : f , out : { inline : 5 }, jsMode: true } );
+printjson( res )
+x = reformat( res );
+assert.eq( 9 , x.a.avg , "B1" );
+assert.eq( 16 , x.b.avg , "B2" );
+assert.eq( 18 , x.c.avg , "B3" );
+res.drop();
+assert( ! ( "result" in res ) , "B4" )
View
2 src/mongo/db/commands/mr.cpp
@@ -457,7 +457,7 @@ namespace mongo {
*/
long long State::postProcessCollection(CurOp* op, ProgressMeterHolder& pm) {
if ( _onDisk == false || _config.outType == Config::INMEMORY )
- return _temp->size();
+ return numInMemKeys();
if (_config.outNonAtomic)
return postProcessCollectionNonAtomic(op, pm);
View
1 src/mongo/db/commands/mr.h
@@ -285,6 +285,7 @@ namespace mongo {
long long numEmits() const { if (_jsMode) return _scope->getNumberLongLong("_emitCt"); return _numEmits; }
long long numReduces() const { if (_jsMode) return _scope->getNumberLongLong("_redCt"); return _config.reducer->numReduces; }
+ long long numInMemKeys() const { if (_jsMode) return _scope->getNumberLongLong("_keyCt"); return _temp->size(); }
bool jsMode() {return _jsMode;}
void switchMode(bool jsMode);

0 comments on commit 0e95e36

Please sign in to comment.