summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/sort_key_generator.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-04-28 16:36:11 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-05-05 10:29:06 -0400
commitf7a46a118288ba0ce45c7664777ea0e89c2eb845 (patch)
treed9ba6c6981072ce4b836617ebb1889ac17e4fcc2 /src/mongo/db/exec/sort_key_generator.cpp
parentf49018bca41048d8a4f729ccc0489ea6be073a20 (diff)
downloadmongo-f7a46a118288ba0ce45c7664777ea0e89c2eb845.tar.gz
SERVER-23610 CanonicalQuery should own a CollatorInterface
Diffstat (limited to 'src/mongo/db/exec/sort_key_generator.cpp')
-rw-r--r--src/mongo/db/exec/sort_key_generator.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mongo/db/exec/sort_key_generator.cpp b/src/mongo/db/exec/sort_key_generator.cpp
index 7ffa4fe3f52..0625e1553fc 100644
--- a/src/mongo/db/exec/sort_key_generator.cpp
+++ b/src/mongo/db/exec/sort_key_generator.cpp
@@ -50,7 +50,9 @@ namespace mongo {
// SortKeyGenerator
//
-SortKeyGenerator::SortKeyGenerator(const BSONObj& sortSpec, const BSONObj& queryObj) {
+SortKeyGenerator::SortKeyGenerator(OperationContext* txn,
+ const BSONObj& sortSpec,
+ const BSONObj& queryObj) {
_hasBounds = false;
_sortHasMeta = false;
_rawSortSpec = sortSpec;
@@ -100,7 +102,7 @@ SortKeyGenerator::SortKeyGenerator(const BSONObj& sortSpec, const BSONObj& query
_keyGen.reset(new BtreeKeyGeneratorV1(fieldNames, fixed, false /* not sparse */, nullptr));
// The bounds checker only works on the Btree part of the sort key.
- getBoundsForSort(queryObj, _btreeObj);
+ getBoundsForSort(txn, queryObj, _btreeObj);
if (_hasBounds) {
_boundsChecker.reset(new IndexBoundsChecker(&_bounds, _btreeObj, 1 /* == order */));
@@ -220,7 +222,9 @@ StatusWith<BSONObj> SortKeyGenerator::getSortKeyFromObject(const WorkingSetMembe
return *keys.begin();
}
-void SortKeyGenerator::getBoundsForSort(const BSONObj& queryObj, const BSONObj& sortObj) {
+void SortKeyGenerator::getBoundsForSort(OperationContext* txn,
+ const BSONObj& queryObj,
+ const BSONObj& sortObj) {
QueryPlannerParams params;
params.options = QueryPlannerParams::NO_TABLE_SCAN;
@@ -230,7 +234,7 @@ void SortKeyGenerator::getBoundsForSort(const BSONObj& queryObj, const BSONObj&
params.indices.push_back(sortOrder);
auto statusWithQueryForSort = CanonicalQuery::canonicalize(
- NamespaceString("fake.ns"), queryObj, ExtensionsCallbackNoop());
+ txn, NamespaceString("fake.ns"), queryObj, ExtensionsCallbackNoop());
verify(statusWithQueryForSort.isOK());
std::unique_ptr<CanonicalQuery> queryForSort = std::move(statusWithQueryForSort.getValue());
@@ -287,7 +291,7 @@ bool SortKeyGeneratorStage::isEOF() {
PlanStage::StageState SortKeyGeneratorStage::doWork(WorkingSetID* out) {
if (!_sortKeyGen) {
- _sortKeyGen = stdx::make_unique<SortKeyGenerator>(_sortSpec, _query);
+ _sortKeyGen = stdx::make_unique<SortKeyGenerator>(getOpCtx(), _sortSpec, _query);
return PlanStage::NEED_TIME;
}