diff options
author | Jason Rassi <rassi@10gen.com> | 2014-11-25 13:30:03 -0500 |
---|---|---|
committer | Jason Rassi <rassi@10gen.com> | 2014-11-25 17:36:26 -0500 |
commit | 2fb5b67d280b5aa1f196d9f0afe802120bc22a56 (patch) | |
tree | a8fc68fc0af88419f23c6075e6a62a1124e14cfe | |
parent | d0cd0e0b62a85fb47b8be39e945715438410efec (diff) | |
download | mongo-2fb5b67d280b5aa1f196d9f0afe802120bc22a56.tar.gz |
SERVER-15552 mapReduce failure to insert to temp ns should abort op
(cherry picked from commit a4d077c775d8322c9e59313c3618fe73ac85e925)
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index b6210313c50..deeac2b1318 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -625,16 +625,14 @@ namespace mongo { uassert(10004, "no longer master", isMasterNs(ns.c_str())); Collection* coll = getCollectionOrUassert(ctx.ctx().db(), ns); - class BSONObjBuilder b; + BSONObjBuilder b; if ( !o.hasField( "_id" ) ) { - OID id; - id.init(); b.appendOID( "_id", NULL, true ); } b.appendElements(o); BSONObj bo = b.obj(); - coll->insertDocument( bo, true ); + uassertStatusOK( coll->insertDocument( bo, true ).getStatus() ); logOp( "i", ns.c_str(), bo ); } @@ -646,7 +644,7 @@ namespace mongo { Client::WriteContext ctx( _config.incLong ); Collection* coll = getCollectionOrUassert(ctx.ctx().db(), _config.incLong); - coll->insertDocument( o, true ); + uassertStatusOK( coll->insertDocument( o, true ).getStatus() ); getDur().commitIfNeeded(); } |