summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/get_executor_test.cpp
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2015-04-10 19:52:05 -0400
committerJason Rassi <rassi@10gen.com>2015-04-22 11:16:40 -0400
commitd187ea1cc67b1975b6a1cbfcca1977598e9ea0c5 (patch)
tree31a80677506d77677274c97ffeac321e14e71db3 /src/mongo/db/query/get_executor_test.cpp
parent88f6f4733bca7c615dd6fedcfc93a24cfa68372a (diff)
downloadmongo-d187ea1cc67b1975b6a1cbfcca1977598e9ea0c5.tar.gz
SERVER-17659 Move CQ::getPlanCacheKey() => PlanCache::computeKey()
Includes partial revert of e5f17aaf. In particular, CanonicalQuery objects no longer pre-generate their PlanCacheKey.
Diffstat (limited to 'src/mongo/db/query/get_executor_test.cpp')
-rw-r--r--src/mongo/db/query/get_executor_test.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/query/get_executor_test.cpp b/src/mongo/db/query/get_executor_test.cpp
index e65546502c5..85d97d3f1f7 100644
--- a/src/mongo/db/query/get_executor_test.cpp
+++ b/src/mongo/db/query/get_executor_test.cpp
@@ -75,23 +75,24 @@ namespace {
void testAllowedIndices(const char* hintKeyPatterns[],
const char* indexCatalogKeyPatterns[],
const char* expectedFilteredKeyPatterns[]) {
+ PlanCache planCache;
QuerySettings querySettings;
AllowedIndices *allowedIndicesRaw;
// getAllowedIndices should return false when query shape is not yet in query settings.
auto_ptr<CanonicalQuery> cq(canonicalize("{a: 1}", "{}", "{}"));
- ASSERT_FALSE(querySettings.getAllowedIndices(*cq, &allowedIndicesRaw));
+ PlanCacheKey key = planCache.computeKey(*cq);
+ ASSERT_FALSE(querySettings.getAllowedIndices(key, &allowedIndicesRaw));
// Add entry to query settings.
- const PlanCacheKey& key = cq->getPlanCacheKey();
std::vector<BSONObj> indexKeyPatterns;
for (int i=0; hintKeyPatterns[i] != NULL; ++i) {
indexKeyPatterns.push_back(fromjson(hintKeyPatterns[i]));
}
- querySettings.setAllowedIndices(*cq, indexKeyPatterns);
+ querySettings.setAllowedIndices(*cq, key, indexKeyPatterns);
// Index entry vector should contain 1 entry after filtering.
- ASSERT_TRUE(querySettings.getAllowedIndices(*cq, &allowedIndicesRaw));
+ ASSERT_TRUE(querySettings.getAllowedIndices(key, &allowedIndicesRaw));
ASSERT_FALSE(key.empty());
ASSERT(NULL != allowedIndicesRaw);
auto_ptr<AllowedIndices> allowedIndices(allowedIndicesRaw);