diff options
author | Spencer T Brody <spencer@10gen.com> | 2012-12-20 20:46:35 -0500 |
---|---|---|
committer | Spencer T Brody <spencer@10gen.com> | 2012-12-21 14:37:46 -0500 |
commit | b207726d5587d3ec82e940681fa7f5047066b40a (patch) | |
tree | 4e196228920ade35e50c13405db7d24d9aeb90a1 /src/mongo | |
parent | fbdadd06ff07109cc5231955c3a5bbeb268d80a2 (diff) | |
download | mongo-b207726d5587d3ec82e940681fa7f5047066b40a.tar.gz |
SERVER-7572 Remove doauth argument from Client::Context
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/client.cpp | 24 | ||||
-rw-r--r-- | src/mongo/db/client.h | 12 | ||||
-rw-r--r-- | src/mongo/db/cloner.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/mr.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/db.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/dbcommands.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/dbhelpers.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/dbhelpers.h | 2 | ||||
-rw-r--r-- | src/mongo/db/index_rebuilder.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/introspect.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/oplog.cpp | 18 | ||||
-rw-r--r-- | src/mongo/db/repl.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/rs_sync.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/restapi.cpp | 6 |
14 files changed, 43 insertions, 43 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 6178db3ac56..2c8a33ecab3 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -191,7 +191,7 @@ namespace mongo { } BSONObj CachedBSONObj::_tooBig = fromjson("{\"$msg\":\"query not recording (too large)\"}"); - Client::Context::Context( const std::string& ns , Database * db, bool doauth ) : + Client::Context::Context(const std::string& ns , Database * db) : _client( currentClient.get() ), _oldContext( _client->_context ), _path( mongo::dbpath ), // is this right? could be a different db? may need a dassert for this @@ -204,7 +204,7 @@ namespace mongo { _client->_context = this; } - Client::Context::Context(const string& ns, const std::string& path , bool doauth, bool doVersion ) : + Client::Context::Context(const string& ns, const std::string& path, bool doVersion) : _client( currentClient.get() ), _oldContext( _client->_context ), _path( path ), @@ -213,18 +213,18 @@ namespace mongo { _ns( ns ), _db(0) { - _finishInit( doauth ); + _finishInit(); } /** "read lock, and set my context, all in one operation" * This handles (if not recursively locked) opening an unopened database. */ - Client::ReadContext::ReadContext(const string& ns, const std::string& path, bool doauth ) { + Client::ReadContext::ReadContext(const string& ns, const std::string& path) { { lk.reset( new Lock::DBRead(ns) ); Database *db = dbHolder().get(ns, path); if( db ) { - c.reset( new Context(path, ns, db, doauth) ); + c.reset( new Context(path, ns, db) ); return; } } @@ -235,17 +235,17 @@ namespace mongo { if( Lock::isW() ) { // write locked already DEV RARELY log() << "write locked on ReadContext construction " << ns << endl; - c.reset( new Context(ns, path, doauth) ); + c.reset(new Context(ns, path)); } else if( !Lock::nested() ) { lk.reset(0); { Lock::GlobalWrite w; - Context c(ns, path, doauth); + Context c(ns, path); } // db could be closed at this interim point -- that is ok, we will throw, and don't mind throwing. lk.reset( new Lock::DBRead(ns) ); - c.reset( new Context(ns, path, doauth) ); + c.reset(new Context(ns, path)); } else { uasserted(15928, str::stream() << "can't open a database from a nested read lock " << ns); @@ -257,9 +257,9 @@ namespace mongo { // it would be easy to first check that there is at least a .ns file, or something similar. } - Client::WriteContext::WriteContext(const string& ns, const std::string& path , bool doauth ) + Client::WriteContext::WriteContext(const string& ns, const std::string& path) : _lk( ns ) , - _c( ns , path , doauth ) { + _c(ns, path) { } @@ -283,7 +283,7 @@ namespace mongo { } // invoked from ReadContext - Client::Context::Context(const string& path, const string& ns, Database *db , bool doauth) : + Client::Context::Context(const string& path, const string& ns, Database *db) : _client( currentClient.get() ), _oldContext( _client->_context ), _path( path ), @@ -298,7 +298,7 @@ namespace mongo { _client->_curOp->enter( this ); } - void Client::Context::_finishInit( bool doauth ) { + void Client::Context::_finishInit() { dassert( Lock::isLocked() ); int writeLocked = Lock::somethingWriteLocked(); if ( writeLocked && FileAllocator::get()->hasFailed() ) { diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h index 08771bb7222..3b19b11762c 100644 --- a/src/mongo/db/client.h +++ b/src/mongo/db/client.h @@ -154,7 +154,7 @@ namespace mongo { */ class ReadContext : boost::noncopyable { public: - ReadContext(const std::string& ns, const std::string& path=dbpath, bool doauth=true ); + ReadContext(const std::string& ns, const std::string& path=dbpath); Context& ctx() { return *c.get(); } private: scoped_ptr<Lock::DBRead> lk; @@ -167,16 +167,16 @@ namespace mongo { class Context : boost::noncopyable { public: /** this is probably what you want */ - Context(const string& ns, const std::string& path=dbpath, bool doauth=true, bool doVersion=true ); + Context(const string& ns, const std::string& path=dbpath, bool doVersion=true); /** note: this does not call finishInit -- i.e., does not call shardVersionOk() for example. see also: reset(). */ - Context( const std::string& ns , Database * db, bool doauth=true ); + Context(const std::string& ns , Database * db); // used by ReadContext - Context(const string& path, const string& ns, Database *db, bool doauth); + Context(const string& path, const string& ns, Database *db); ~Context(); Client* getClient() const { return _client; } @@ -205,7 +205,7 @@ namespace mongo { private: friend class CurOp; - void _finishInit( bool doauth=true); + void _finishInit(); void checkNotStale() const; void checkNsAccess( bool doauth ); void checkNsAccess( bool doauth, int lockState ); @@ -222,7 +222,7 @@ namespace mongo { class WriteContext : boost::noncopyable { public: - WriteContext(const string& ns, const std::string& path=dbpath, bool doauth=true ); + WriteContext(const string& ns, const std::string& path=dbpath); Context& ctx() { return _c; } private: Lock::DBWrite _lk; diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index c5e2e09f6be..43f4f457e71 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -881,7 +881,7 @@ namespace mongo { bool capped = false; long long size = 0; { - Client::Context ctx( source ); // auths against source + Client::Context ctx( source ); NamespaceDetails *nsd = nsdetails( source ); uassert( 10026 , "source namespace does not exist", nsd ); capped = nsd->isCapped(); @@ -890,7 +890,7 @@ namespace mongo { size += i.ext()->length; } - Client::Context ctx( target ); //auths against target + Client::Context ctx( target ); if ( nsdetails( target ) ) { uassert( 10027 , "target namespace exists", cmdObj["dropTarget"].trueValue() ); diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index c35c78887c8..9e64a9a3f21 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1070,7 +1070,7 @@ namespace mongo { Lock::DBRead lock( config.ns ); // This context does no version check, safe b/c we checked earlier and have an // open cursor - Client::Context ctx( config.ns, dbpath, true, false ); + Client::Context ctx(config.ns, dbpath, false); // obtain full cursor on data to apply mr to shared_ptr<Cursor> temp = NamespaceDetailsTransient::getCursor( config.ns.c_str(), config.filter, config.sort ); diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 2a6aa61c03e..b74385ec3d0 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -683,7 +683,7 @@ namespace mongo { if( !noauth ) { // open admin db in case we need to use it later. TODO this is not the right way to // resolve this. - Client::WriteContext c("admin",dbpath,false); + Client::WriteContext c("admin", dbpath); } listen(listenPort); diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index 07890f347aa..7c790375abe 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -1924,7 +1924,7 @@ namespace mongo { scoped_ptr<Lock::GlobalRead> lk; if( c->lockGlobally() ) lk.reset( new Lock::GlobalRead() ); - Client::ReadContext ctx( ns , dbpath, c->requiresAuth() ); // read locks + Client::ReadContext ctx(ns , dbpath); // read locks client.curop()->ensureStarted(); retval = _execCommand(c, dbname, cmdObj, queryOptions, errmsg, result, fromRepl); } @@ -1944,7 +1944,7 @@ namespace mongo { static_cast<Lock::ScopedLock*>( new Lock::GlobalWrite() ) : static_cast<Lock::ScopedLock*>( new Lock::DBWrite( dbname ) ) ); client.curop()->ensureStarted(); - Client::Context ctx( dbname , dbpath , c->requiresAuth() ); + Client::Context ctx(dbname, dbpath); retval = _execCommand(c, dbname, cmdObj, queryOptions, errmsg, result, fromRepl); if ( retval && c->logTheOp() && ! fromRepl ) { logOp("c", cmdns, cmdObj); diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index fc07e01ffc1..3a3fe90307e 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -154,8 +154,8 @@ namespace mongo { return all; } - bool Helpers::isEmpty(const char *ns, bool doAuth) { - Client::Context context(ns, dbpath, doAuth); + bool Helpers::isEmpty(const char *ns) { + Client::Context context(ns, dbpath); shared_ptr<Cursor> c = DataFileMgr::findAll(ns); return !c->ok(); } diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h index a5fbf3bd638..ff479bc1d11 100644 --- a/src/mongo/db/dbhelpers.h +++ b/src/mongo/db/dbhelpers.h @@ -104,7 +104,7 @@ namespace mongo { /** You do not need to set the database before calling. @return true if collection is empty. */ - static bool isEmpty(const char *ns, bool doAuth=true); + static bool isEmpty(const char *ns); // TODO: this should be somewhere else probably /* Takes object o, and returns a new object with the diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp index 9567b7d5507..716c582f0d5 100644 --- a/src/mongo/db/index_rebuilder.cpp +++ b/src/mongo/db/index_rebuilder.cpp @@ -55,7 +55,7 @@ namespace mongo { BSONObj nsDoc = cursor->next(); const char* ns = nsDoc["name"].valuestrsafe(); - Client::Context ctx(ns, dbpath, false, false); + Client::Context ctx(ns, dbpath, false); NamespaceDetails* nsd = nsdetails(ns); if (!nsd || !nsd->indexBuildsInProgress) { diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index de96f189a07..56b281384a6 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -92,7 +92,7 @@ namespace mongo { try { Lock::DBWrite lk( currentOp.getNS() ); if ( dbHolder()._isLoaded( nsToDatabase( currentOp.getNS() ) , dbpath ) ) { - Client::Context cx( currentOp.getNS(), dbpath, false ); + Client::Context cx(currentOp.getNS(), dbpath); _profile(c, currentOp, profileBufBuilder); } else { diff --git a/src/mongo/db/oplog.cpp b/src/mongo/db/oplog.cpp index 8179ae8a61a..aee37a521a7 100644 --- a/src/mongo/db/oplog.cpp +++ b/src/mongo/db/oplog.cpp @@ -76,13 +76,13 @@ namespace mongo { { const char *logns = rsoplog; if ( rsOplogDetails == 0 ) { - Client::Context ctx( logns , dbpath, false); + Client::Context ctx(logns , dbpath); localDB = ctx.db(); verify( localDB ); rsOplogDetails = nsdetails(logns); massert(13389, "local.oplog.rs missing. did you drop it? if so restart server", rsOplogDetails); } - Client::Context ctx( logns , localDB, false ); + Client::Context ctx(logns , localDB); { int len = op.objsize(); Record *r = theDataFileMgr.fast_oplog_insert(rsOplogDetails, logns, len); @@ -207,13 +207,13 @@ namespace mongo { { const char *logns = rsoplog; if ( rsOplogDetails == 0 ) { - Client::Context ctx( logns , dbpath, false); + Client::Context ctx(logns , dbpath); localDB = ctx.db(); verify( localDB ); rsOplogDetails = nsdetails(logns); massert(13347, "local.oplog.rs missing. did you drop it? if so restart server", rsOplogDetails); } - Client::Context ctx( logns , localDB, false ); + Client::Context ctx(logns , localDB); r = theDataFileMgr.fast_oplog_insert(rsOplogDetails, logns, len); /* todo: now() has code to handle clock skew. but if the skew server to server is large it will get unhappy. this code (or code in now() maybe) should be improved. @@ -250,7 +250,7 @@ namespace mongo { mutex::scoped_lock lk2(OpTime::m); const OpTime ts = OpTime::now(lk2); - Client::Context context("",0,false); + Client::Context context("", 0); /* we jump through a bunch of hoops here to avoid copying the obj buffer twice -- instead we do a single copy to the destination position in the memory mapped file. @@ -276,17 +276,17 @@ namespace mongo { if( logNS == 0 ) { logNS = "local.oplog.$main"; if ( localOplogMainDetails == 0 ) { - Client::Context ctx( logNS , dbpath, false); + Client::Context ctx(logNS , dbpath); localDB = ctx.db(); verify( localDB ); localOplogMainDetails = nsdetails(logNS); verify( localOplogMainDetails ); } - Client::Context ctx( logNS , localDB, false ); + Client::Context ctx(logNS , localDB); r = theDataFileMgr.fast_oplog_insert(localOplogMainDetails, logNS, len); } else { - Client::Context ctx( logNS, dbpath, false ); + Client::Context ctx(logNS, dbpath); verify( nsdetails( logNS ) ); // first we allocate the space, then we fill it below. r = theDataFileMgr.fast_oplog_insert( nsdetails( logNS ), logNS, len); @@ -945,7 +945,7 @@ namespace mongo { BSONElement e = i.next(); const BSONObj& temp = e.Obj(); - Client::Context ctx( temp["ns"].String() ); // this handles security + Client::Context ctx(temp["ns"].String()); bool failed = applyOperation_inlock(temp, false, alwaysUpsert); ab.append(!failed); if ( failed ) diff --git a/src/mongo/db/repl.cpp b/src/mongo/db/repl.cpp index 7b6e2c1cd83..289f317635e 100644 --- a/src/mongo/db/repl.cpp +++ b/src/mongo/db/repl.cpp @@ -192,7 +192,7 @@ namespace mongo { int n = 0; list<BSONObj> src; { - Client::ReadContext ctx( "local.sources", dbpath, false ); + Client::ReadContext ctx("local.sources", dbpath); shared_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); while ( c->ok() ) { src.push_back(c->current()); diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp index d78788dead8..449f3f1a457 100644 --- a/src/mongo/db/repl/rs_sync.cpp +++ b/src/mongo/db/repl/rs_sync.cpp @@ -77,7 +77,7 @@ namespace replset { lk.reset(new Lock::DBWrite(ns)); } - Client::Context ctx(ns, dbpath, false); + Client::Context ctx(ns, dbpath); ctx.getClient()->curop()->reset(); // For non-initial-sync, we convert updates to upserts // to suppress errors when replaying oplog entries. diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp index da9a3fe48ef..2500cd13763 100644 --- a/src/mongo/db/restapi.cpp +++ b/src/mongo/db/restapi.cpp @@ -253,15 +253,15 @@ namespace mongo { writelocktry wl(10000); verify( wl.got() ); - Client::Context cx( "admin.system.users", dbpath, false ); + Client::Context cx("admin.system.users", dbpath); } bool RestAdminAccess::haveAdminUsers() const { openAdminDb(); readlocktry rl(/*"admin.system.users", */10000); uassert( 16173 , "couldn't get read lock to get admin auth credentials" , rl.got() ); - Client::Context cx( "admin.system.users", dbpath, false ); - return ! Helpers::isEmpty("admin.system.users", false); + Client::Context cx("admin.system.users", dbpath); + return ! Helpers::isEmpty("admin.system.users"); } BSONObj RestAdminAccess::getAdminUser( const string& username ) const { |