summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2020-02-27 17:31:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-25 20:23:43 +0000
commit085ffeb310e8fed49739cf8443fcb13ea795d867 (patch)
tree8c5c0b5681ece32c285cf65345f6c98f8f087f6c /src/mongo/dbtests
parentb4fedf13f77347b4be11053b59d01f80b769fd7c (diff)
downloadmongo-085ffeb310e8fed49739cf8443fcb13ea795d867.tar.gz
SERVER-25023 Allow multiple indexes on the same fields with different partial index filters
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/plan_executor_invalidation_test.cpp13
-rw-r--r--src/mongo/dbtests/query_stage_near.cpp10
2 files changed, 18 insertions, 5 deletions
diff --git a/src/mongo/dbtests/plan_executor_invalidation_test.cpp b/src/mongo/dbtests/plan_executor_invalidation_test.cpp
index a7e949465bd..23acefa8019 100644
--- a/src/mongo/dbtests/plan_executor_invalidation_test.cpp
+++ b/src/mongo/dbtests/plan_executor_invalidation_test.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/exec/collection_scan.h"
#include "mongo/db/exec/plan_stage.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/query/internal_plans.h"
@@ -100,9 +101,8 @@ public:
std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> makeIxscanPlan(BSONObj keyPattern,
BSONObj startKey,
BSONObj endKey) {
- auto indexDescriptor =
- collection()->getIndexCatalog()->findIndexByKeyPatternAndCollationSpec(
- &_opCtx, keyPattern, {});
+ auto indexDescriptor = collection()->getIndexCatalog()->findIndexByKeyPatternAndOptions(
+ &_opCtx, keyPattern, _makeMinimalIndexSpec(keyPattern));
ASSERT(indexDescriptor);
return InternalPlanner::indexScan(&_opCtx,
collection(),
@@ -134,6 +134,13 @@ public:
DBDirectClient _client;
boost::intrusive_ptr<ExpressionContext> _expCtx;
+
+private:
+ BSONObj _makeMinimalIndexSpec(BSONObj keyPattern) {
+ return BSON(IndexDescriptor::kKeyPatternFieldName
+ << keyPattern << IndexDescriptor::kIndexVersionFieldName
+ << IndexDescriptor::getDefaultIndexVersion());
+ }
};
TEST_F(PlanExecutorInvalidationTest, ExecutorToleratesDeletedDocumentsDuringYield) {
diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp
index 938a98e2f88..2976c4cfeb1 100644
--- a/src/mongo/dbtests/query_stage_near.cpp
+++ b/src/mongo/dbtests/query_stage_near.cpp
@@ -69,12 +69,18 @@ public:
_autoColl.emplace(_opCtx, NamespaceString{kTestNamespace});
auto* coll = _autoColl->getCollection();
ASSERT(coll);
- _mockGeoIndex = coll->getIndexCatalog()->findIndexByKeyPatternAndCollationSpec(
- _opCtx, kTestKeyPattern, BSONObj{});
+ _mockGeoIndex = coll->getIndexCatalog()->findIndexByKeyPatternAndOptions(
+ _opCtx, kTestKeyPattern, _makeMinimalIndexSpec(kTestKeyPattern));
ASSERT(_mockGeoIndex);
}
protected:
+ BSONObj _makeMinimalIndexSpec(BSONObj keyPattern) {
+ return BSON(IndexDescriptor::kKeyPatternFieldName
+ << keyPattern << IndexDescriptor::kIndexVersionFieldName
+ << IndexDescriptor::getDefaultIndexVersion());
+ }
+
const ServiceContext::UniqueOperationContext _uniqOpCtx = cc().makeOperationContext();
OperationContext* const _opCtx = _uniqOpCtx.get();
DBDirectClient directClient{_opCtx};