diff options
-rw-r--r-- | src/mongo/db/query/query_planner.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp index 470b619151a..2ebd0b51834 100644 --- a/src/mongo/db/query/query_planner.cpp +++ b/src/mongo/db/query/query_planner.cpp @@ -361,7 +361,7 @@ namespace mongo { // cases, and we proceed by using the PlanCacheIndexTree to tag the query tree. // Create a copy of the expression tree. We use cachedSoln to annotate this with indices. - MatchExpression* clone = query.root()->shallowClone(); + auto_ptr<MatchExpression> clone(query.root()->shallowClone()); QLOG() << "Tagging the match expression according to cache data: " << endl << "Filter:" << endl << clone->toString() @@ -377,19 +377,21 @@ namespace mongo { QLOG() << "Index " << i << ": " << ie.keyPattern.toString() << endl; } - Status s = tagAccordingToCache(clone, cacheData.tree.get(), indexMap); + Status s = tagAccordingToCache(clone.get(), cacheData.tree.get(), indexMap); if (!s.isOK()) { return s; } // The planner requires a defined sort order. - sortUsingTags(clone); + sortUsingTags(clone.get()); QLOG() << "Tagged tree:" << endl << clone->toString(); - // Use the cached index assignments to build solnRoot. Takes ownership of clone. - QuerySolutionNode* solnRoot = - QueryPlannerAccess::buildIndexedDataAccess(query, clone, false, params.indices); + // Use the cached index assignments to build solnRoot. + QuerySolutionNode* solnRoot = QueryPlannerAccess::buildIndexedDataAccess(query, + clone.release(), + false, + params.indices); if (NULL != solnRoot) { // Takes ownership of 'solnRoot'. |