From 33c79655ab44085865b2210a4196978449140f38 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sun, 21 Nov 2010 13:39:14 -0500 Subject: fix mr temp collection handling with no results --- db/commands/mr.cpp | 11 +++++------ jstests/mr_comments.js | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/db/commands/mr.cpp b/db/commands/mr.cpp index 58d8ab65660..019a27a4bbe 100644 --- a/db/commands/mr.cpp +++ b/db/commands/mr.cpp @@ -207,11 +207,10 @@ namespace mongo { if ( outType == NORMAL ){ db.dropCollection( finalLong ); - if ( db.count( tempLong ) ){ - BSONObj info; - uassert( 10076 , "rename failed" , - db.runCommand( "admin" , BSON( "renameCollection" << tempLong << "to" << finalLong ) , info ) ); - } + BSONObj info; + uassert( 10076 , "rename failed" , + db.runCommand( "admin" , BSON( "renameCollection" << tempLong << "to" << finalLong ) , info ) ); + db.dropCollection( tempLong ); } else if ( outType == MERGE ){ auto_ptr cursor = db.query( tempLong , BSONObj() ); @@ -520,7 +519,7 @@ namespace mongo { auto_ptr idx = db.getIndexes( mr.finalLong ); while ( idx->more() ){ BSONObj i = idx->next(); - + BSONObjBuilder b( i.objsize() + 16 ); b.append( "ns" , mr.tempLong ); BSONObjIterator j( i ); diff --git a/jstests/mr_comments.js b/jstests/mr_comments.js index 2962abc5599..77e0f75faa1 100644 --- a/jstests/mr_comments.js +++ b/jstests/mr_comments.js @@ -15,7 +15,6 @@ res = db.runCommand( out: "mr_comments_out" }); printjson( res ); -db[res.results].drop() res = db.runCommand( { mapreduce : "mr_comments", @@ -26,5 +25,4 @@ res = db.runCommand( out: "mr_comments_out" }); printjson( res ); -db[res.results].drop() -- cgit v1.2.1