diff options
author | David Storch <david.storch@10gen.com> | 2015-02-24 17:52:24 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-02-25 13:42:59 -0500 |
commit | fe22feda7b5a02918906174d83c999af1a23ba75 (patch) | |
tree | f25f1dc5066d3a1c260f65171cd52d02b02d88f8 /src/mongo/db/exec | |
parent | 70b8b7097c9c3b9dbfcc273467fd41c3c290b7fe (diff) | |
download | mongo-fe22feda7b5a02918906174d83c999af1a23ba75.tar.gz |
SERVER-17280 geo near must propagate invalidate messages to IndexScan used by DensityEstimator
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r-- | src/mongo/db/exec/geo_near.cpp | 37 | ||||
-rw-r--r-- | src/mongo/db/exec/geo_near.h | 8 | ||||
-rw-r--r-- | src/mongo/db/exec/near.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/exec/near.h | 7 |
4 files changed, 56 insertions, 0 deletions
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp index af6b60e1c45..c5367706062 100644 --- a/src/mongo/db/exec/geo_near.cpp +++ b/src/mongo/db/exec/geo_near.cpp @@ -303,6 +303,8 @@ namespace mongo { WorkingSetID* out, double* estimatedDistance); + void invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + private: void buildIndexScan(OperationContext* txn, WorkingSet* workingSet, Collection* collection); @@ -403,6 +405,15 @@ namespace mongo { return state; } + void GeoNear2DStage::DensityEstimator::invalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type) { + if (_indexScan) { + _indexScan->invalidate(txn, dl, type); + } + } + + PlanStage::StageState GeoNear2DStage::initialize(OperationContext* txn, WorkingSet* workingSet, Collection* collection, @@ -458,6 +469,14 @@ namespace mongo { GeoNear2DStage::~GeoNear2DStage() { } + void GeoNear2DStage::finishInvalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type) { + if (_densityEstimator) { + _densityEstimator->invalidate(txn, dl, type); + } + } + namespace { /** @@ -976,6 +995,8 @@ namespace mongo { WorkingSetID* out, double* estimatedDistance); + void invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type); + private: void buildIndexScan(OperationContext* txn, WorkingSet* workingSet, Collection* collection); @@ -1075,6 +1096,14 @@ namespace mongo { return state; } + void GeoNear2DSphereStage::DensityEstimator::invalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type) { + if (_indexScan) { + _indexScan->invalidate(txn, dl, type); + } + } + PlanStage::StageState GeoNear2DSphereStage::initialize(OperationContext* txn, WorkingSet* workingSet, @@ -1107,6 +1136,14 @@ namespace mongo { return state; } + void GeoNear2DSphereStage::finishInvalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type) { + if (_densityEstimator) { + _densityEstimator->invalidate(txn, dl, type); + } + } + StatusWith<NearStage::CoveredInterval*> // GeoNear2DSphereStage::nextInterval(OperationContext* txn, WorkingSet* workingSet, diff --git a/src/mongo/db/exec/geo_near.h b/src/mongo/db/exec/geo_near.h index 8aa2ace63c1..6bb449b10ad 100644 --- a/src/mongo/db/exec/geo_near.h +++ b/src/mongo/db/exec/geo_near.h @@ -88,6 +88,10 @@ namespace mongo { WorkingSet* workingSet, Collection* collection, WorkingSetID* out); + + virtual void finishInvalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type); private: const GeoNearParams _nearParams; @@ -134,6 +138,10 @@ namespace mongo { WorkingSet* workingSet, Collection* collection, WorkingSetID* out); + + virtual void finishInvalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type); private: const GeoNearParams _nearParams; diff --git a/src/mongo/db/exec/near.cpp b/src/mongo/db/exec/near.cpp index a07b5d7e2d1..46b345ad5ca 100644 --- a/src/mongo/db/exec/near.cpp +++ b/src/mongo/db/exec/near.cpp @@ -354,6 +354,10 @@ namespace mongo { // Don't keep it around in the seen map since there's no valid RecordId anymore _nextIntervalSeen.erase(seenIt); } + + // Subclass specific invalidation, e.g. passing the invalidation to the 2d or 2dsphere + // density estimator. + finishInvalidate(txn, dl, type); } vector<PlanStage*> NearStage::getChildren() const { diff --git a/src/mongo/db/exec/near.h b/src/mongo/db/exec/near.h index 5ed2c3553e5..60384679c00 100644 --- a/src/mongo/db/exec/near.h +++ b/src/mongo/db/exec/near.h @@ -147,6 +147,13 @@ namespace mongo { Collection* collection, WorkingSetID* out) = 0; + /** + * Does any invalidation work specific to the search type. + */ + virtual void finishInvalidate(OperationContext* txn, + const RecordId& dl, + InvalidationType type) = 0; + private: // |