diff options
author | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-08-29 05:15:39 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-08-29 05:15:39 +0000 |
commit | ffd486c3ff049abc9f8a2c76b3e2b9dea970c19b (patch) | |
tree | 8e030dff77ff90c04aad143e14d1e2d924a92dcb /src/mongo/db/exec | |
parent | 98413549db019381b09c85299cee53c31e284f17 (diff) | |
download | mongo-ffd486c3ff049abc9f8a2c76b3e2b9dea970c19b.tar.gz |
SERVER-42248 Remove SortedDataInterface::seek() which accepts a BSONObj
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r-- | src/mongo/db/exec/count_scan.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/exec/distinct_scan.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/exec/index_scan.cpp | 22 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp index 55379bd5550..c24f3ef1343 100644 --- a/src/mongo/db/exec/count_scan.cpp +++ b/src/mongo/db/exec/count_scan.cpp @@ -115,7 +115,13 @@ PlanStage::StageState CountScan::doWork(WorkingSetID* out) { _cursor = indexAccessMethod()->newCursor(getOpCtx()); _cursor->setEndPosition(_endKey, _endKeyInclusive); - entry = _cursor->seek(_startKey, _startKeyInclusive, kWantLoc); + auto keyStringForSeek = IndexEntryComparison::makeKeyStringFromBSONKeyForSeek( + _startKey, + indexAccessMethod()->getSortedDataInterface()->getKeyStringVersion(), + indexAccessMethod()->getSortedDataInterface()->getOrdering(), + true, /* forward */ + _startKeyInclusive); + entry = _cursor->seek(keyStringForSeek); } else { entry = _cursor->next(kWantLoc); } diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp index 3b18a3e6bbd..3f8c3342e80 100644 --- a/src/mongo/db/exec/distinct_scan.cpp +++ b/src/mongo/db/exec/distinct_scan.cpp @@ -79,7 +79,7 @@ PlanStage::StageState DistinctScan::doWork(WorkingSetID* out) { try { if (!_cursor) _cursor = indexAccessMethod()->newCursor(getOpCtx(), _scanDirection == 1); - kv = _cursor->seek(IndexEntryComparison::makeKeyStringForSeekPoint( + kv = _cursor->seek(IndexEntryComparison::makeKeyStringFromSeekPointForSeek( _seekPoint, indexAccessMethod()->getSortedDataInterface()->getKeyStringVersion(), indexAccessMethod()->getSortedDataInterface()->getOrdering(), diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp index 4fee1efa50d..cd32deb7c0d 100644 --- a/src/mongo/db/exec/index_scan.cpp +++ b/src/mongo/db/exec/index_scan.cpp @@ -100,7 +100,14 @@ boost::optional<IndexKeyEntry> IndexScan::initIndexScan() { _startKey = _bounds.startKey; _endKey = _bounds.endKey; _indexCursor->setEndPosition(_endKey, _endKeyInclusive); - return _indexCursor->seek(_startKey, _startKeyInclusive); + + KeyString::Value keyStringForSeek = IndexEntryComparison::makeKeyStringFromBSONKeyForSeek( + _startKey, + indexAccessMethod()->getSortedDataInterface()->getKeyStringVersion(), + indexAccessMethod()->getSortedDataInterface()->getOrdering(), + _forward, + _startKeyInclusive); + return _indexCursor->seek(keyStringForSeek); } else { // For single intervals, we can use an optimized scan which checks against the position // of an end cursor. For all other index scans, we fall back on using @@ -108,13 +115,20 @@ boost::optional<IndexKeyEntry> IndexScan::initIndexScan() { if (IndexBoundsBuilder::isSingleInterval( _bounds, &_startKey, &_startKeyInclusive, &_endKey, &_endKeyInclusive)) { _indexCursor->setEndPosition(_endKey, _endKeyInclusive); - return _indexCursor->seek(_startKey, _startKeyInclusive); + + auto keyStringForSeek = IndexEntryComparison::makeKeyStringFromBSONKeyForSeek( + _startKey, + indexAccessMethod()->getSortedDataInterface()->getKeyStringVersion(), + indexAccessMethod()->getSortedDataInterface()->getOrdering(), + _forward, + _startKeyInclusive); + return _indexCursor->seek(keyStringForSeek); } else { _checker.reset(new IndexBoundsChecker(&_bounds, _keyPattern, _direction)); if (!_checker->getStartSeekPoint(&_seekPoint)) return boost::none; - return _indexCursor->seek(IndexEntryComparison::makeKeyStringForSeekPoint( + return _indexCursor->seek(IndexEntryComparison::makeKeyStringFromSeekPointForSeek( _seekPoint, indexAccessMethod()->getSortedDataInterface()->getKeyStringVersion(), indexAccessMethod()->getSortedDataInterface()->getOrdering(), @@ -136,7 +150,7 @@ PlanStage::StageState IndexScan::doWork(WorkingSetID* out) { break; case NEED_SEEK: ++_specificStats.seeks; - kv = _indexCursor->seek(IndexEntryComparison::makeKeyStringForSeekPoint( + kv = _indexCursor->seek(IndexEntryComparison::makeKeyStringFromSeekPointForSeek( _seekPoint, indexAccessMethod()->getSortedDataInterface()->getKeyStringVersion(), indexAccessMethod()->getSortedDataInterface()->getOrdering(), |