summaryrefslogtreecommitdiff
path: root/db/dbcommands.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-06-18 21:24:41 +0200
committerAntonin Kral <a.kral@bobek.cz>2011-06-18 21:24:41 +0200
commit64b33ee522375a8dc15be2875dfb7db4502259b0 (patch)
tree44979e0aaf6bb576f4a737a93e071e28809b6779 /db/dbcommands.cpp
parent4d87ff4aa74d7ae975268ac43eee152dc3f5b7e9 (diff)
downloadmongodb-64b33ee522375a8dc15be2875dfb7db4502259b0.tar.gz
Imported Upstream version 1.8.2
Diffstat (limited to 'db/dbcommands.cpp')
-rw-r--r--db/dbcommands.cpp21
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;