summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-04-30 15:20:51 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-05-01 09:53:56 -0400
commitd3961a489a651d6e05d19fa20499a34a819a5088 (patch)
tree35e098c0ab2145a3a95b4408f13336ce77d7af20 /src/mongo/db/query
parent7e3f93197f73e5a2e0d1cff55c928dde102aa970 (diff)
downloadmongo-d3961a489a651d6e05d19fa20499a34a819a5088.tar.gz
SERVER-13797 Remove usages of Client::getContext()
This change does not remove all usage of Client::getContext(), but only the simpler ones.
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/cached_plan_runner.cpp11
-rw-r--r--src/mongo/db/query/multi_plan_runner.cpp12
2 files changed, 3 insertions, 20 deletions
diff --git a/src/mongo/db/query/cached_plan_runner.cpp b/src/mongo/db/query/cached_plan_runner.cpp
index 9b108cecb4b..6a17ffb4aa7 100644
--- a/src/mongo/db/query/cached_plan_runner.cpp
+++ b/src/mongo/db/query/cached_plan_runner.cpp
@@ -181,16 +181,7 @@ namespace mongo {
return;
}
- // We need to check db and collection for NULL because updateCache() is called upon destruction of
- // the CachedPlanRunner. In some cases, the db or collection could be dropped without kill()
- // being called on the runner (for example, timeout of a ClientCursor holding the runner).
- // XXX - this whole thing is odd
- Database* db = cc().getContext()->db();
- if (NULL == db) { return; }
- Collection* collection = db->getCollection(_canonicalQuery->ns());
- if (NULL == collection) { return; }
- invariant( collection == _collection );
- PlanCache* cache = collection->infoCache()->getPlanCache();
+ PlanCache* cache = _collection->infoCache()->getPlanCache();
std::auto_ptr<PlanCacheEntryFeedback> feedback(new PlanCacheEntryFeedback());
feedback->stats.reset(_exec->getStats());
diff --git a/src/mongo/db/query/multi_plan_runner.cpp b/src/mongo/db/query/multi_plan_runner.cpp
index 9fe4f28e04a..b544efa1e23 100644
--- a/src/mongo/db/query/multi_plan_runner.cpp
+++ b/src/mongo/db/query/multi_plan_runner.cpp
@@ -294,11 +294,7 @@ namespace mongo {
// cached plan runner to fall back on a different solution
// if the best solution fails. Alternatively we could try to
// defer cache insertion to be after the first produced result.
- Database* db = cc().getContext()->db();
- verify(NULL != db);
- Collection* collection = db->getCollection(_query->ns());
- verify(NULL != collection);
- PlanCache* cache = collection->infoCache()->getPlanCache();
+ PlanCache* cache = _collection->infoCache()->getPlanCache();
cache->remove(*_query);
// Move the backup info into the bestPlan info and clear the backup
@@ -401,11 +397,7 @@ namespace mongo {
const PlanStageStats* bestStats = _ranking->stats.vector()[0];
if (PlanCache::shouldCacheQuery(*_query)
&& (!_alreadyProduced.empty() || bestStats->common.isEOF)) {
- Database* db = cc().getContext()->db();
- verify(NULL != db);
- Collection* collection = db->getCollection(_query->ns());
- verify(NULL != collection);
- PlanCache* cache = collection->infoCache()->getPlanCache();
+ PlanCache* cache = _collection->infoCache()->getPlanCache();
// Create list of candidate solutions for the cache with
// the best solution at the front.
std::vector<QuerySolution*> solutions;