summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2022-05-03 23:17:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-04 00:08:29 +0000
commitf462237ac17a9c8a3e4a5a3fb6bbe6a966d4be85 (patch)
tree6e37a46ffd65e3a18c300bfe8672909a7b43fcb6 /src/mongo/dbtests
parentc9260ac7135fc183f2a785124d033debc63e2734 (diff)
downloadmongo-f462237ac17a9c8a3e4a5a3fb6bbe6a966d4be85.tar.gz
SERVER-64315 Re-enable caching of SBE plans when there is a single query solution
This reverts commit f8589f840c8fee60abc482d2d2c41979e356922a.
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/querytests.cpp48
1 files changed, 6 insertions, 42 deletions
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 576a791a1bf..070767fa8cc 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -188,45 +188,12 @@ public:
BSONObj query = fromjson("{$or:[{b:2},{c:3}]}");
BSONObj ret;
// Check findOne() returning object.
- ASSERT(Helpers::findOne(&_opCtx, _collection, query, ret, true));
+ ASSERT(Helpers::findOne(&_opCtx, _collection, query, ret));
ASSERT_EQUALS(string("b"), ret.firstElement().fieldName());
// Cross check with findOne() returning location.
ASSERT_BSONOBJ_EQ(
ret,
- _collection->docFor(&_opCtx, Helpers::findOne(&_opCtx, _collection, query, true))
- .value());
- }
-};
-
-class FindOneRequireIndex : public Base {
-public:
- void run() {
- insert(BSON("b" << 2 << "_id" << 0));
- BSONObj query = fromjson("{b:2}");
- BSONObj ret;
-
- // Check findOne() returning object, allowing unindexed scan.
- ASSERT(Helpers::findOne(&_opCtx, _collection, query, ret, false));
- // Check findOne() returning location, allowing unindexed scan.
- ASSERT_BSONOBJ_EQ(
- ret,
- _collection->docFor(&_opCtx, Helpers::findOne(&_opCtx, _collection, query, false))
- .value());
-
- // Check findOne() returning object, requiring indexed scan without index.
- ASSERT_THROWS(Helpers::findOne(&_opCtx, _collection, query, ret, true), AssertionException);
- // Check findOne() returning location, requiring indexed scan without index.
- ASSERT_THROWS(Helpers::findOne(&_opCtx, _collection, query, true), AssertionException);
-
- addIndex(IndexSpec().addKey("b").unique(false));
-
- // Check findOne() returning object, requiring indexed scan with index.
- ASSERT(Helpers::findOne(&_opCtx, _collection, query, ret, true));
- // Check findOne() returning location, requiring indexed scan with index.
- ASSERT_BSONOBJ_EQ(
- ret,
- _collection->docFor(&_opCtx, Helpers::findOne(&_opCtx, _collection, query, true))
- .value());
+ _collection->docFor(&_opCtx, Helpers::findOne(&_opCtx, _collection, query)).value());
}
};
@@ -262,12 +229,11 @@ public:
insert(BSONObj());
BSONObj query;
BSONObj ret;
- ASSERT(Helpers::findOne(&_opCtx, _collection, query, ret, false));
+ ASSERT(Helpers::findOne(&_opCtx, _collection, query, ret));
ASSERT(ret.isEmpty());
ASSERT_BSONOBJ_EQ(
ret,
- _collection->docFor(&_opCtx, Helpers::findOne(&_opCtx, _collection, query, false))
- .value());
+ _collection->docFor(&_opCtx, Helpers::findOne(&_opCtx, _collection, query)).value());
}
};
@@ -1432,7 +1398,7 @@ public:
ASSERT_EQUALS(50, count());
BSONObj res;
- ASSERT(Helpers::findOne(&_opCtx, ctx.getCollection(), BSON("_id" << 20), res, true));
+ ASSERT(Helpers::findOne(&_opCtx, ctx.getCollection(), BSON("_id" << 20), res));
ASSERT_EQUALS(40, res["x"].numberInt());
ASSERT(Helpers::findById(&_opCtx, ctx.db(), ns(), BSON("_id" << 20), res));
@@ -1447,8 +1413,7 @@ public:
{
Timer t;
for (int i = 0; i < n; i++) {
- ASSERT(
- Helpers::findOne(&_opCtx, ctx.getCollection(), BSON("_id" << 20), res, true));
+ ASSERT(Helpers::findOne(&_opCtx, ctx.getCollection(), BSON("_id" << 20), res));
}
slow = t.micros();
}
@@ -1936,7 +1901,6 @@ public:
void setupTests() {
add<FindingStart>();
add<FindOneOr>();
- add<FindOneRequireIndex>();
add<FindOneEmptyObj>();
add<BoundedKey>();
add<GetMore>();