diff options
Diffstat (limited to 'src/mongo/db/exec/geo_near.cpp')
-rw-r--r-- | src/mongo/db/exec/geo_near.cpp | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp index 744e2e6fc0b..800a4ee76b2 100644 --- a/src/mongo/db/exec/geo_near.cpp +++ b/src/mongo/db/exec/geo_near.cpp @@ -288,14 +288,14 @@ public: _currentLevel = std::max(0u, hashParams.bits - 1u); } - PlanStage::StageState work(OperationContext* txn, + PlanStage::StageState work(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, WorkingSetID* out, double* estimatedDistance); private: - void buildIndexScan(OperationContext* txn, WorkingSet* workingSet, Collection* collection); + void buildIndexScan(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection); PlanStage::Children* _children; // Points to PlanStage::_children in the NearStage. const IndexDescriptor* _twoDIndex; // Not owned here. @@ -308,7 +308,7 @@ private: }; // Initialize the internal states -void GeoNear2DStage::DensityEstimator::buildIndexScan(OperationContext* txn, +void GeoNear2DStage::DensityEstimator::buildIndexScan(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection) { IndexScanParams scanParams; @@ -348,20 +348,20 @@ void GeoNear2DStage::DensityEstimator::buildIndexScan(OperationContext* txn, IndexBoundsBuilder::intersectize(oil, &scanParams.bounds.fields[twoDFieldPosition]); invariant(!_indexScan); - _indexScan = new IndexScan(txn, scanParams, workingSet, NULL); + _indexScan = new IndexScan(opCtx, scanParams, workingSet, NULL); _children->emplace_back(_indexScan); } // Return IS_EOF is we find a document in it's ancestor cells and set estimated distance // from the nearest document. -PlanStage::StageState GeoNear2DStage::DensityEstimator::work(OperationContext* txn, +PlanStage::StageState GeoNear2DStage::DensityEstimator::work(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, WorkingSetID* out, double* estimatedDistance) { if (!_indexScan) { // Setup index scan stage for current level. - buildIndexScan(txn, workingSet, collection); + buildIndexScan(opCtx, workingSet, collection); } WorkingSetID workingSetID; @@ -429,7 +429,7 @@ PlanStage::StageState GeoNear2DStage::DensityEstimator::work(OperationContext* t return state; } -PlanStage::StageState GeoNear2DStage::initialize(OperationContext* txn, +PlanStage::StageState GeoNear2DStage::initialize(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, WorkingSetID* out) { @@ -440,7 +440,7 @@ PlanStage::StageState GeoNear2DStage::initialize(OperationContext* txn, double estimatedDistance; PlanStage::StageState state = - _densityEstimator->work(txn, workingSet, collection, out, &estimatedDistance); + _densityEstimator->work(opCtx, workingSet, collection, out, &estimatedDistance); if (state == PlanStage::IS_EOF) { // 2d index only works with legacy points as centroid. $nearSphere will project @@ -476,11 +476,11 @@ PlanStage::StageState GeoNear2DStage::initialize(OperationContext* txn, static const string kTwoDIndexNearStage("GEO_NEAR_2D"); GeoNear2DStage::GeoNear2DStage(const GeoNearParams& nearParams, - OperationContext* txn, + OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, IndexDescriptor* twoDIndex) - : NearStage(txn, kTwoDIndexNearStage.c_str(), STAGE_GEO_NEAR_2D, workingSet, collection), + : NearStage(opCtx, kTwoDIndexNearStage.c_str(), STAGE_GEO_NEAR_2D, workingSet, collection), _nearParams(nearParams), _twoDIndex(twoDIndex), _fullBounds(twoDDistanceBounds(nearParams, twoDIndex)), @@ -546,12 +546,12 @@ private: // Helper class to maintain ownership of a match expression alongside an index scan class FetchStageWithMatch final : public FetchStage { public: - FetchStageWithMatch(OperationContext* txn, + FetchStageWithMatch(OperationContext* opCtx, WorkingSet* ws, PlanStage* child, MatchExpression* filter, const Collection* collection) - : FetchStage(txn, ws, child, filter, collection), _matcher(filter) {} + : FetchStage(opCtx, ws, child, filter, collection), _matcher(filter) {} private: // Owns matcher @@ -591,7 +591,7 @@ static R2Annulus projectBoundsToTwoDDegrees(R2Annulus sphereBounds) { } StatusWith<NearStage::CoveredInterval*> // - GeoNear2DStage::nextInterval(OperationContext* txn, + GeoNear2DStage::nextInterval(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection) { // The search is finished if we searched at least once and all the way to the edge @@ -726,7 +726,7 @@ StatusWith<NearStage::CoveredInterval*> // GeoHashConverter::parseParameters(_twoDIndex->infoObj(), &hashParams); // 2D indexes support covered search over additional fields they contain - IndexScan* scan = new IndexScan(txn, scanParams, workingSet, _nearParams.filter); + IndexScan* scan = new IndexScan(opCtx, scanParams, workingSet, _nearParams.filter); MatchExpression* docMatcher = nullptr; @@ -737,7 +737,8 @@ StatusWith<NearStage::CoveredInterval*> // } // FetchStage owns index scan - _children.emplace_back(new FetchStageWithMatch(txn, workingSet, scan, docMatcher, collection)); + _children.emplace_back( + new FetchStageWithMatch(opCtx, workingSet, scan, docMatcher, collection)); return StatusWith<CoveredInterval*>(new CoveredInterval(_children.back().get(), true, @@ -774,11 +775,11 @@ static int getFieldPosition(const IndexDescriptor* index, const string& fieldNam static const string kS2IndexNearStage("GEO_NEAR_2DSPHERE"); GeoNear2DSphereStage::GeoNear2DSphereStage(const GeoNearParams& nearParams, - OperationContext* txn, + OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, IndexDescriptor* s2Index) - : NearStage(txn, kS2IndexNearStage.c_str(), STAGE_GEO_NEAR_2DSPHERE, workingSet, collection), + : NearStage(opCtx, kS2IndexNearStage.c_str(), STAGE_GEO_NEAR_2DSPHERE, workingSet, collection), _nearParams(nearParams), _s2Index(s2Index), _fullBounds(geoNearDistanceBounds(*nearParams.nearQuery)), @@ -861,14 +862,14 @@ public: // Search for a document in neighbors at current level. // Return IS_EOF is such document exists and set the estimated distance to the nearest doc. - PlanStage::StageState work(OperationContext* txn, + PlanStage::StageState work(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, WorkingSetID* out, double* estimatedDistance); private: - void buildIndexScan(OperationContext* txn, WorkingSet* workingSet, Collection* collection); + void buildIndexScan(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection); PlanStage::Children* _children; // Points to PlanStage::_children in the NearStage. const IndexDescriptor* _s2Index; // Not owned here. @@ -880,7 +881,7 @@ private: }; // Setup the index scan stage for neighbors at this level. -void GeoNear2DSphereStage::DensityEstimator::buildIndexScan(OperationContext* txn, +void GeoNear2DSphereStage::DensityEstimator::buildIndexScan(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection) { IndexScanParams scanParams; @@ -909,18 +910,18 @@ void GeoNear2DSphereStage::DensityEstimator::buildIndexScan(OperationContext* tx // Index scan invariant(!_indexScan); - _indexScan = new IndexScan(txn, scanParams, workingSet, NULL); + _indexScan = new IndexScan(opCtx, scanParams, workingSet, NULL); _children->emplace_back(_indexScan); } -PlanStage::StageState GeoNear2DSphereStage::DensityEstimator::work(OperationContext* txn, +PlanStage::StageState GeoNear2DSphereStage::DensityEstimator::work(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, WorkingSetID* out, double* estimatedDistance) { if (!_indexScan) { // Setup index scan stage for current level. - buildIndexScan(txn, workingSet, collection); + buildIndexScan(opCtx, workingSet, collection); } WorkingSetID workingSetID; @@ -991,7 +992,7 @@ PlanStage::StageState GeoNear2DSphereStage::DensityEstimator::work(OperationCont } -PlanStage::StageState GeoNear2DSphereStage::initialize(OperationContext* txn, +PlanStage::StageState GeoNear2DSphereStage::initialize(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection, WorkingSetID* out) { @@ -1002,7 +1003,7 @@ PlanStage::StageState GeoNear2DSphereStage::initialize(OperationContext* txn, double estimatedDistance; PlanStage::StageState state = - _densityEstimator->work(txn, workingSet, collection, out, &estimatedDistance); + _densityEstimator->work(opCtx, workingSet, collection, out, &estimatedDistance); if (state == IS_EOF) { // We find a document in 4 neighbors at current level, but didn't at previous level. @@ -1023,7 +1024,7 @@ PlanStage::StageState GeoNear2DSphereStage::initialize(OperationContext* txn, } StatusWith<NearStage::CoveredInterval*> // - GeoNear2DSphereStage::nextInterval(OperationContext* txn, + GeoNear2DSphereStage::nextInterval(OperationContext* opCtx, WorkingSet* workingSet, Collection* collection) { // The search is finished if we searched at least once and all the way to the edge @@ -1093,10 +1094,10 @@ StatusWith<NearStage::CoveredInterval*> // OrderedIntervalList* coveredIntervals = &scanParams.bounds.fields[s2FieldPosition]; ExpressionMapping::S2CellIdsToIntervalsWithParents(cover, _indexParams, coveredIntervals); - IndexScan* scan = new IndexScan(txn, scanParams, workingSet, nullptr); + IndexScan* scan = new IndexScan(opCtx, scanParams, workingSet, nullptr); // FetchStage owns index scan - _children.emplace_back(new FetchStage(txn, workingSet, scan, _nearParams.filter, collection)); + _children.emplace_back(new FetchStage(opCtx, workingSet, scan, _nearParams.filter, collection)); return StatusWith<CoveredInterval*>(new CoveredInterval(_children.back().get(), true, |