From 64b33ee522375a8dc15be2875dfb7db4502259b0 Mon Sep 17 00:00:00 2001 From: Antonin Kral Date: Sat, 18 Jun 2011 21:24:41 +0200 Subject: Imported Upstream version 1.8.2 --- db/dbcommands.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'db/dbcommands.cpp') diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index 8974bd3..cf0857a 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -94,9 +94,10 @@ namespace mongo { virtual void help( stringstream& help ) const { help << "return error status of the last operation on this connection\n" << "options:\n" - << " fsync - fsync before returning, or wait for journal commit if running with --dur\n" - << " w - await replication to w servers (including self) before returning\n" - << " wtimeout - timeout for w in milliseconds"; + << " { fsync:true } - fsync before returning, or wait for journal commit if running with --journal\n" + << " { j:true } - wait for journal commit if running with --journal\n" + << " { w:n } - await replication to n servers (including self) before returning\n" + << " { wtimeout:m} - timeout for w in m milliseconds"; } bool run(const string& dbname, BSONObj& _cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) { LastError *le = lastError.disableForCommand(); @@ -125,7 +126,17 @@ namespace mongo { } } - if ( cmdObj["fsync"].trueValue() ) { + if ( cmdObj["j"].trueValue() ) { + if( !getDur().awaitCommit() ) { + // --journal is off + result.append("jnote", "journaling not enabled on this server"); + } + if( cmdObj["fsync"].trueValue() ) { + errmsg = "fsync and j options are not used together"; + return false; + } + } + else if ( cmdObj["fsync"].trueValue() ) { Timer t; if( !getDur().awaitCommit() ) { // if get here, not running with --dur @@ -1542,7 +1553,7 @@ namespace mongo { uassert( 13049, "godinsert must specify a collection", !coll.empty() ); string ns = dbname + "." + coll; BSONObj obj = cmdObj[ "obj" ].embeddedObjectUserCheck(); - DiskLoc loc = theDataFileMgr.insertWithObjMod( ns.c_str(), obj, true ); + theDataFileMgr.insertWithObjMod( ns.c_str(), obj, true ); return true; } } cmdGodInsert; -- cgit v1.2.3