mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-17280 geo near must propagate invalidate messages to IndexScan used by DensityEstimator
This commit is contained in:
parent
70b8b7097c
commit
fe22feda7b
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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:
|
||||
|
||||
//
|
||||
|
@ -183,6 +183,12 @@ namespace {
|
||||
return IS_EOF;
|
||||
}
|
||||
|
||||
virtual void finishInvalidate(OperationContext* txn,
|
||||
const RecordId& dl,
|
||||
InvalidationType type) {
|
||||
invariant(!"MockNearStage should not receive invalidations");
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
OwnedPointerVector<MockInterval> _intervals;
|
||||
|
Loading…
Reference in New Issue
Block a user