diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-06-18 21:24:54 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-06-18 21:24:54 +0200 |
commit | fefb1e355f6cbe35160f2f73ed68a38d95fa59a2 (patch) | |
tree | faecb2fb6677516c5f6d9edfae8475344ddd73ed /db/dbcommands.cpp | |
parent | d95b46b2bbb5b4246213f252010508489b4e5719 (diff) | |
parent | 64b33ee522375a8dc15be2875dfb7db4502259b0 (diff) | |
download | mongodb-fefb1e355f6cbe35160f2f73ed68a38d95fa59a2.tar.gz |
Merge commit 'upstream/1.8.2'
Diffstat (limited to 'db/dbcommands.cpp')
-rw-r--r-- | db/dbcommands.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
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; |