diff options
Diffstat (limited to 'db/repl/replset_commands.cpp')
-rw-r--r-- | db/repl/replset_commands.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/db/repl/replset_commands.cpp b/db/repl/replset_commands.cpp index f8f46d5..328b0ab 100644 --- a/db/repl/replset_commands.cpp +++ b/db/repl/replset_commands.cpp @@ -34,19 +34,27 @@ namespace mongo { */ bool replSetBlind = false; + unsigned replSetForceInitialSyncFailure = 0; class CmdReplSetTest : public ReplSetCommand { public: virtual void help( stringstream &help ) const { - help << "Just for testing : do not use.\n"; + help << "Just for regression tests.\n"; } CmdReplSetTest() : ReplSetCommand("replSetTest") { } virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + log() << "replSet replSetTest command received: " << cmdObj.toString() << rsLog; + if( cmdObj.hasElement("forceInitialSyncFailure") ) { + replSetForceInitialSyncFailure = (unsigned) cmdObj["forceInitialSyncFailure"].Number(); + return true; + } + + // may not need this, but if removed check all tests still work: if( !check(errmsg, result) ) return false; + if( cmdObj.hasElement("blind") ) { replSetBlind = cmdObj.getBoolField("blind"); - log() << "replSet info replSetTest command received, replSetBlind=" << replSetBlind << rsLog; return true; } return false; @@ -55,6 +63,7 @@ namespace mongo { class CmdReplSetGetRBID : public ReplSetCommand { public: + /* todo: ideally this should only change on rollbacks NOT on mongod restarts also. fix... */ int rbid; virtual void help( stringstream &help ) const { help << "internal"; @@ -65,12 +74,15 @@ namespace mongo { virtual bool run(const string& , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; - result.append("rbid",rbid); + result.append("rbid",rbid); return true; } } cmdReplSetRBID; using namespace bson; + void incRBID() { + cmdReplSetRBID.rbid++; + } int getRBID(DBClientConnection *c) { bo info; c->simpleCommand("admin", &info, "replSetGetRBID"); |