summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/planner_analysis_test.cpp
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@10gen.com>2018-11-30 17:31:15 -0500
committerJacob Evans <jacob.evans@10gen.com>2018-12-14 15:27:42 -0500
commitac39ac47d776bbd0f442f945d4ae6091b73cfb03 (patch)
treeadfea7594dc25d87b76a6fb4b9db05dbfc38dbc3 /src/mongo/db/query/planner_analysis_test.cpp
parent333b35057d35230ad5bc868bd0eaa7423d9aceb4 (diff)
downloadmongo-ac39ac47d776bbd0f442f945d4ae6091b73cfb03.tar.gz
SERVER-38069 Ensure WT transactions are not re-opened during plan updates
Diffstat (limited to 'src/mongo/db/query/planner_analysis_test.cpp')
-rw-r--r--src/mongo/db/query/planner_analysis_test.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/mongo/db/query/planner_analysis_test.cpp b/src/mongo/db/query/planner_analysis_test.cpp
index 11fee9f0bc0..1ad7de68ece 100644
--- a/src/mongo/db/query/planner_analysis_test.cpp
+++ b/src/mongo/db/query/planner_analysis_test.cpp
@@ -42,6 +42,24 @@ using namespace mongo;
namespace {
+/**
+ * Make a minimal IndexEntry from just a key pattern. A dummy name will be added.
+ */
+IndexEntry buildSimpleIndexEntry(const BSONObj& kp) {
+ return {kp,
+ IndexNames::nameToType(IndexNames::findPluginName(kp)),
+ false,
+ {},
+ {},
+ false,
+ false,
+ CoreIndexInfo::Identifier("test_foo"),
+ nullptr,
+ {},
+ nullptr,
+ nullptr};
+}
+
TEST(QueryPlannerAnalysis, GetSortPatternBasic) {
ASSERT_BSONOBJ_EQ(fromjson("{a: 1}"), QueryPlannerAnalysis::getSortPattern(fromjson("{a: 1}")));
ASSERT_BSONOBJ_EQ(fromjson("{a: -1}"),
@@ -114,7 +132,7 @@ TEST(QueryPlannerAnalysis, GetSortPatternSpecialIndexTypes) {
// Test the generation of sort orders provided by an index scan done by
// IndexScanNode::computeProperties().
TEST(QueryPlannerAnalysis, IxscanSortOrdersBasic) {
- IndexScanNode ixscan(IndexEntry(fromjson("{a: 1, b: 1, c: 1, d: 1, e: 1}")));
+ IndexScanNode ixscan(buildSimpleIndexEntry(fromjson("{a: 1, b: 1, c: 1, d: 1, e: 1}")));
// Bounds are {a: [[1,1]], b: [[2,2]], c: [[3,3]], d: [[1,5]], e:[[1,1],[2,2]]},
// all inclusive.
@@ -166,11 +184,11 @@ TEST(QueryPlannerAnalysis, GeoSkipValidation) {
BSONObj unsupportedVersion = fromjson("{'2dsphereIndexVersion': 2}");
BSONObj supportedVersion = fromjson("{'2dsphereIndexVersion': 3}");
- IndexEntry relevantIndex(fromjson("{'geometry.field': '2dsphere'}"));
- IndexEntry irrelevantIndex(fromjson("{'geometry.field': 1}"));
- IndexEntry differentFieldIndex(fromjson("{'geometry.blah': '2dsphere'}"));
- IndexEntry compoundIndex(fromjson("{'geometry.field': '2dsphere', 'a': -1}"));
- IndexEntry unsupportedIndex(fromjson("{'geometry.field': '2dsphere'}"));
+ auto relevantIndex = buildSimpleIndexEntry(fromjson("{'geometry.field': '2dsphere'}"));
+ auto irrelevantIndex = buildSimpleIndexEntry(fromjson("{'geometry.field': 1}"));
+ auto differentFieldIndex = buildSimpleIndexEntry(fromjson("{'geometry.blah': '2dsphere'}"));
+ auto compoundIndex = buildSimpleIndexEntry(fromjson("{'geometry.field': '2dsphere', 'a': -1}"));
+ auto unsupportedIndex = buildSimpleIndexEntry(fromjson("{'geometry.field': '2dsphere'}"));
relevantIndex.infoObj = irrelevantIndex.infoObj = differentFieldIndex.infoObj =
compoundIndex.infoObj = supportedVersion;