summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r--src/mongo/db/exec/geo_near.cpp37
-rw-r--r--src/mongo/db/exec/geo_near.h8
-rw-r--r--src/mongo/db/exec/near.cpp4
-rw-r--r--src/mongo/db/exec/near.h7
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:
//