summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner_test.cpp
diff options
context:
space:
mode:
authorQingyang Chen <qingyang.chen@10gen.com>2015-06-16 16:16:12 -0400
committerQingyang Chen <qingyang.chen@10gen.com>2015-06-22 13:17:31 -0400
commit3f6f66daac840fe2b2dc26eeeacbf015479567df (patch)
tree3b8f907c22f9ec41f1a72d1ea71f1dff8376a77d /src/mongo/db/query/query_planner_test.cpp
parent1e786585ae83e55e13016a6761a121b502c887f8 (diff)
downloadmongo-3f6f66daac840fe2b2dc26eeeacbf015479567df.tar.gz
SERVER-16889 query subsystem CanonicalQuery::canonicalize use StatusWith<unique_ptr> for ownership transfer
Diffstat (limited to 'src/mongo/db/query/query_planner_test.cpp')
-rw-r--r--src/mongo/db/query/query_planner_test.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp
index 2c0ca9167a5..4768eed4312 100644
--- a/src/mongo/db/query/query_planner_test.cpp
+++ b/src/mongo/db/query/query_planner_test.cpp
@@ -3761,10 +3761,9 @@ TEST(BadInputTest, CacheDataFromTaggedTree) {
// No relevant index matching the index tag.
relevantIndices.push_back(IndexEntry(BSON("a" << 1)));
- CanonicalQuery* cq;
- Status cqStatus = CanonicalQuery::canonicalize("ns", BSON("a" << 3), &cq);
- ASSERT_OK(cqStatus);
- std::unique_ptr<CanonicalQuery> scopedCq(cq);
+ auto statusWithCQ = CanonicalQuery::canonicalize("ns", BSON("a" << 3));
+ ASSERT_OK(statusWithCQ.getStatus());
+ std::unique_ptr<CanonicalQuery> scopedCq = std::move(statusWithCQ.getValue());
scopedCq->root()->setTag(new IndexTag(1));
s = QueryPlanner::cacheDataFromTaggedTree(scopedCq->root(), relevantIndices, &indexTree);
@@ -3773,10 +3772,9 @@ TEST(BadInputTest, CacheDataFromTaggedTree) {
}
TEST(BadInputTest, TagAccordingToCache) {
- CanonicalQuery* cq;
- Status cqStatus = CanonicalQuery::canonicalize("ns", BSON("a" << 3), &cq);
- ASSERT_OK(cqStatus);
- std::unique_ptr<CanonicalQuery> scopedCq(cq);
+ auto statusWithCQ = CanonicalQuery::canonicalize("ns", BSON("a" << 3));
+ ASSERT_OK(statusWithCQ.getStatus());
+ std::unique_ptr<CanonicalQuery> scopedCq = std::move(statusWithCQ.getValue());
std::unique_ptr<PlanCacheIndexTree> indexTree(new PlanCacheIndexTree());
indexTree->setIndexEntry(IndexEntry(BSON("a" << 1)));
@@ -3801,9 +3799,9 @@ TEST(BadInputTest, TagAccordingToCache) {
ASSERT_OK(s);
// Regenerate canonical query in order to clear tags.
- cqStatus = CanonicalQuery::canonicalize("ns", BSON("a" << 3), &cq);
- ASSERT_OK(cqStatus);
- scopedCq.reset(cq);
+ statusWithCQ = CanonicalQuery::canonicalize("ns", BSON("a" << 3));
+ ASSERT_OK(statusWithCQ.getStatus());
+ scopedCq = std::move(statusWithCQ.getValue());
// Mismatched tree topology.
PlanCacheIndexTree* child = new PlanCacheIndexTree();