diff options
Diffstat (limited to 'src/mongo')
80 files changed, 214 insertions, 228 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index e8e8e3951df..b55666dc070 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -383,7 +383,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { Client& c = cc(); c.gotHandshake( cmdObj ); return 1; diff --git a/src/mongo/db/clientcursor.cpp b/src/mongo/db/clientcursor.cpp index 396fd522b49..7495146e4db 100644 --- a/src/mongo/db/clientcursor.cpp +++ b/src/mongo/db/clientcursor.cpp @@ -257,7 +257,7 @@ namespace mongo { actions.addAction(ActionType::cursorInfo); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { _appendCursorStats( result ); return true; diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 96dfea73572..2bdc738a52b 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -558,7 +558,7 @@ namespace mongo { return Status::OK(); } CmdClone() : Command("clone") { } - virtual bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string from = cmdObj.getStringField("clone"); if ( from.empty() ) return false; @@ -629,7 +629,7 @@ namespace mongo { "is placed at the same db.collection (namespace) as the source.\n" ; } - virtual bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string fromhost = cmdObj.getStringField("from"); if ( fromhost.empty() ) { errmsg = "missing 'from' parameter"; @@ -696,7 +696,7 @@ namespace mongo { help << "get a nonce for subsequent copy db request from secure server\n"; help << "usage: {copydbgetnonce: 1, fromhost: <hostname>}"; } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string fromhost = cmdObj.getStringField("fromhost"); if ( fromhost.empty() ) { /* copy from self */ @@ -780,7 +780,7 @@ namespace mongo { help << "usage: {copydb: 1, fromhost: <connection string>, fromdb: <db>, todb: <db>" << "[, slaveOk: <bool>, username: <username>, nonce: <nonce>, key: <key>]}"; } - virtual bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string fromhost = cmdObj.getStringField("fromhost"); bool fromSelf = fromhost.empty(); if ( fromSelf ) { diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 27aba2bf5ae..af626452997 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -90,16 +90,6 @@ namespace mongo { return ResourcePattern::forExactNamespace(NamespaceString(ns)); } - bool Command::newRun(TransactionExperiment* txn, - const string& db, - BSONObj& cmdObj, - int options, - string& errmsg, - BSONObjBuilder& result, - bool fromRepl) { - return run(db, cmdObj, options, errmsg, result, fromRepl); - } - void Command::htmlHelp(stringstream& ss) const { string helpStr; { @@ -346,7 +336,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) { shardConnectionPool.flush(); pool.flush(); return true; @@ -369,7 +359,7 @@ namespace mongo { actions.addAction(ActionType::connPoolStats); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool) { pool.appendInfo( result ); result.append( "numDBClientConnection" , DBClientConnection::getNumConnections() ); result.append( "numAScopedConnection" , AScopedConnection::getNumConnections() ); diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index 36fc09d3bd1..c9c5920126d 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -71,16 +71,14 @@ namespace mutablebson { normally do not want to log the command to the local oplog. return value is true if succeeded. if false, set errmsg text. - - Default impl forwards to private run(). It will go away soon. */ - virtual bool newRun(TransactionExperiment* txn, + virtual bool run(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, - bool fromRepl = false ); + bool fromRepl = false ) = 0; /** * This designation for the command is only used by the 'help' call and has nothing to do @@ -160,7 +158,6 @@ namespace mutablebson { virtual ~Command() {} protected: - /** * Appends to "*out" the privileges required to run this command on database "dbname" with * the invocation described by "cmdObj". New commands shouldn't implement this, they should @@ -234,10 +231,6 @@ namespace mutablebson { static int testCommandsEnabled; private: - // This method is deprecated. It should only be used by commands that don't transactions - virtual bool run(const string& db, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl = false ) { - invariant(false); - } /** * Checks to see if the client is authorized to run the given command with the given diff --git a/src/mongo/db/commands/apply_ops.cpp b/src/mongo/db/commands/apply_ops.cpp index b86d8716d08..285c83c7186 100644 --- a/src/mongo/db/commands/apply_ops.cpp +++ b/src/mongo/db/commands/apply_ops.cpp @@ -59,7 +59,7 @@ namespace mongo { // applyOps can do pretty much anything, so require all privileges. RoleGraph::generateUniversalPrivileges(out); } - virtual bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( cmdObj.firstElement().type() != Array ) { errmsg = "ops has to be an array"; diff --git a/src/mongo/db/commands/auth_schema_upgrade_d.cpp b/src/mongo/db/commands/auth_schema_upgrade_d.cpp index d18fb04356c..bd27c4a68b1 100644 --- a/src/mongo/db/commands/auth_schema_upgrade_d.cpp +++ b/src/mongo/db/commands/auth_schema_upgrade_d.cpp @@ -113,6 +113,7 @@ namespace { class CmdAuthSchemaUpgradeD : public CmdAuthSchemaUpgrade { virtual bool run( + TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp index 532df4c015b..249fc0d93e4 100644 --- a/src/mongo/db/commands/authentication_commands.cpp +++ b/src/mongo/db/commands/authentication_commands.cpp @@ -99,7 +99,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - bool run(const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { nonce64 n = getNextNonce(); stringstream ss; ss << hex << n; @@ -133,7 +133,7 @@ namespace mongo { } } - bool CmdAuthenticate::run(const string& dbname, + bool CmdAuthenticate::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, @@ -351,7 +351,7 @@ namespace mongo { void help(stringstream& h) const { h << "de-authenticate"; } virtual bool isWriteCommandForConfigServer() const { return false; } CmdLogout() : Command("logout") {} - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h index 909857b3532..4c6a2420695 100644 --- a/src/mongo/db/commands/authentication_commands.h +++ b/src/mongo/db/commands/authentication_commands.h @@ -51,7 +51,7 @@ namespace mongo { virtual void redactForLogging(mutablebson::Document* cmdObj); CmdAuthenticate() : Command("authenticate") {} - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, diff --git a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp index fcc81a00c59..fa9330d358e 100644 --- a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp +++ b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp @@ -179,7 +179,7 @@ namespace mongo { // Output static BSONField<BSONObj> stoppedAtKeyField; - bool newRun( TransactionExperiment* txn, + bool run( TransactionExperiment* txn, string const &db, BSONObj &cmdObj, int, diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index f1a375e6694..844ec2eec8e 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -142,7 +142,7 @@ namespace mongo { NamespaceString(dbname, collection)), targetActions)); } - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { string from = jsobj.getStringField( "cloneCollectionAsCapped" ); string to = jsobj.getStringField( "toCollection" ); double size = jsobj.getField( "size" ).number(); @@ -196,7 +196,7 @@ namespace mongo { return std::vector<BSONObj>(); } - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { // calls renamecollection which does a global lock, so we must too: // Lock::GlobalWrite globalWriteLock; diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp index a469347d677..ec301bac843 100644 --- a/src/mongo/db/commands/compact.cpp +++ b/src/mongo/db/commands/compact.cpp @@ -83,7 +83,7 @@ namespace mongo { return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); } - virtual bool newRun(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string coll = cmdObj.firstElement().valuestr(); if( coll.empty() || db.empty() ) { errmsg = "no collection name specified"; diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp index 56172be081c..1f9e9b7685e 100644 --- a/src/mongo/db/commands/connection_status.cpp +++ b/src/mongo/db/commands/connection_status.cpp @@ -46,7 +46,7 @@ namespace mongo { h << "Returns connection-specific information such as logged-in users"; } - bool run(const string&, BSONObj& cmdObj, int, string& errmsg, + bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { AuthorizationSession* authSession = ClientBasic::getCurrent()->getAuthorizationSession(); diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 06b0b6e20b7..76a3c731637 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -70,7 +70,7 @@ namespace mongo { return b.obj(); } - virtual bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl = false ) { diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index af33930f901..802a99cba5f 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -125,7 +125,7 @@ namespace mongo { return hash; } - bool DBHashCmd::run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool DBHashCmd::run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { Timer timer; set<string> desiredCollections; diff --git a/src/mongo/db/commands/dbhash.h b/src/mongo/db/commands/dbhash.h index 5d74a2ae359..cb0cbdefa1c 100644 --- a/src/mongo/db/commands/dbhash.h +++ b/src/mongo/db/commands/dbhash.h @@ -46,7 +46,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out); - virtual bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool); + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool); void wipeCacheForCollection( const StringData& ns ); diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index 3bf8152fee3..5b6888154d6 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -68,7 +68,7 @@ namespace mongo { help << "{ distinct : 'collection name' , key : 'a.b' , query : {} }"; } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { Timer t; diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp index ea60d797f69..ac9deff5ded 100644 --- a/src/mongo/db/commands/drop_indexes.cpp +++ b/src/mongo/db/commands/drop_indexes.cpp @@ -92,7 +92,7 @@ namespace mongo { } CmdDropIndexes() : Command("dropIndexes", false, "deleteIndexes") { } - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& anObjBuilder, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& anObjBuilder, bool fromRepl) { Lock::DBWrite dbXLock(dbname); bool ok = wrappedRun(txn, dbname, jsobj, errmsg, anObjBuilder); if (ok && !fromRepl) @@ -212,7 +212,7 @@ namespace mongo { return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); } - bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { static DBDirectClient db; BSONElement e = jsobj.firstElement(); diff --git a/src/mongo/db/commands/fail_point_cmd.cpp b/src/mongo/db/commands/fail_point_cmd.cpp index a36160cb5bd..bcb46cc4332 100644 --- a/src/mongo/db/commands/fail_point_cmd.cpp +++ b/src/mongo/db/commands/fail_point_cmd.cpp @@ -81,7 +81,7 @@ namespace mongo { h << "modifies the settings of a fail point"; } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index 98aab888860..47043005667 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -297,7 +297,7 @@ namespace mongo { return true; } - virtual bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int x, string& errmsg, BSONObjBuilder& result, bool y) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int x, string& errmsg, BSONObjBuilder& result, bool y) { DBDirectClient db(txn); if (cmdObj["sort"].eoo()) { diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index c304e1ae46a..8837c91c05c 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -92,7 +92,7 @@ namespace mongo { actions.addAction(ActionType::fsync); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if (Lock::isLocked()) { errmsg = "fsync: Cannot execute fsync command from contexts that hold a data lock"; diff --git a/src/mongo/db/commands/geonear.cpp b/src/mongo/db/commands/geonear.cpp index d7c6f5a4cd5..9a6582fede5 100644 --- a/src/mongo/db/commands/geonear.cpp +++ b/src/mongo/db/commands/geonear.cpp @@ -68,7 +68,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { const string ns = dbname + "." + cmdObj.firstElement().valuestr(); if (!cmdObj["start"].eoo()) { diff --git a/src/mongo/db/commands/get_last_error.cpp b/src/mongo/db/commands/get_last_error.cpp index 2775520ac94..dde7a40e84f 100644 --- a/src/mongo/db/commands/get_last_error.cpp +++ b/src/mongo/db/commands/get_last_error.cpp @@ -57,7 +57,7 @@ namespace mongo { help << "reset error state (used with getpreverror)"; } CmdResetError() : Command("resetError", false, "reseterror") {} - bool run(const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { LastError *le = lastError.get(); verify( le ); le->reset(); @@ -91,7 +91,7 @@ namespace mongo { << " { wtimeout:m} - timeout for w in m milliseconds"; } - bool run( const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, @@ -262,7 +262,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required CmdGetPrevError() : Command("getPrevError", false, "getpreverror") {} - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { LastError *le = lastError.disableForCommand(); le->appendSelf( result ); if ( le->valid ) diff --git a/src/mongo/db/commands/group.cpp b/src/mongo/db/commands/group.cpp index c6fd5c0f7bb..8a1608f7e71 100644 --- a/src/mongo/db/commands/group.cpp +++ b/src/mongo/db/commands/group.cpp @@ -202,7 +202,7 @@ namespace mongo { return true; } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { if ( !globalScriptEngine ) { errmsg = "server-side JavaScript execution is disabled"; diff --git a/src/mongo/db/commands/hashcmd.cpp b/src/mongo/db/commands/hashcmd.cpp index 3e8c29bc3a4..cff86b33e42 100644 --- a/src/mongo/db/commands/hashcmd.cpp +++ b/src/mongo/db/commands/hashcmd.cpp @@ -72,7 +72,7 @@ namespace mongo { *> "out" : NumberLong(6271151123721111923), *> "ok" : 1 } **/ - bool run( const string& db, + bool run(TransactionExperiment* txn, const string& db, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp index 9f006ad7ac7..b4d9d6c93e4 100644 --- a/src/mongo/db/commands/index_filter_commands.cpp +++ b/src/mongo/db/commands/index_filter_commands.cpp @@ -120,7 +120,7 @@ namespace mongo { : Command(name), helpText(helpText) { } - bool IndexFilterCommand::run(const string& dbname, BSONObj& cmdObj, int options, + bool IndexFilterCommand::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string ns = parseNs(dbname, cmdObj); diff --git a/src/mongo/db/commands/index_filter_commands.h b/src/mongo/db/commands/index_filter_commands.h index badb55f185d..ac372668769 100644 --- a/src/mongo/db/commands/index_filter_commands.h +++ b/src/mongo/db/commands/index_filter_commands.h @@ -63,7 +63,7 @@ namespace mongo { * implement plan cache command functionality. */ - bool run(const std::string& dbname, BSONObj& cmdObj, int options, + bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& cmdObj, int options, std::string& errmsg, BSONObjBuilder& result, bool fromRepl); virtual bool isWriteCommandForConfigServer() const; diff --git a/src/mongo/db/commands/index_stats.cpp b/src/mongo/db/commands/index_stats.cpp index 196f2c0d4fa..1b0c69e42b2 100644 --- a/src/mongo/db/commands/index_stats.cpp +++ b/src/mongo/db/commands/index_stats.cpp @@ -492,7 +492,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { NamespaceString nss( dbname, cmdObj.firstElement().valuestrsafe() ); diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp index 1ecaedb5463..8f5fc57210d 100644 --- a/src/mongo/db/commands/isself.cpp +++ b/src/mongo/db/commands/isself.cpp @@ -184,7 +184,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { init(); result.append( "id" , _id ); return true; diff --git a/src/mongo/db/commands/merge_chunks_cmd.cpp b/src/mongo/db/commands/merge_chunks_cmd.cpp index 189608f4026..d7c39a6ecd5 100644 --- a/src/mongo/db/commands/merge_chunks_cmd.cpp +++ b/src/mongo/db/commands/merge_chunks_cmd.cpp @@ -80,7 +80,7 @@ namespace mongo { static BSONField<string> shardNameField; static BSONField<string> configField; - bool run( const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 7a540a8a3ef..543cae19cf0 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1208,7 +1208,7 @@ namespace mongo { addPrivilegesRequiredForMapReduce(this, dbname, cmdObj, out); } - bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmd, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmd, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { Timer t; Client& client = cc(); CurOp * op = client.curop(); @@ -1446,7 +1446,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { ShardedConnectionInfo::addHook(); // legacy name string shardedOutputCollection = cmdObj["shardedOutputCollection"].valuestrsafe(); diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index 895bf8d21d7..bd5a67fc098 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -56,7 +56,7 @@ namespace mongo { } return Status::OK(); } - virtual bool run(const string& dbname, + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index 34459ffaf18..58a530184b5 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -159,7 +159,7 @@ namespace mongo { return Status(ErrorCodes::Unauthorized, "Unauthorized"); } - virtual bool run( const string& dbname, BSONObj& cmdObj, int options, + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl = false ) { diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp index 2c1203d04ff..af9ad7c822f 100644 --- a/src/mongo/db/commands/parameters.cpp +++ b/src/mongo/db/commands/parameters.cpp @@ -72,7 +72,7 @@ namespace mongo { appendParameterNames( help ); help << "{ getParameter:'*' } to get everything\n"; } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { bool all = *cmdObj.firstElement().valuestrsafe() == '*'; int before = result.len(); @@ -126,7 +126,7 @@ namespace mongo { help << "{ setParameter:1, <param>:<value> }\n"; appendParameterNames( help ); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { int s = 0; bool found = false; diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 7d48d1b40db..34652d66daf 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -273,7 +273,7 @@ namespace { Pipeline::addRequiredPrivileges(this, dbname, cmdObj, out); } - virtual bool run(const string &db, BSONObj &cmdObj, int options, string &errmsg, + virtual bool run(TransactionExperiment* txn, const string &db, BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl) { string ns = parseNs(db, cmdObj); diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index 6287a6ab77a..a58dcb78851 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -114,7 +114,7 @@ namespace mongo { helpText(helpText), actionType(actionType) { } - bool PlanCacheCommand::run(const string& dbname, BSONObj& cmdObj, int options, + bool PlanCacheCommand::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string ns = parseNs(dbname, cmdObj); diff --git a/src/mongo/db/commands/plan_cache_commands.h b/src/mongo/db/commands/plan_cache_commands.h index 59c9dc78d20..1c1de2da9f5 100644 --- a/src/mongo/db/commands/plan_cache_commands.h +++ b/src/mongo/db/commands/plan_cache_commands.h @@ -58,7 +58,7 @@ namespace mongo { * implement plan cache command functionality. */ - bool run(const std::string& dbname, BSONObj& cmdObj, int options, + bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& cmdObj, int options, std::string& errmsg, BSONObjBuilder& result, bool fromRepl); virtual bool isWriteCommandForConfigServer() const; diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp index 07bf511141b..196d28ae735 100644 --- a/src/mongo/db/commands/rename_collection.cpp +++ b/src/mongo/db/commands/rename_collection.cpp @@ -91,7 +91,7 @@ namespace mongo { IndexBuilder::restoreIndexes( indexesInProg ); } - virtual bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { Lock::GlobalWrite globalWriteLock; bool ok = wrappedRun(txn, dbname, cmdObj, errmsg, result, fromRepl); if (ok && !fromRepl) diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp index 181d172547a..8a6923c8772 100644 --- a/src/mongo/db/commands/server_status.cpp +++ b/src/mongo/db/commands/server_status.cpp @@ -71,7 +71,7 @@ namespace mongo { actions.addAction(ActionType::serverStatus); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { _runCalled = true; diff --git a/src/mongo/db/commands/shutdown.h b/src/mongo/db/commands/shutdown.h index 9311ac70f9b..7120da6fbad 100644 --- a/src/mongo/db/commands/shutdown.h +++ b/src/mongo/db/commands/shutdown.h @@ -49,7 +49,7 @@ namespace mongo { virtual bool isWriteCommandForConfigServer() const { return false; } virtual void help( stringstream& help ) const; CmdShutdown() : Command("shutdown") {} - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, diff --git a/src/mongo/db/commands/storage_details.cpp b/src/mongo/db/commands/storage_details.cpp index 09af6984b18..1121a3e22dd 100644 --- a/src/mongo/db/commands/storage_details.cpp +++ b/src/mongo/db/commands/storage_details.cpp @@ -323,7 +323,7 @@ namespace { /** * Entry point, parses command parameters and invokes runInternal. */ - bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl); }; @@ -756,7 +756,7 @@ namespace { static const char* USE_ANALYZE_STR = "use {analyze: 'diskStorage' | 'pagesInRAM'}"; - bool StorageDetailsCmd::run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, + bool StorageDetailsCmd::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { // { analyze: subcommand } diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index 428298868b9..3abd64cd40d 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -55,7 +55,7 @@ namespace mongo { virtual void help( stringstream &help ) const { help << "internal. for testing only."; } - virtual bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string coll = cmdObj[ "godinsert" ].valuestrsafe(); log() << "test only command godinsert invoked coll:" << coll << endl; uassert( 13049, "godinsert must specify a collection", !coll.empty() ); @@ -93,7 +93,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} CmdSleep() : Command("sleep") { } - bool run(const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { log() << "test only command sleep invoked" << endl; long long millis = 10 * 1000; @@ -133,7 +133,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} - virtual bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string coll = cmdObj[ "captrunc" ].valuestrsafe(); uassert( 13416, "captrunc must specify a collection", !coll.empty() ); NamespaceString nss( dbname, coll ); @@ -180,7 +180,7 @@ namespace mongo { return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); } - virtual bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { string coll = cmdObj[ "emptycapped" ].valuestrsafe(); uassert( 13428, "emptycapped must specify a collection", !coll.empty() ); NamespaceString nss( dbname, coll ); diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp index 2011758f042..4039d386ef4 100644 --- a/src/mongo/db/commands/touch.cpp +++ b/src/mongo/db/commands/touch.cpp @@ -77,7 +77,7 @@ namespace mongo { } TouchCmd() : Command("touch") { } - virtual bool newRun(TransactionExperiment* txn, + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index 79de0fe563d..b6e6cc65545 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -341,7 +341,7 @@ namespace mongo { return checkAuthorizedToGrantRoles(authzSession, args.roles); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -527,7 +527,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -651,7 +651,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -737,7 +737,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -819,7 +819,7 @@ namespace mongo { return checkAuthorizedToGrantRoles(authzSession, roles); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -917,7 +917,7 @@ namespace mongo { return checkAuthorizedToRevokeRoles(authzSession, roles); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1033,7 +1033,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1175,7 +1175,7 @@ namespace mongo { return checkAuthorizedToGrantPrivileges(authzSession, args.privileges); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1321,7 +1321,7 @@ namespace mongo { return checkAuthorizedToGrantPrivileges(authzSession, args.privileges); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1442,7 +1442,7 @@ namespace mongo { return checkAuthorizedToGrantPrivileges(authzSession, privileges); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1578,7 +1578,7 @@ namespace mongo { return checkAuthorizedToRevokePrivileges(authzSession, privileges); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1715,7 +1715,7 @@ namespace mongo { return checkAuthorizedToGrantRoles(authzSession, roles); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1834,7 +1834,7 @@ namespace mongo { return checkAuthorizedToRevokeRoles(authzSession, roles); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -1953,7 +1953,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -2121,7 +2121,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -2276,7 +2276,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -2356,7 +2356,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -2400,7 +2400,8 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, + const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -2808,7 +2809,7 @@ namespace mongo { return Status::OK(); } - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 3fba9dd4b00..56f5382548c 100644 --- a/src/mongo/db/commands/validate.cpp +++ b/src/mongo/db/commands/validate.cpp @@ -59,7 +59,7 @@ namespace mongo { } //{ validate: "collectionnamewithoutthedbpart" [, scandata: <bool>] [, full: <bool> } */ - bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { string ns = dbname + "." + cmdObj.firstElement().valuestrsafe(); NamespaceString ns_string(ns); diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index bcc297cf4b6..dcdd527f19f 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -102,7 +102,7 @@ namespace mongo { // Write commands are counted towards their corresponding opcounters, not command opcounters. bool WriteCmd::shouldAffectCommandCounter() const { return false; } - bool WriteCmd::newRun(TransactionExperiment* txn, + bool WriteCmd::run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int options, diff --git a/src/mongo/db/commands/write_commands/write_commands.h b/src/mongo/db/commands/write_commands/write_commands.h index c94c505d5b5..9a8d96b5ac2 100644 --- a/src/mongo/db/commands/write_commands/write_commands.h +++ b/src/mongo/db/commands/write_commands/write_commands.h @@ -72,7 +72,7 @@ namespace mongo { virtual bool shouldAffectCommandCounter() const; // Write command entry point. - virtual bool newRun( + virtual bool run( TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index 16e59026bee..bf31ff9d1e7 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -94,7 +94,7 @@ namespace mongo { << "N to wait N seconds for other members to catch up."; } - bool CmdShutdown::run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool CmdShutdown::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { bool force = cmdObj.hasField("force") && cmdObj["force"].trueValue(); if (!force && @@ -191,7 +191,7 @@ namespace mongo { CmdDropDatabase() : Command("dropDatabase") {} - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { // disallow dropping the config database if (serverGlobalParams.configsvr && (dbname == "config")) { errmsg = "Cannot drop 'config' database if mongod started with --configsvr"; @@ -275,7 +275,7 @@ namespace mongo { return allKilledIndexes; } - bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { BSONElement e = cmdObj.firstElement(); if ( e.numberInt() != 1 ) { errmsg = "bad option"; @@ -351,7 +351,7 @@ namespace mongo { } - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { // Needs to be locked exclusively, because creates the system.profile collection // in the local database. // @@ -401,7 +401,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { // This doesn't look like it requires exclusive DB lock, because it uses its own diag // locking, but originally the lock was set to be WRITE, so preserving the behaviour. // @@ -448,7 +448,7 @@ namespace mongo { return IndexBuilder::killMatchingIndexBuilds(db->getCollection(nsToDrop), criteria); } - virtual bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { const string nsToDrop = dbname + '.' + cmdObj.firstElement().valuestr(); if (!serverGlobalParams.quiet) { MONGO_TLOG(0) << "CMD: drop " << nsToDrop << endl; @@ -512,7 +512,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - virtual bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { long long skip = 0; if ( cmdObj["skip"].isNumber() ) { skip = cmdObj["skip"].numberLong(); @@ -595,7 +595,7 @@ namespace mongo { return Status(ErrorCodes::Unauthorized, "unauthorized"); } - virtual bool newRun(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { BSONObjIterator it(cmdObj); // Extract ns from first cmdObj element. @@ -653,7 +653,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdListDatabases() : Command("listDatabases" , true ) {} - bool run(const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { vector< string > dbNames; getDatabaseNames( dbNames ); vector< BSONObj > dbInfos; @@ -735,7 +735,7 @@ namespace mongo { } - bool run(const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { Lock::GlobalWrite globalWriteLock; Client::Context ctx(dbname); @@ -784,7 +784,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), ActionType::find)); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { const std::string ns = parseNs(dbname, jsobj); md5digest d; @@ -913,7 +913,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { Timer timer; string ns = jsobj.firstElement().String(); @@ -1070,7 +1070,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { const string ns = dbname + "." + jsobj.firstElement().valuestr(); Client::ReadContext cx( ns ); @@ -1144,7 +1144,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { const string ns = dbname + "." + jsobj.firstElement().valuestr(); Lock::DBWrite dbXLock(dbname); @@ -1266,7 +1266,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forDatabaseName(dbname), actions)); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { int scale = 1; if ( jsobj["scale"].isNumber() ) { scale = jsobj["scale"].numberInt(); @@ -1379,7 +1379,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { BSONObj info = cc().curop()->info(); result << "you" << info[ "client" ]; return true; @@ -1397,7 +1397,7 @@ namespace mongo { bool fromRepl) { try { - return c->newRun(txn, dbname, cmdObj, queryOptions, errmsg, result, fromRepl); + return c->run(txn, dbname, cmdObj, queryOptions, errmsg, result, fromRepl); } catch ( SendStaleConfigException& e ){ LOG(1) << "command failed because of stale config, can retry" << causedBy( e ) << endl; diff --git a/src/mongo/db/dbcommands_admin.cpp b/src/mongo/db/dbcommands_admin.cpp index 9541052f6b6..5856d0eace7 100644 --- a/src/mongo/db/dbcommands_admin.cpp +++ b/src/mongo/db/dbcommands_admin.cpp @@ -82,7 +82,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { boost::filesystem::path p = dur::getJournalDir(); p /= "journalLatencyTest"; diff --git a/src/mongo/db/dbcommands_generic.cpp b/src/mongo/db/dbcommands_generic.cpp index 81ef1687530..2ce435d136d 100644 --- a/src/mongo/db/dbcommands_generic.cpp +++ b/src/mongo/db/dbcommands_generic.cpp @@ -101,7 +101,7 @@ namespace mongo { virtual void help( stringstream &help ) const { help << "internal command facilitating running in certain cloud computing environments"; } - bool run(const string& dbname, BSONObj& obj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& obj, int options, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { if( !obj.hasElement("servers") ) { vector<string> ips; obj["servers"].Obj().Vals(ips); @@ -133,7 +133,7 @@ namespace mongo { help << "{ buildinfo:1 }"; } - bool run(const std::string& dbname, + bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& jsobj, int, // options std::string& errmsg, @@ -156,7 +156,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(const string& badns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& badns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { // IMPORTANT: Don't put anything in here that might lock db - including authentication return true; } @@ -171,7 +171,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( globalScriptEngine ) { BSONObjBuilder bb( result.subobjStart( "js" ) ); result.append( "utf8" , globalScriptEngine->utf8Ok() ); @@ -206,7 +206,7 @@ namespace mongo { actions.addAction(ActionType::hostInfo); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { ProcessInfo p; BSONObjBuilder bSys, bOs; @@ -243,7 +243,7 @@ namespace mongo { actions.addAction(ActionType::logRotate); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { bool didRotate = rotateLogs(); if (didRotate) logProcessDetailsForLogRotate(); @@ -262,7 +262,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& ns, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { BSONObjBuilder b( result.subobjStart( "commands" ) ); for ( map<string,Command*>::iterator i=_commands->begin(); i!=_commands->end(); ++i ) { Command * c = i->second; @@ -339,7 +339,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required CmdForceError() : Command("forceerror") {} - bool run(const string& dbnamne, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbnamne, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { uassert( 10038 , "forced error", false); return true; } @@ -353,7 +353,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { result << "options" << QueryOption_AllSupported; return true; } @@ -377,7 +377,7 @@ namespace mongo { help << "{ getLog : '*' } OR { getLog : 'global' }"; } - virtual bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string p = cmdObj.firstElement().String(); if ( p == "*" ) { vector<string> names; @@ -424,7 +424,7 @@ namespace mongo { actions.addAction(ActionType::getCmdLineOpts); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { result.append("argv", serverGlobalParams.argvArray); result.append("parsed", serverGlobalParams.parsedOpts); return true; diff --git a/src/mongo/db/dbeval.cpp b/src/mongo/db/dbeval.cpp index 3f0845d832b..4c33a0a7506 100644 --- a/src/mongo/db/dbeval.cpp +++ b/src/mongo/db/dbeval.cpp @@ -139,7 +139,7 @@ namespace mongo { RoleGraph::generateUniversalPrivileges(out); } CmdEval() : Command("eval", false, "$eval") { } - bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool run(TransactionExperiment* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( cmdObj["nolock"].trueValue() ) { return dbEval(dbname, cmdObj, result, errmsg); } diff --git a/src/mongo/db/dbwebserver.cpp b/src/mongo/db/dbwebserver.cpp index e63ad58f0d8..c5ce87bb068 100644 --- a/src/mongo/db/dbwebserver.cpp +++ b/src/mongo/db/dbwebserver.cpp @@ -472,7 +472,7 @@ namespace mongo { string errmsg; BSONObjBuilder sub; - if ( ! c->newRun( txn, "admin.$cmd" , co , 0, errmsg , sub , false ) ) + if ( ! c->run( txn, "admin.$cmd" , co , 0, errmsg , sub , false ) ) buf.append( cmd , errmsg ); else buf.append( cmd , sub.obj() ); diff --git a/src/mongo/db/driverHelpers.cpp b/src/mongo/db/driverHelpers.cpp index 91cef90b00c..135eb2256f5 100644 --- a/src/mongo/db/driverHelpers.cpp +++ b/src/mongo/db/driverHelpers.cpp @@ -66,7 +66,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( cmdObj.firstElement().type() != jstOID ) { errmsg = "not oid"; return false; diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp index 2792e2b71fe..bae67717c07 100644 --- a/src/mongo/db/exec/stagedebug_cmd.cpp +++ b/src/mongo/db/exec/stagedebug_cmd.cpp @@ -102,7 +102,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { BSONElement argElt = cmdObj["stageDebug"]; if (argElt.eoo() || !argElt.isABSONObj()) { return false; } diff --git a/src/mongo/db/fts/fts_command.cpp b/src/mongo/db/fts/fts_command.cpp index 644024c8e17..853afd04f5d 100644 --- a/src/mongo/db/fts/fts_command.cpp +++ b/src/mongo/db/fts/fts_command.cpp @@ -57,7 +57,7 @@ namespace mongo { } - bool FTSCommand::run(const string& dbname, + bool FTSCommand::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, diff --git a/src/mongo/db/fts/fts_command.h b/src/mongo/db/fts/fts_command.h index d340c8b60d1..e5cc881feb4 100644 --- a/src/mongo/db/fts/fts_command.h +++ b/src/mongo/db/fts/fts_command.h @@ -56,7 +56,7 @@ namespace mongo { std::vector<Privilege>* out); - bool run(const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, diff --git a/src/mongo/db/geo/haystack.cpp b/src/mongo/db/geo/haystack.cpp index 7b8699533cb..aa05540eeba 100644 --- a/src/mongo/db/geo/haystack.cpp +++ b/src/mongo/db/geo/haystack.cpp @@ -68,7 +68,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { const string ns = dbname + "." + cmdObj.firstElement().valuestr(); Client::ReadContext ctx(ns); diff --git a/src/mongo/db/repl/consensus.cpp b/src/mongo/db/repl/consensus.cpp index 719627aefff..90c1197aaa9 100644 --- a/src/mongo/db/repl/consensus.cpp +++ b/src/mongo/db/repl/consensus.cpp @@ -101,7 +101,7 @@ namespace mongo { return false; } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; @@ -149,7 +149,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } private: - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; theReplSet->elect.electCmdReceived(cmdObj, &result); diff --git a/src/mongo/db/repl/heartbeat.cpp b/src/mongo/db/repl/heartbeat.cpp index 84a685500cf..7956dc40877 100644 --- a/src/mongo/db/repl/heartbeat.cpp +++ b/src/mongo/db/repl/heartbeat.cpp @@ -68,7 +68,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( replSetBlind ) { if (theReplSet) { errmsg = str::stream() << theReplSet->selfFullName() << " is blind"; diff --git a/src/mongo/db/repl/repl_settings.cpp b/src/mongo/db/repl/repl_settings.cpp index 3fe79d5bad1..623b76ce557 100644 --- a/src/mongo/db/repl/repl_settings.cpp +++ b/src/mongo/db/repl/repl_settings.cpp @@ -188,7 +188,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required CmdIsMaster() : Command("isMaster", true, "ismaster") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { /* currently request to arbiter is (somewhat arbitrarily) an ismaster request that is not authenticated. */ diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp index 8503b9dc9d1..e67b24395f4 100644 --- a/src/mongo/db/repl/replset_commands.cpp +++ b/src/mongo/db/repl/replset_commands.cpp @@ -65,7 +65,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} CmdReplSetTest() : ReplSetCommand("replSetTest") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { log() << "replSet replSetTest command received: " << cmdObj.toString() << rsLog; if( cmdObj.hasElement("forceInitialSyncFailure") ) { @@ -120,7 +120,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; result.append("rbid",rbid); @@ -155,7 +155,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetGetStatus() : ReplSetCommand("replSetGetStatus", true) { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( cmdObj["forShell"].trueValue() ) lastError.disableForCommand(); @@ -182,7 +182,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetReconfig() : ReplSetCommand("replSetReconfig"), mutex("rsreconfig") { } - virtual bool run(const string& a, BSONObj& b, int e, string& errmsg, BSONObjBuilder& c, bool d) { + virtual bool run(TransactionExperiment* txn, const string& a, BSONObj& b, int e, string& errmsg, BSONObjBuilder& c, bool d) { try { rwlock_try_write lk(mutex); return _run(a,b,e,errmsg,c,d); @@ -277,7 +277,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetFreeze() : ReplSetCommand("replSetFreeze") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; int secs = (int) cmdObj.firstElement().numberInt(); @@ -307,7 +307,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetStepDown() : ReplSetCommand("replSetStepDown") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; if( !theReplSet->box.getState().primary() ) { @@ -362,7 +362,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetMaintenance() : ReplSetCommand("replSetMaintenance") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if( !check(errmsg, result) ) return false; @@ -394,7 +394,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetSyncFrom() : ReplSetCommand("replSetSyncFrom") { } - virtual bool run(const string&, + virtual bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, @@ -422,7 +422,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } CmdReplSetUpdatePosition() : ReplSetCommand("replSetUpdatePosition") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if (!check(errmsg, result)) return false; diff --git a/src/mongo/db/repl/resync.cpp b/src/mongo/db/repl/resync.cpp index 1c4322d81cd..dd412358b7d 100644 --- a/src/mongo/db/repl/resync.cpp +++ b/src/mongo/db/repl/resync.cpp @@ -57,7 +57,7 @@ namespace mongo { } CmdResync() : Command("resync") { } - virtual bool newRun(TransactionExperiment* txn, + virtual bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp index b7ca36fcd12..82e5c9d4934 100644 --- a/src/mongo/db/repl/rs_initiate.cpp +++ b/src/mongo/db/repl/rs_initiate.cpp @@ -178,7 +178,7 @@ namespace mongo { actions.addAction(ActionType::replSetConfigure); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { log() << "replSet replSetInitiate admin command received from client" << rsLog; if( !replSet ) { diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp index 0f19a8fcdbe..d1855f842e6 100644 --- a/src/mongo/db/stats/top.cpp +++ b/src/mongo/db/stats/top.cpp @@ -188,7 +188,7 @@ namespace mongo { actions.addAction(ActionType::top); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { { BSONObjBuilder b( result.subobjStart( "totals" ) ); b.append( "note" , "all times in microseconds" ); diff --git a/src/mongo/s/commands/auth_schema_upgrade_s.cpp b/src/mongo/s/commands/auth_schema_upgrade_s.cpp index 50dd8e3fc61..76c68baa9eb 100644 --- a/src/mongo/s/commands/auth_schema_upgrade_s.cpp +++ b/src/mongo/s/commands/auth_schema_upgrade_s.cpp @@ -121,6 +121,7 @@ namespace { class CmdAuthSchemaUpgradeS : public CmdAuthSchemaUpgrade { virtual bool run( + TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, diff --git a/src/mongo/s/commands/cluster_index_filter_cmd.cpp b/src/mongo/s/commands/cluster_index_filter_cmd.cpp index 5b46edb4e99..3e40a657a2d 100644 --- a/src/mongo/s/commands/cluster_index_filter_cmd.cpp +++ b/src/mongo/s/commands/cluster_index_filter_cmd.cpp @@ -79,7 +79,7 @@ namespace mongo { } // Cluster plan cache command entry point. - bool run( const std::string& dbname, + bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& cmdObj, int options, std::string& errmsg, @@ -105,7 +105,7 @@ namespace mongo { // Cluster index filter command implementation(s) below // - bool ClusterIndexFilterCmd::run( const std::string& dbName, + bool ClusterIndexFilterCmd::run(TransactionExperiment* txn, const std::string& dbName, BSONObj& cmdObj, int options, std::string& errMsg, diff --git a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp index 0a7d0447180..3484d6eab7e 100644 --- a/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp +++ b/src/mongo/s/commands/cluster_merge_chunks_cmd.cpp @@ -109,7 +109,7 @@ namespace mongo { } - bool run( const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, diff --git a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp index 3aa47aff4dd..3ee590bd856 100644 --- a/src/mongo/s/commands/cluster_plan_cache_cmd.cpp +++ b/src/mongo/s/commands/cluster_plan_cache_cmd.cpp @@ -78,7 +78,7 @@ namespace mongo { } // Cluster plan cache command entry point. - bool run( const std::string& dbname, + bool run(TransactionExperiment* txn, const std::string& dbname, BSONObj& cmdObj, int options, std::string& errmsg, @@ -106,7 +106,7 @@ namespace mongo { // Cluster plan cache command implementation(s) below // - bool ClusterPlanCacheCmd::run( const std::string& dbName, + bool ClusterPlanCacheCmd::run(TransactionExperiment* txn, const std::string& dbName, BSONObj& cmdObj, int options, std::string& errMsg, diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp index fba1c70d994..4b6e59f6cb5 100644 --- a/src/mongo/s/commands/cluster_write_cmd.cpp +++ b/src/mongo/s/commands/cluster_write_cmd.cpp @@ -81,7 +81,7 @@ namespace mongo { } // Cluster write command entry point. - bool run( const string& dbname, + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int options, string& errmsg, @@ -144,7 +144,7 @@ namespace mongo { // Cluster write command implementation(s) below // - bool ClusterWriteCmd::run( const string& dbName, + bool ClusterWriteCmd::run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int options, string& errMsg, diff --git a/src/mongo/s/commands_admin.cpp b/src/mongo/s/commands_admin.cpp index 754850fa553..a93753fe7c5 100644 --- a/src/mongo/s/commands_admin.cpp +++ b/src/mongo/s/commands_admin.cpp @@ -114,7 +114,7 @@ namespace mongo { actions.addAction(ActionType::netstat); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { result.append("configserver", configServer.getPrimary().getConnString() ); result.append("isdbgrid", 1); return true; @@ -134,7 +134,7 @@ namespace mongo { actions.addAction(ActionType::flushRouterConfig); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { grid.flushConfig(); result.appendBool( "flushed" , true ); return true; @@ -151,7 +151,7 @@ namespace mongo { actions.addAction(ActionType::fsync); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { if ( cmdObj["lock"].trueValue() ) { errmsg = "can't do lock through mongos"; return false; @@ -205,7 +205,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return cmdObj.firstElement().valuestrsafe(); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string dbname = parseNs("admin", cmdObj); if ( dbname.size() == 0 ) { @@ -400,7 +400,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return cmdObj.firstElement().valuestrsafe(); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string dbname = parseNs("admin", cmdObj); if ( dbname.size() == 0 ) { errmsg = "no db"; @@ -459,7 +459,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { const string ns = parseNs(dbname, cmdObj); if ( ns.size() == 0 ) { errmsg = "no ns"; @@ -844,7 +844,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string ns = parseNs(dbname, cmdObj); if ( ns.size() == 0 ) { errmsg = "need to specify fully namespace"; @@ -895,7 +895,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { if ( ! okForConfigChanges( errmsg ) ) return false; @@ -1057,7 +1057,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { if ( ! okForConfigChanges( errmsg ) ) return false; @@ -1165,7 +1165,7 @@ namespace mongo { actions.addAction(ActionType::listShards); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { ScopedDbConnection conn(configServer.getPrimary().getConnString(), 30); vector<BSONObj> all; @@ -1196,7 +1196,7 @@ namespace mongo { actions.addAction(ActionType::addShard); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { errmsg.clear(); // get replica set component hosts @@ -1265,7 +1265,7 @@ namespace mongo { actions.addAction(ActionType::removeShard); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string target = cmdObj.firstElement().valuestrsafe(); Shard s = Shard::make( target ); if ( ! grid.knowAboutShard( s.getConnString() ) ) { @@ -1443,7 +1443,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required IsDbGridCmd() : Command("isdbgrid") { } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { result.append("isdbgrid", 1); result.append("hostname", getHostNameCached()); return true; @@ -1463,7 +1463,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required CmdIsMaster() : Command("isMaster" , false , "ismaster") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { result.appendBool("ismaster", true ); result.append("msg", "isdbgrid"); result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize); @@ -1494,7 +1494,7 @@ namespace mongo { virtual void help( stringstream &help ) const { help << "{whatsmyuri:1}"; } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { result << "you" << ClientInfo::get()->getRemote(); return true; } @@ -1514,7 +1514,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required CmdShardingGetPrevError() : Command( "getPrevError" , false , "getpreverror") { } - virtual bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { errmsg += "getpreverror not supported for sharded environments"; return false; } @@ -1534,7 +1534,7 @@ namespace mongo { std::vector<Privilege>* out) {} // No auth required CmdShardingGetLastError() : Command("getLastError" , false , "getlasterror") { } - virtual bool run( const string& dbName, + virtual bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string& errmsg, @@ -1687,7 +1687,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required - bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { LastError *le = lastError.get(); if ( le ) le->reset(); @@ -1725,7 +1725,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { vector<Shard> shards; Shard::getAllShards( shards ); @@ -1852,7 +1852,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& /*result*/, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& /*result*/, bool /*fromRepl*/) { errmsg = "closeAllDatabases isn't supported through mongos"; return false; } @@ -1871,7 +1871,7 @@ namespace mongo { const BSONObj& cmdObj) { return Status::OK(); // Require no auth since this command isn't supported in mongos } - bool run(const string& , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { + bool run(TransactionExperiment* txn, const string& , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { if ( jsobj["forShell"].trueValue() ) { lastError.disableForCommand(); ClientInfo::get()->disableForCommand(); @@ -1890,7 +1890,7 @@ namespace mongo { << "either (1) ran from localhost or (2) authenticated."; } - bool CmdShutdown::run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { + bool CmdShutdown::run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { return shutdownHelper(); } diff --git a/src/mongo/s/commands_public.cpp b/src/mongo/s/commands_public.cpp index 0e29d5563b3..a5a77ea2d08 100644 --- a/src/mongo/s/commands_public.cpp +++ b/src/mongo/s/commands_public.cpp @@ -184,7 +184,7 @@ namespace mongo { } // don't override - virtual bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& output, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& output, bool) { LOG(1) << "RunOnAllShardsCommand db: " << dbName << " cmd:" << cmdObj << endl; set<Shard> shards; getShards(dbName, cmdObj, shards); @@ -308,7 +308,7 @@ namespace mongo { // TODO(spencer): remove this in favor of using parseNs virtual string getFullNS( const string& dbName , const BSONObj& cmdObj ) = 0; - virtual bool run(const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { string fullns = getFullNS( dbName , cmdObj ); DBConfigPtr conf = grid.getDBConfig( dbName , false ); @@ -473,7 +473,7 @@ namespace mongo { class ProfileCmd : public PublicGridCommand { public: ProfileCmd() : PublicGridCommand("profile") {} - virtual bool run(const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { errmsg = "profile currently not supported via mongos"; return false; } @@ -620,7 +620,7 @@ namespace mongo { return Status(ErrorCodes::Unauthorized, "unauthorized"); } - bool run(const string& dbName, + bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string&, @@ -641,7 +641,7 @@ namespace mongo { actions.addAction(ActionType::dropCollection); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string collection = cmdObj.firstElement().valuestrsafe(); string fullns = dbName + "." + collection; @@ -689,7 +689,7 @@ namespace mongo { actions.addAction(ActionType::dropDatabase); out->push_back(Privilege(ResourcePattern::forDatabaseName(dbname), actions)); } - bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { // disallow dropping the config database from mongos if( dbName == "config" ) { errmsg = "Cannot drop 'config' database via mongos"; @@ -760,7 +760,7 @@ namespace mongo { virtual bool adminOnly() const { return true; } - bool run(const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string fullnsFrom = cmdObj.firstElement().valuestrsafe(); string dbNameFrom = nsToDatabase( fullnsFrom ); DBConfigPtr confFrom = grid.getDBConfig( dbNameFrom , false ); @@ -793,7 +793,7 @@ namespace mongo { const BSONObj& cmdObj) { return copydb::checkAuthForCopydbCommand(client, dbname, cmdObj); } - bool run(const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string todb = cmdObj.getStringField("todb"); uassert(13402, "need a todb argument", !todb.empty()); @@ -867,7 +867,7 @@ namespace mongo { return num; } - bool run( const string& dbName, + bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int options, string& errmsg, @@ -978,7 +978,7 @@ namespace mongo { actions.addAction(ActionType::collStats); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string collection = cmdObj.firstElement().valuestrsafe(); string fullns = dbName + "." + collection; @@ -1123,7 +1123,7 @@ namespace mongo { std::vector<Privilege>* out) { find_and_modify::addPrivilegesRequiredForFindAndModify(this, dbname, cmdObj, out); } - bool run(const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string collection = cmdObj.firstElement().valuestrsafe(); string fullns = dbName + "." + collection; @@ -1174,7 +1174,7 @@ namespace mongo { actions.addAction(ActionType::find); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string fullns = cmdObj.firstElement().String(); DBConfigPtr conf = grid.getDBConfig( dbName , false ); @@ -1279,13 +1279,13 @@ namespace mongo { } return Status::OK(); } - virtual bool run(const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { string x = parseNs(dbName, cmdObj); if ( ! str::startsWith( x , dbName ) ) { errmsg = str::stream() << "doing a splitVector across dbs isn't supported via mongos"; return false; } - return NotAllowedOnShardedCollectionCmd::run( dbName , cmdObj , options , errmsg, result, false ); + return NotAllowedOnShardedCollectionCmd::run( txn, dbName , cmdObj , options , errmsg, result, false ); } virtual std::string parseNs(const string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); @@ -1311,7 +1311,7 @@ namespace mongo { actions.addAction(ActionType::find); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { string collection = cmdObj.firstElement().valuestrsafe(); string fullns = dbName + "." + collection; @@ -1384,7 +1384,7 @@ namespace mongo { out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), ActionType::find)); } - bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { const std::string fullns = parseNs(dbName, cmdObj); DBConfigPtr conf = grid.getDBConfig( dbName , false ); @@ -1497,7 +1497,7 @@ namespace mongo { actions.addAction(ActionType::find); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - bool run(const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int options, string& errmsg, BSONObjBuilder& result, bool) { string collection = cmdObj.firstElement().valuestrsafe(); string fullns = dbName + "." + collection; @@ -1696,11 +1696,11 @@ namespace mongo { } } - bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { - return run( dbName, cmdObj, errmsg, result, 0 ); + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + return run( txn, dbName, cmdObj, errmsg, result, 0 ); } - bool run(const string& dbName , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, int retry ) { + bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, int retry ) { Timer t; string collection = cmdObj.firstElement().valuestrsafe(); @@ -2069,7 +2069,7 @@ namespace mongo { // applyOps can do pretty much anything, so require all privileges. RoleGraph::generateUniversalPrivileges(out); } - virtual bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { errmsg = "applyOps not allowed through mongos"; return false; } @@ -2086,7 +2086,7 @@ namespace mongo { actions.addAction(ActionType::compact); out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions)); } - virtual bool run(const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string& dbName , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { errmsg = "compact not allowed through mongos"; return false; } @@ -2101,7 +2101,7 @@ namespace mongo { // $eval can do pretty much anything, so require all privileges. RoleGraph::generateUniversalPrivileges(out); } - virtual bool run(const string& dbName, + virtual bool run(TransactionExperiment* txn, const string& dbName, BSONObj& cmdObj, int, string&, @@ -2126,7 +2126,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out); - virtual bool run(const string &dbName , BSONObj &cmdObj, + virtual bool run(TransactionExperiment* txn, const string &dbName , BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl); @@ -2182,7 +2182,7 @@ namespace mongo { Pipeline::addRequiredPrivileges(this, dbname, cmdObj, out); } - bool PipelineCommand::run(const string &dbName , BSONObj &cmdObj, + bool PipelineCommand::run(TransactionExperiment* txn, const string &dbName , BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl) { const string fullns = parseNs(dbName, cmdObj); diff --git a/src/mongo/s/cursors.cpp b/src/mongo/s/cursors.cpp index 00c78d7d64c..1c8114d85ed 100644 --- a/src/mongo/s/cursors.cpp +++ b/src/mongo/s/cursors.cpp @@ -442,7 +442,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } virtual bool isWriteCommandForConfigServer() const { return false; } - bool run(const string&, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string&, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { cursorCache.appendInfo( result ); if ( jsobj["setTimeout"].isNumber() ) CursorCache::TIMEOUT = jsobj["setTimeout"].numberLong(); diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index 5a98b4825f0..18dd8e28823 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -711,7 +711,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { return migrateFromStatus.transferMods( errmsg, result ); } } transferModsCommand; @@ -728,7 +728,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { return migrateFromStatus.clone( errmsg, result ); } } initialCloneCommand; @@ -771,7 +771,7 @@ namespace mongo { return parseNsFullyQualified(dbname, cmdObj); } - bool newRun(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { // 1. parse options // 2. make sure my view is complete and lock // 3. start migrate @@ -2156,7 +2156,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { // Active state of TO-side migrations (MigrateStatus) is serialized by distributed // collection lock. @@ -2255,7 +2255,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { migrateStatus.status( result ); return 1; } @@ -2273,7 +2273,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { bool ok = migrateStatus.startCommit(); migrateStatus.status( result ); return ok; @@ -2292,7 +2292,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { migrateStatus.abort(); migrateStatus.status( result ); return true; diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp index 528f0067c6d..af9a10daf5e 100644 --- a/src/mongo/s/d_split.cpp +++ b/src/mongo/s/d_split.cpp @@ -71,7 +71,7 @@ namespace mongo { virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { errmsg = "medianKey command no longer supported. Calling this indicates mismatch between mongo versions."; return false; } @@ -97,7 +97,7 @@ namespace mongo { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { std::string ns = parseNs(dbname, jsobj); BSONObj keyPattern = jsobj.getObjectField( "keyPattern" ); @@ -236,7 +236,7 @@ namespace mongo { virtual std::string parseNs(const string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { // // 1.a We'll parse the parameters in two steps. First, make sure the we can use the split index to get @@ -528,7 +528,7 @@ namespace mongo { virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) { // // 1. check whether parameters passed to splitChunk are sound diff --git a/src/mongo/s/d_state.cpp b/src/mongo/s/d_state.cpp index 0f3ae665be0..1257b9d1701 100644 --- a/src/mongo/s/d_state.cpp +++ b/src/mongo/s/d_state.cpp @@ -853,7 +853,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { ShardedConnectionInfo::reset(); return true; } @@ -938,7 +938,7 @@ namespace mongo { return true; } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { // Steps // 1. check basic config @@ -1197,7 +1197,7 @@ namespace mongo { return parseNsFullyQualified(dbname, cmdObj); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { string ns = cmdObj["getShardVersion"].valuestrsafe(); if ( ns.size() == 0 ) { errmsg = "need to specify full namespace"; @@ -1240,7 +1240,7 @@ namespace mongo { out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& dbname, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { Lock::DBWrite dbXLock(dbname); Client::Context ctx(dbname); diff --git a/src/mongo/s/d_writeback.cpp b/src/mongo/s/d_writeback.cpp index 41fae82ab66..95cab8046c3 100644 --- a/src/mongo/s/d_writeback.cpp +++ b/src/mongo/s/d_writeback.cpp @@ -170,7 +170,7 @@ namespace mongo { actions.addAction(ActionType::internal); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { cc().curop()->suppressFromCurop(); cc().curop()->setExpectedLatencyMs( 30000 ); @@ -226,7 +226,7 @@ namespace mongo { void help(stringstream& h) const { h<<"internal"; } - bool run(const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { + bool run(TransactionExperiment* txn, const string& , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { writeBackManager.appendStats( result ); return true; } diff --git a/src/mongo/s/distlock_test.cpp b/src/mongo/s/distlock_test.cpp index bf8824454af..51f3df20951 100644 --- a/src/mongo/s/distlock_test.cpp +++ b/src/mongo/s/distlock_test.cpp @@ -103,7 +103,7 @@ namespace mongo { } } - bool run(const string&, BSONObj& cmdObj, int, string& errmsg, + bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { Timer t; DistributedLock lk(ConnectionString(cmdObj["host"].String(), @@ -321,7 +321,7 @@ namespace mongo { return; } - bool run(const string&, BSONObj& cmdObj, int, string& errmsg, + bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { Timer t; @@ -461,7 +461,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out) {} - bool run(const string&, BSONObj& cmdObj, int, string& errmsg, + bool run(TransactionExperiment* txn, const string&, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) { long long skew = (long long) number_field(cmdObj, "skew", 0); diff --git a/src/mongo/s/s_only.cpp b/src/mongo/s/s_only.cpp index a0b1ed2063b..32a5a4f21de 100644 --- a/src/mongo/s/s_only.cpp +++ b/src/mongo/s/s_only.cpp @@ -131,7 +131,7 @@ namespace mongo { std::string errmsg; bool ok; try { - ok = c->newRun( txn, dbname , cmdObj, queryOptions, errmsg, result, false ); + ok = c->run( txn, dbname , cmdObj, queryOptions, errmsg, result, false ); } catch (DBException& e) { ok = false; diff --git a/src/mongo/s/shard.cpp b/src/mongo/s/shard.cpp index ab32a8fa4ac..f80637bb960 100644 --- a/src/mongo/s/shard.cpp +++ b/src/mongo/s/shard.cpp @@ -322,7 +322,7 @@ namespace mongo { actions.addAction(ActionType::getShardMap); out->push_back(Privilege(ResourcePattern::forClusterResource(), actions)); } - virtual bool run(const string&, mongo::BSONObj&, int, std::string& errmsg , mongo::BSONObjBuilder& result, bool) { + virtual bool run(TransactionExperiment* txn, const string&, mongo::BSONObj&, int, std::string& errmsg , mongo::BSONObjBuilder& result, bool) { return staticShardInfo.getShardMap( result , errmsg ); } } cmdGetShardMap; diff --git a/src/mongo/s/shardconnection.cpp b/src/mongo/s/shardconnection.cpp index 59c08b6af39..29830912bd7 100644 --- a/src/mongo/s/shardconnection.cpp +++ b/src/mongo/s/shardconnection.cpp @@ -104,7 +104,7 @@ namespace mongo { out->push_back( Privilege( ResourcePattern::forClusterResource(), actions ) ); } - virtual bool run ( const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool ) { + virtual bool run( TransactionExperiment* txn, const string&, mongo::BSONObj&, int, std::string&, mongo::BSONObjBuilder& result, bool ) { // Base pool info shardConnectionPool.appendInfo( result ); // Thread connection info |