summaryrefslogtreecommitdiff
path: root/src/mongo/db/range_deleter_db_env.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2015-04-07 16:49:06 -0400
committerAndy Schwerin <schwerin@mongodb.com>2015-04-20 14:06:16 -0400
commit84c4b7d15c6b98c7bb648bc60ade93b6af62b129 (patch)
tree6a0afa97d6f911c07089ccdf7bc29aa2deaed314 /src/mongo/db/range_deleter_db_env.cpp
parent8e5b16fe0d64d587e0741dab7cabe64b0a818e51 (diff)
downloadmongo-84c4b7d15c6b98c7bb648bc60ade93b6af62b129.tar.gz
SERVER-17817 Make ServiceContext create and manage Client objects.
Also, deduplicate Client::* method implementations, guard the identity of the current CurOp of a Client with the Client's _mutex instead of the mutex guarding the list of all clients. Makes the currentClient object private to client.cpp, and all access to the thread-bound client is now done with haveClient() and cc() free functions in the mongo namespace. Removes the vesitgal Client::shutdown() methods.
Diffstat (limited to 'src/mongo/db/range_deleter_db_env.cpp')
-rw-r--r--src/mongo/db/range_deleter_db_env.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/mongo/db/range_deleter_db_env.cpp b/src/mongo/db/range_deleter_db_env.cpp
index a717a2ba6fc..5756d97616a 100644
--- a/src/mongo/db/range_deleter_db_env.cpp
+++ b/src/mongo/db/range_deleter_db_env.cpp
@@ -50,8 +50,7 @@ namespace mongo {
using std::string;
void RangeDeleterDBEnv::initThread() {
- if ( currentClient.get() == NULL )
- Client::initThread( "RangeDeleter" );
+ Client::initThreadIfNotAlready("RangeDeleter");
}
/**
@@ -76,11 +75,7 @@ namespace mongo {
const bool fromMigrate = taskDetails.options.fromMigrate;
const bool onlyRemoveOrphans = taskDetails.options.onlyRemoveOrphanedDocs;
- const bool initiallyHaveClient = haveClient();
-
- if (!initiallyHaveClient) {
- Client::initThread("RangeDeleter");
- }
+ Client::initThreadIfNotAlready("RangeDeleter");
*deletedDocs = 0;
ShardForceVersionOkModeBlock forceVersion;
@@ -119,10 +114,6 @@ namespace mongo {
*errMsg = "collection or index dropped before data could be cleaned";
warning() << *errMsg << endl;
- if (!initiallyHaveClient) {
- txn->getClient()->shutdown();
- }
-
return false;
}
@@ -139,18 +130,10 @@ namespace mongo {
<< " -> " << exclusiveUpper
<< ", cause by:" << causedBy(ex);
- if (!initiallyHaveClient) {
- txn->getClient()->shutdown();
- }
-
return false;
}
}
- if (!initiallyHaveClient) {
- txn->getClient()->shutdown();
- }
-
return true;
}