diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-11-06 22:18:15 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-11-13 14:30:10 -0500 |
commit | 284f942a45b877f0baecd19cbf17fc2a4e246a79 (patch) | |
tree | 1ab1c86450338fe7f5b7276cb3a35b092b61bc93 | |
parent | 1722a1f3ec981d2e6c3478685e527a34f9863f2e (diff) | |
download | mongo-284f942a45b877f0baecd19cbf17fc2a4e246a79.tar.gz |
SERVER-14062 Cleanup Client::hasWrittenSinceCheckpoint and some usages of cc()
This is in preparation for removing the Global OperationContext registry.
OperationContexts will instead be reachable through the client.
-rw-r--r-- | src/mongo/db/client.cpp | 86 | ||||
-rw-r--r-- | src/mongo/db/client.h | 50 | ||||
-rw-r--r-- | src/mongo/db/commands/rename_collection.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/curop.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/currentop_command.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/db.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/global_environment_d.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/index/btree_based_bulk_access_method.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/instance.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/operation_context.h | 17 | ||||
-rw-r--r-- | src/mongo/db/operation_context_impl.cpp | 13 | ||||
-rw-r--r-- | src/mongo/db/operation_context_impl.h | 3 | ||||
-rw-r--r-- | src/mongo/db/operation_context_noop.h | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_coordinator_impl_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/storage/mmap_v1/dur.cpp | 7 | ||||
-rw-r--r-- | src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/storage/mmap_v1/repair_database.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/d_migrate.cpp | 39 | ||||
-rw-r--r-- | src/mongo/s/s_only.cpp | 5 |
19 files changed, 120 insertions, 141 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 2c0845909f9..d1ed1a927c8 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -56,6 +56,7 @@ #include "mongo/db/instance.h" #include "mongo/db/json.h" #include "mongo/db/jsobj.h" +#include "mongo/db/lasterror.h" #include "mongo/db/repl/handshake_args.h" #include "mongo/db/repl/repl_coordinator_global.h" #include "mongo/db/storage_options.h" @@ -67,13 +68,12 @@ #include "mongo/util/mongoutils/str.h" #include "mongo/util/log.h" - namespace mongo { using logger::LogComponent; - mongo::mutex& Client::clientsMutex = *(new mutex("clientsMutex")); - set<Client*>& Client::clients = *(new set<Client*>); // always be in clientsMutex when manipulating this + boost::mutex Client::clientsMutex; + ClientSet Client::clients; TSP_DEFINE(Client, currentClient) @@ -81,64 +81,51 @@ namespace mongo { call this when your thread starts. */ void Client::initThread(const char *desc, AbstractMessagingPort *mp) { - verify( currentClient.get() == 0 ); + invariant(currentClient.get() == 0); - string fullDesc = desc; - if ( str::equals( "conn" , desc ) && mp != NULL ) + string fullDesc; + if (mp != NULL) { fullDesc = str::stream() << desc << mp->connectionId(); + } + else { + fullDesc = desc; + } - setThreadName( fullDesc.c_str() ); + setThreadName(fullDesc.c_str()); + mongo::lastError.initThread(); // Create the client obj, attach to thread - Client *c = new Client( fullDesc, mp ); - currentClient.reset(c); - mongo::lastError.initThread(); - c->setAuthorizationSession(new AuthorizationSession(new AuthzSessionExternalStateMongod( - getGlobalAuthorizationManager()))); + Client* client = new Client(fullDesc, mp); + client->setAuthorizationSession( + new AuthorizationSession( + new AuthzSessionExternalStateMongod(getGlobalAuthorizationManager()))); + + currentClient.reset(client); + + // This makes the client visible to maintenance threads + boost::mutex::scoped_lock clientLock(clientsMutex); + clients.insert(client); } - Client::Client(const string& desc, AbstractMessagingPort *p) : - ClientBasic(p), - _shutdown(false), - _desc(desc), - _god(0), - _lastOp(0) - { - _hasWrittenSinceCheckpoint = false; - _connectionId = p ? p->connectionId() : 0; + Client::Client(const string& desc, AbstractMessagingPort *p) + : ClientBasic(p), + _desc(desc), + _threadId(boost::this_thread::get_id()), + _connectionId(p ? p->connectionId() : 0), + _god(0), + _lastOp(0), + _shutdown(false) { + _curOp = new CurOp( this ); -#ifndef _WIN32 - stringstream temp; - temp << hex << showbase << pthread_self(); - _threadId = temp.str(); -#endif - scoped_lock bl(clientsMutex); - clients.insert(this); } Client::~Client() { _god = 0; - // Because both Client object pointers and logging infrastructure are stored in Thread - // Specific Pointers and because we do not explicitly control the order in which TSPs are - // deleted, it is possible for the logging infrastructure to have been deleted before - // this code runs. This leads to segfaults (access violations) if this code attempts - // to log anything. Therefore, disable logging from this destructor until this is fixed. - // TODO(tad) Force the logging infrastructure to be the last TSP to be deleted for each - // thread and reenable this code once that is done. -#if 0 - if ( _context ) - error() << "Client::~Client _context should be null but is not; client:" << _desc << endl; - - if ( ! _shutdown ) { - error() << "Client::shutdown not called: " << _desc << endl; - } -#endif - if ( ! inShutdown() ) { // we can't clean up safely once we're in shutdown { - scoped_lock bl(clientsMutex); + boost::mutex::scoped_lock clientLock(clientsMutex); if ( ! _shutdown ) clients.erase(this); } @@ -157,7 +144,7 @@ namespace mongo { if ( inShutdown() ) return false; { - scoped_lock bl(clientsMutex); + boost::mutex::scoped_lock clientLock(clientsMutex); clients.erase(this); } @@ -333,9 +320,10 @@ namespace mongo { void Client::reportState(BSONObjBuilder& builder) { builder.append("desc", desc()); - if (_threadId.size()) { - builder.append("threadId", _threadId); - } + + std::stringstream ss; + ss << _threadId; + builder.append("threadId", ss.str()); if (_connectionId) { builder.appendNumber("connectionId", _connectionId); diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h index 78696268ff3..5fe44c85b09 100644 --- a/src/mongo/db/client.h +++ b/src/mongo/db/client.h @@ -36,17 +36,19 @@ #pragma once +#include <boost/thread/thread.hpp> + #include "mongo/db/catalog/database.h" #include "mongo/db/client_basic.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/lasterror.h" #include "mongo/db/namespace_string.h" #include "mongo/db/operation_context.h" +#include "mongo/platform/unordered_set.h" #include "mongo/stdx/functional.h" #include "mongo/util/concurrency/threadlocal.h" #include "mongo/util/paths.h" - namespace mongo { class AuthenticationInfo; @@ -152,12 +154,14 @@ namespace mongo { Collection* _coll; }; + typedef unordered_set<Client*> ClientSet; + /** the database's concept of an outside "client" */ class Client : public ClientBasic { public: - // always be in clientsMutex when manipulating this. killop stuff uses these. - static std::set<Client*>& clients; - static mongo::mutex& clientsMutex; + // A set of currently active clients along with a mutex to protect the list + static boost::mutex clientsMutex; + static ClientSet clients; ~Client(); @@ -207,33 +211,33 @@ namespace mongo { void setRemoteID(const OID& rid) { _remoteId = rid; } // Only used for master/slave OID getRemoteID() const { return _remoteId; } // Only used for master/slave ConnectionId getConnectionId() const { return _connectionId; } - const std::string& getThreadId() const { return _threadId; } - - // XXX(hk): this is per-thread mmapv1 recovery unit stuff, move into that - // impl of recovery unit - void writeHappened() { _hasWrittenSinceCheckpoint = true; } - bool hasWrittenSinceCheckpoint() const { return _hasWrittenSinceCheckpoint; } - void checkpointHappened() { _hasWrittenSinceCheckpoint = false; } - - // XXX: this is really a method in the recovery unit iface to reset any state - void newTopLevelRequest() { - _hasWrittenSinceCheckpoint = false; - } private: Client(const std::string& desc, AbstractMessagingPort *p = 0); friend class CurOp; - ConnectionId _connectionId; // > 0 for things "conn", 0 otherwise - std::string _threadId; // "" on non support systems - CurOp * _curOp; - bool _shutdown; // to track if Client::shutdown() gets called - std::string _desc; + + // Description for the client (e.g. conn8) + const std::string _desc; + + // OS id of the thread, which owns this client + const boost::thread::id _threadId; + + // > 0 for things "conn", 0 otherwise + const ConnectionId _connectionId; + + // Whether this client is running as DBDirectClient bool _god; + + // Changes, based on what operation is running. Some of this should be in OperationContext. + CurOp* _curOp; + + // Used by replication OpTime _lastOp; OID _remoteId; // Only used by master-slave - bool _hasWrittenSinceCheckpoint; - + // Tracks if Client::shutdown() gets called (TODO: Is this necessary?) + bool _shutdown; + public: /* Set database we want to use, then, restores when we finish (are out of scope) diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp index 9d17b9d2361..ed548cc3bf9 100644 --- a/src/mongo/db/commands/rename_collection.cpp +++ b/src/mongo/db/commands/rename_collection.cpp @@ -305,7 +305,7 @@ namespace mongo { // Copy over all the data from source collection to target collection. boost::scoped_ptr<RecordIterator> sourceIt(sourceColl->getIterator(txn)); while (!sourceIt->isEOF()) { - txn->checkForInterrupt(false); + txn->checkForInterrupt(); const BSONObj obj = sourceColl->docFor(txn, sourceIt->getNext()); diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp index 93475c54890..348ffb06d73 100644 --- a/src/mongo/db/curop.cpp +++ b/src/mongo/db/curop.cpp @@ -122,7 +122,7 @@ namespace mongo { CurOp::~CurOp() { if ( _wrapped ) { - scoped_lock bl(Client::clientsMutex); + boost::mutex::scoped_lock clientLock(Client::clientsMutex); _client->_curOp = _wrapped; } _client = 0; diff --git a/src/mongo/db/currentop_command.cpp b/src/mongo/db/currentop_command.cpp index 5c772f2482d..00ae81c4c1b 100644 --- a/src/mongo/db/currentop_command.cpp +++ b/src/mongo/db/currentop_command.cpp @@ -121,11 +121,11 @@ namespace { // underneath and ~CurOp synchronizes on the clients mutex. // // TODO: This is a legacy from 2.6, which needs to be fixed. - scoped_lock bl(Client::clientsMutex); + boost::mutex::scoped_lock scopedLock(Client::clientsMutex); const bool all = q.query["$all"].trueValue(); if (all) { - for (std::set<Client*>::const_iterator i = Client::clients.begin(); + for (ClientSet::const_iterator i = Client::clients.begin(); i != Client::clients.end(); i++) { diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index d087a27b547..6a0cf7901bb 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -62,6 +62,7 @@ #include "mongo/db/instance.h" #include "mongo/db/introspect.h" #include "mongo/db/json.h" +#include "mongo/db/lasterror.h" #include "mongo/db/log_process_details.h" #include "mongo/db/mongod_options.h" #include "mongo/db/operation_context_impl.h" diff --git a/src/mongo/db/global_environment_d.cpp b/src/mongo/db/global_environment_d.cpp index 3c2a272138d..efd005c0aa6 100644 --- a/src/mongo/db/global_environment_d.cpp +++ b/src/mongo/db/global_environment_d.cpp @@ -96,7 +96,7 @@ namespace mongo { } void GlobalEnvironmentMongoD::setKillAllOperations() { - scoped_lock clientLock(Client::clientsMutex); + boost::mutex::scoped_lock clientLock(Client::clientsMutex); _globalKill = true; for (size_t i = 0; i < _killOpListeners.size(); i++) { try { @@ -113,12 +113,12 @@ namespace mongo { } bool GlobalEnvironmentMongoD::killOperation(unsigned int opId) { - scoped_lock clientLock(Client::clientsMutex); + boost::mutex::scoped_lock clientLock(Client::clientsMutex); bool found = false; // XXX clean up { - for( set< Client* >::const_iterator j = Client::clients.begin(); + for(ClientSet::const_iterator j = Client::clients.begin(); !found && j != Client::clients.end(); ++j ) { @@ -154,7 +154,7 @@ namespace mongo { } void GlobalEnvironmentMongoD::registerKillOpListener(KillOpListenerInterface* listener) { - scoped_lock clientLock(Client::clientsMutex); + boost::mutex::scoped_lock clientLock(Client::clientsMutex); _killOpListeners.push_back(listener); } diff --git a/src/mongo/db/index/btree_based_bulk_access_method.cpp b/src/mongo/db/index/btree_based_bulk_access_method.cpp index 1a31b744012..9e5cadcd57d 100644 --- a/src/mongo/db/index/btree_based_bulk_access_method.cpp +++ b/src/mongo/db/index/btree_based_bulk_access_method.cpp @@ -141,8 +141,9 @@ namespace mongo { } while (i->more()) { - if (mayInterrupt) - _txn->checkForInterrupt(/*heedMutex*/ false); + if (mayInterrupt) { + _txn->checkForInterrupt(); + } WriteUnitOfWork wunit(_txn); diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index 20e92b14fda..b9ee057756c 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -376,9 +376,6 @@ namespace { nestedOp.reset( new CurOp( &c , currentOpP ) ); currentOpP = nestedOp.get(); } - else { - c.newTopLevelRequest(); - } CurOp& currentOp = *currentOpP; currentOp.reset(remote,op); diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h index 30ffe271b91..3897fa4820d 100644 --- a/src/mongo/db/operation_context.h +++ b/src/mongo/db/operation_context.h @@ -28,15 +28,12 @@ #pragma once -#include <stdlib.h> - #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" #include "mongo/base/string_data.h" #include "mongo/db/storage/recovery_unit.h" #include "mongo/db/concurrency/locker.h" - namespace mongo { class Client; @@ -84,17 +81,11 @@ namespace mongo { // --- operation level info? --- /** - * TODO: Get rid of this and just have one interrupt func? - * throws an exception if the operation is interrupted - * @param heedMutex if true and have a write lock, won't kill op since it might be unsafe - */ - virtual void checkForInterrupt(bool heedMutex = true) const = 0; - - /** - * TODO: Where do I go - * @return Status::OK() if not interrupted - * otherwise returns reasons + * If the thread is not interrupted, returns Status::OK(), otherwise returns the cause + * for the interruption. The throw variant returns a user assertion corresponding to the + * interruption status. */ + virtual void checkForInterrupt() const = 0; virtual Status checkForInterruptNoAssert() const = 0; /** diff --git a/src/mongo/db/operation_context_impl.cpp b/src/mongo/db/operation_context_impl.cpp index 11991925260..6cec3f70c6c 100644 --- a/src/mongo/db/operation_context_impl.cpp +++ b/src/mongo/db/operation_context_impl.cpp @@ -162,23 +162,20 @@ namespace { } // namespace - void OperationContextImpl::checkForInterrupt(bool heedMutex) const { - Client* c = getClient(); - - if (heedMutex && lockState()->isWriteLocked() && c->hasWrittenSinceCheckpoint()) { - return; - } + void OperationContextImpl::checkForInterrupt() const { + // We cannot interrupt operation, while it's inside of a write unit of work, because logOp + // cannot handle being iterrupted. + if (lockState()->inAWriteUnitOfWork()) return; uassertStatusOK(checkForInterruptNoAssert()); } Status OperationContextImpl::checkForInterruptNoAssert() const { - Client* c = getClient(); - if (getGlobalEnvironment()->getKillAllOperations()) { return Status(ErrorCodes::InterruptedAtShutdown, "interrupted at shutdown"); } + Client* c = getClient(); if (c->curop()->maxTimeHasExpired()) { c->curop()->kill(); return Status(ErrorCodes::ExceededTimeLimit, "operation exceeded time limit"); diff --git a/src/mongo/db/operation_context_impl.h b/src/mongo/db/operation_context_impl.h index bdb3622816b..09bfd614769 100644 --- a/src/mongo/db/operation_context_impl.h +++ b/src/mongo/db/operation_context_impl.h @@ -64,8 +64,7 @@ namespace mongo { virtual unsigned int getOpID() const; - virtual void checkForInterrupt(bool heedMutex = true) const; - + virtual void checkForInterrupt() const; virtual Status checkForInterruptNoAssert() const; virtual bool isPrimaryFor( const StringData& ns ); diff --git a/src/mongo/db/operation_context_noop.h b/src/mongo/db/operation_context_noop.h index 347578c8cc7..8d946850186 100644 --- a/src/mongo/db/operation_context_noop.h +++ b/src/mongo/db/operation_context_noop.h @@ -32,7 +32,6 @@ #include "mongo/db/curop.h" #include "mongo/db/storage/recovery_unit_noop.h" - namespace mongo { class OperationContextNoop : public OperationContext { @@ -81,8 +80,7 @@ namespace mongo { return &_pm; } - virtual void checkForInterrupt(bool heedMutex = true) const { } - + virtual void checkForInterrupt() const { } virtual Status checkForInterruptNoAssert() const { return Status::OK(); } diff --git a/src/mongo/db/repl/repl_coordinator_impl_test.cpp b/src/mongo/db/repl/repl_coordinator_impl_test.cpp index f17166ce1c7..cf6a2208ba1 100644 --- a/src/mongo/db/repl/repl_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/repl_coordinator_impl_test.cpp @@ -920,7 +920,7 @@ namespace { _opID = opID; } - virtual void checkForInterrupt(bool heedMutex = true) const { + virtual void checkForInterrupt() const { if (_interruptOp) { uasserted(ErrorCodes::Interrupted, "operation was interrupted"); } diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp index 188a001149b..74b74fdcc2d 100644 --- a/src/mongo/db/storage/mmap_v1/dur.cpp +++ b/src/mongo/db/storage/mmap_v1/dur.cpp @@ -206,12 +206,10 @@ namespace mongo { } bool NonDurableImpl::commitNow(OperationContext* txn) { - cc().checkpointHappened(); // XXX: remove when all dur goes through DurRecoveryUnit return false; } bool NonDurableImpl::commitIfNeeded(OperationContext* txn) { - cc().checkpointHappened(); // XXX: remove when all dur goes through DurRecoveryUnit return false; } @@ -238,7 +236,6 @@ namespace mongo { flushRequested.notify_one(); commitJob._notify.waitFor(when); - cc().checkpointHappened(); return true; } @@ -285,10 +282,6 @@ namespace mongo { } bool DurableImpl::commitIfNeeded(OperationContext* txn) { - // this is safe since since conceptually if you call commitIfNeeded, we're at a valid - // spot in an operation to be terminated. - cc().checkpointHappened(); - if (MONGO_likely(commitJob.bytes() < UncommittedBytesLimit)) { return false; } diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp index 90b9d4d3896..74a7c226354 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp @@ -313,12 +313,6 @@ namespace mongo { if ( fileNo < mmapv1GlobalOptions.quotaFiles ) return; - // exceeded! - if ( cc().hasWrittenSinceCheckpoint() ) { - warning() << "quota exceeded, but can't assert" << endl; - return; - } - uasserted(12501, "quota exceeded"); } diff --git a/src/mongo/db/storage/mmap_v1/repair_database.cpp b/src/mongo/db/storage/mmap_v1/repair_database.cpp index 5d0bcd41d8f..52d2ae8726a 100644 --- a/src/mongo/db/storage/mmap_v1/repair_database.cpp +++ b/src/mongo/db/storage/mmap_v1/repair_database.cpp @@ -419,7 +419,7 @@ namespace mongo { return result.getStatus(); wunit.commit(); - txn->checkForInterrupt(false); + txn->checkForInterrupt(); } Status status = indexer.doneInserting(); @@ -439,7 +439,7 @@ namespace mongo { // need both in case journaling is disabled MongoFile::flushAll(true); - txn->checkForInterrupt(false); + txn->checkForInterrupt(); } // at this point if we abort, we don't want to delete new files diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index 4d64a859e17..82b5b919246 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -131,10 +131,24 @@ namespace mongo { class MoveTimingHelper { public: - MoveTimingHelper( const string& where , const string& ns , BSONObj min , BSONObj max , - int total, string* cmdErrmsg, string toShard, string fromShard ) - : _where( where ) , _ns( ns ) , _to( toShard ), _from( fromShard ), _next( 0 ), - _total( total ) , _cmdErrmsg( cmdErrmsg ) { + MoveTimingHelper(OperationContext* txn, + const string& where, + const string& ns, + BSONObj min, + BSONObj max , + int total, + string* cmdErrmsg, + string toShard, + string fromShard) + : _txn(txn), + _where(where), + _ns(ns), + _to(toShard), + _from(fromShard), + _next(0), + _total(total), + _cmdErrmsg(cmdErrmsg) { + _b.append( "min" , min ); _b.append( "max" , max ); } @@ -165,7 +179,7 @@ namespace mongo { } } - void done( int step ) { + void done(int step) { verify( step == ++_next ); verify( step <= _total ); @@ -173,7 +187,7 @@ namespace mongo { ss << "step " << step << " of " << _total; string s = ss.str(); - CurOp * op = cc().curop(); + CurOp * op = _txn->getCurOp(); if ( op ) op->setMessage( s.c_str() ); else @@ -192,6 +206,7 @@ namespace mongo { } private: + OperationContext* const _txn; Timer _t; string _where; @@ -997,7 +1012,7 @@ namespace mongo { return false; } - MoveTimingHelper timing( "from" , ns , min , max , 6 /* steps */ , &errmsg, + MoveTimingHelper timing(txn, "from" , ns , min , max , 6 /* steps */ , &errmsg, toShardName, fromShardName ); log() << "received moveChunk request: " << cmdObj << migrateLog; @@ -1734,7 +1749,7 @@ namespace mongo { << " at epoch " << epoch.toString() << endl; string errmsg; - MoveTimingHelper timing( "to" , ns , min , max , 5 /* steps */ , &errmsg, "", "" ); + MoveTimingHelper timing(txn, "to", ns, min, max, 5 /* steps */, &errmsg, "", ""); ScopedDbConnection conn(from); conn->getLastError(); // just test connection @@ -1947,7 +1962,7 @@ namespace mongo { repl::ReplicationCoordinator::StatusAndDuration replStatus = repl::getGlobalReplicationCoordinator()->awaitReplication( txn, - cc().getLastOp(), + txn->getClient()->getLastOp(), writeConcern); if (replStatus.status.code() == ErrorCodes::ExceededTimeLimit) { warning() << "secondaryThrottle on, but doc insert timed out; " @@ -1968,7 +1983,7 @@ namespace mongo { } // if running on a replicated system, we'll need to flush the docs we cloned to the secondaries - ReplTime lastOpApplied = cc().getLastOp().asDate(); + ReplTime lastOpApplied = txn->getClient()->getLastOp().asDate(); { // 4. do bulk of mods @@ -2368,11 +2383,11 @@ namespace mongo { OperationContextImpl txn; if (getGlobalAuthorizationManager()->isAuthEnabled()) { ShardedConnectionInfo::addHook(); - cc().getAuthorizationSession()->grantInternalAuthorization(); + txn.getClient()->getAuthorizationSession()->grantInternalAuthorization(); } // Make curop active so this will show up in currOp. - cc().curop()->reset(); + txn.getCurOp()->reset(); migrateStatus.go(&txn); cc().shutdown(); diff --git a/src/mongo/s/s_only.cpp b/src/mongo/s/s_only.cpp index d395ce4c3d7..643b4dd1ba5 100644 --- a/src/mongo/s/s_only.cpp +++ b/src/mongo/s/s_only.cpp @@ -67,10 +67,11 @@ namespace mongo { Client::Client(const string& desc, AbstractMessagingPort *p) : ClientBasic(p), - _shutdown(false), _desc(desc), + _connectionId(), _god(0), - _lastOp(0) { + _lastOp(0), + _shutdown(false) { } Client::~Client() {} bool Client::shutdown() { return true; } |