summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_cache_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/plan_cache_test.cpp')
-rw-r--r--src/mongo/db/query/plan_cache_test.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp
index a5353cbfcbe..55554315376 100644
--- a/src/mongo/db/query/plan_cache_test.cpp
+++ b/src/mongo/db/query/plan_cache_test.cpp
@@ -52,7 +52,7 @@ using namespace mongo;
namespace {
using boost::scoped_ptr;
- using std::auto_ptr;
+ using std::unique_ptr;
using std::string;
using std::unique_ptr;
using std::vector;
@@ -173,7 +173,7 @@ namespace {
*/
struct GenerateQuerySolution {
QuerySolution* operator()() const {
- auto_ptr<QuerySolution> qs(new QuerySolution());
+ unique_ptr<QuerySolution> qs(new QuerySolution());
qs->cacheData.reset(new SolutionCacheData());
qs->cacheData->solnType = SolutionCacheData::COLLSCAN_SOLN;
qs->cacheData->tree.reset(new PlanCacheIndexTree());
@@ -185,10 +185,10 @@ namespace {
* Utility function to create a PlanRankingDecision
*/
PlanRankingDecision* createDecision(size_t numPlans) {
- auto_ptr<PlanRankingDecision> why(new PlanRankingDecision());
+ unique_ptr<PlanRankingDecision> why(new PlanRankingDecision());
for (size_t i = 0; i < numPlans; ++i) {
CommonStats common("COLLSCAN");
- auto_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
+ unique_ptr<PlanStageStats> stats(new PlanStageStats(common, STAGE_COLLSCAN));
stats->specific.reset(new CollectionScanStats());
why->stats.mutableVector().push_back(stats.release());
why->scores.push_back(0U);
@@ -222,12 +222,12 @@ namespace {
}
void assertShouldNotCacheQuery(const BSONObj& query) {
- auto_ptr<CanonicalQuery> cq(canonicalize(query));
+ unique_ptr<CanonicalQuery> cq(canonicalize(query));
assertShouldNotCacheQuery(*cq);
}
void assertShouldNotCacheQuery(const char* queryStr) {
- auto_ptr<CanonicalQuery> cq(canonicalize(queryStr));
+ unique_ptr<CanonicalQuery> cq(canonicalize(queryStr));
assertShouldNotCacheQuery(*cq);
}
@@ -238,12 +238,12 @@ namespace {
*/
TEST(PlanCacheTest, ShouldCacheQueryBasic) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
assertShouldCacheQuery(*cq);
}
TEST(PlanCacheTest, ShouldCacheQuerySort) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{}", "{a: -1}", "{_id: 0, a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{}", "{a: -1}", "{_id: 0, a: 1}"));
assertShouldCacheQuery(*cq);
}
@@ -257,7 +257,7 @@ namespace {
* This should normally be handled by the IDHack runner.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryCollectionScan) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{}"));
assertShouldNotCacheQuery(*cq);
}
@@ -267,7 +267,7 @@ namespace {
* Therefore, not much point in caching.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithHint) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{a: 1, b: 1}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{a: 1, b: 1}",
"{}", "{}"));
assertShouldNotCacheQuery(*cq);
}
@@ -276,7 +276,7 @@ namespace {
* Min queries are a specialized case of hinted queries
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithMin) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
"{a: 100}", "{}"));
assertShouldNotCacheQuery(*cq);
}
@@ -285,7 +285,7 @@ namespace {
* Max queries are non-cacheable for the same reasons as min queries.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithMax) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
"{}", "{a: 100}"));
assertShouldNotCacheQuery(*cq);
}
@@ -295,7 +295,7 @@ namespace {
* the planner is able to come up with a cacheable solution.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoWithinLegacyCoordinates) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
"{$box: [[-180, -90], [180, 90]]}}}"));
assertShouldCacheQuery(*cq);
}
@@ -304,7 +304,7 @@ namespace {
* $geoWithin queries with GeoJSON coordinates are supported by the index bounds builder.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoWithinJSONCoordinates) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoWithin: "
"{$geometry: {type: 'Polygon', coordinates: "
"[[[0, 0], [0, 90], [90, 0], [0, 0]]]}}}}"));
assertShouldCacheQuery(*cq);
@@ -314,7 +314,7 @@ namespace {
* $geoWithin queries with both legacy and GeoJSON coordinates are cacheable.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoWithinLegacyAndJSONCoordinates) {
- auto_ptr<CanonicalQuery> cq(canonicalize(
+ unique_ptr<CanonicalQuery> cq(canonicalize(
"{$or: [{a: {$geoWithin: {$geometry: {type: 'Polygon', "
"coordinates: [[[0, 0], [0, 90], "
"[90, 0], [0, 0]]]}}}},"
@@ -326,7 +326,7 @@ namespace {
* $geoIntersects queries are always cacheable because they support GeoJSON coordinates only.
*/
TEST(PlanCacheTest, ShouldCacheQueryWithGeoIntersects) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoIntersects: "
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoIntersects: "
"{$geometry: {type: 'Point', coordinates: "
"[10.0, 10.0]}}}}"));
assertShouldCacheQuery(*cq);
@@ -337,7 +337,7 @@ namespace {
* between flat and spherical queries.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryWithGeoNear) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoNear: {$geometry: {type: 'Point',"
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: {$geoNear: {$geometry: {type: 'Point',"
"coordinates: [0,0]}, $maxDistance:100}}}"));
assertShouldCacheQuery(*cq);
}
@@ -348,7 +348,7 @@ namespace {
* non-winning plans.
*/
TEST(PlanCacheTest, ShouldNotCacheQueryExplain) {
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}", 0, 0, "{}",
"{}", "{}", // min, max
false, // snapshot
true // explain
@@ -361,7 +361,7 @@ namespace {
// Adding an empty vector of query solutions should fail.
TEST(PlanCacheTest, AddEmptySolutions) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
std::vector<QuerySolution*> solns;
boost::scoped_ptr<PlanRankingDecision> decision(createDecision(1U));
ASSERT_NOT_OK(planCache.add(*cq, solns, decision.get()));
@@ -369,7 +369,7 @@ namespace {
TEST(PlanCacheTest, AddValidSolution) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
QuerySolution qs;
qs.cacheData.reset(new SolutionCacheData());
qs.cacheData->tree.reset(new PlanCacheIndexTree());
@@ -386,7 +386,7 @@ namespace {
TEST(PlanCacheTest, NotifyOfWriteOp) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
+ unique_ptr<CanonicalQuery> cq(canonicalize("{a: 1}"));
QuerySolution qs;
qs.cacheData.reset(new SolutionCacheData());
qs.cacheData->tree.reset(new PlanCacheIndexTree());
@@ -1066,7 +1066,7 @@ namespace {
const char* projStr,
const char *expectedStr) {
PlanCache planCache;
- auto_ptr<CanonicalQuery> cq(canonicalize(queryStr, sortStr, projStr));
+ unique_ptr<CanonicalQuery> cq(canonicalize(queryStr, sortStr, projStr));
PlanCacheKey key = planCache.computeKey(*cq);
PlanCacheKey expectedKey(expectedStr);
if (key == expectedKey) {
@@ -1148,10 +1148,10 @@ namespace {
PlanCache planCache;
// Legacy coordinates.
- auto_ptr<CanonicalQuery> cqLegacy(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cqLegacy(canonicalize("{a: {$geoWithin: "
"{$box: [[-180, -90], [180, 90]]}}}"));
// GeoJSON coordinates.
- auto_ptr<CanonicalQuery> cqNew(canonicalize("{a: {$geoWithin: "
+ unique_ptr<CanonicalQuery> cqNew(canonicalize("{a: {$geoWithin: "
"{$geometry: {type: 'Polygon', coordinates: "
"[[[0, 0], [0, 90], [90, 0], [0, 0]]]}}}}"));
ASSERT_NOT_EQUALS(planCache.computeKey(*cqLegacy),