mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Recording plan configurable
This commit is contained in:
parent
0d8dded1c3
commit
b1341cf000
@ -697,6 +697,7 @@ namespace mongo {
|
|||||||
return new CountOp( spec_ );
|
return new CountOp( spec_ );
|
||||||
}
|
}
|
||||||
int count() const { return count_; }
|
int count() const { return count_; }
|
||||||
|
virtual bool mayRecordPlan() const { return true; }
|
||||||
private:
|
private:
|
||||||
BSONObj spec_;
|
BSONObj spec_;
|
||||||
int count_;
|
int count_;
|
||||||
@ -838,6 +839,7 @@ namespace mongo {
|
|||||||
}
|
}
|
||||||
setComplete();
|
setComplete();
|
||||||
}
|
}
|
||||||
|
virtual bool mayRecordPlan() const { return ntoreturn_ != 1; }
|
||||||
virtual QueryOp *clone() const {
|
virtual QueryOp *clone() const {
|
||||||
return new DoQueryOp( ntoskip_, ntoreturn_, order_, wantMore_, explain_, filter_, queryOptions_ );
|
return new DoQueryOp( ntoskip_, ntoreturn_, order_, wantMore_, explain_, filter_, queryOptions_ );
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,8 @@ namespace mongo {
|
|||||||
op.setExceptionMessage( "Caught unknown exception" );
|
op.setExceptionMessage( "Caught unknown exception" );
|
||||||
}
|
}
|
||||||
if ( op.complete() ) {
|
if ( op.complete() ) {
|
||||||
op.qp().registerSelf();
|
if ( op.mayRecordPlan() )
|
||||||
|
op.qp().registerSelf();
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
if ( op.error() )
|
if ( op.error() )
|
||||||
|
@ -74,19 +74,20 @@ namespace mongo {
|
|||||||
virtual ~QueryOp() {}
|
virtual ~QueryOp() {}
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
virtual void next() = 0;
|
virtual void next() = 0;
|
||||||
void setQueryPlan( const QueryPlan *qp ) { qp_ = qp; }
|
virtual bool mayRecordPlan() const = 0;
|
||||||
// Return a copy of the inheriting class, which will be run with its own
|
// Return a copy of the inheriting class, which will be run with its own
|
||||||
// query plan.
|
// query plan.
|
||||||
virtual QueryOp *clone() const = 0;
|
virtual QueryOp *clone() const = 0;
|
||||||
bool complete() const { return complete_; }
|
bool complete() const { return complete_; }
|
||||||
bool error() const { return error_; }
|
bool error() const { return error_; }
|
||||||
string exceptionMessage() const { return exceptionMessage_; }
|
string exceptionMessage() const { return exceptionMessage_; }
|
||||||
|
const QueryPlan &qp() { return *qp_; }
|
||||||
// To be called by QueryPlanSet::Runner only.
|
// To be called by QueryPlanSet::Runner only.
|
||||||
|
void setQueryPlan( const QueryPlan *qp ) { qp_ = qp; }
|
||||||
void setExceptionMessage( const string &exceptionMessage ) {
|
void setExceptionMessage( const string &exceptionMessage ) {
|
||||||
error_ = true;
|
error_ = true;
|
||||||
exceptionMessage_ = exceptionMessage;
|
exceptionMessage_ = exceptionMessage;
|
||||||
}
|
}
|
||||||
const QueryPlan &qp() { return *qp_; }
|
|
||||||
protected:
|
protected:
|
||||||
void setComplete() { complete_ = true; }
|
void setComplete() { complete_ = true; }
|
||||||
private:
|
private:
|
||||||
|
@ -664,6 +664,7 @@ namespace QueryOptimizerTests {
|
|||||||
youThrow_ = !youThrow_;
|
youThrow_ = !youThrow_;
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
virtual bool mayRecordPlan() const { return true; }
|
||||||
private:
|
private:
|
||||||
bool iThrow_;
|
bool iThrow_;
|
||||||
bool &threw_;
|
bool &threw_;
|
||||||
@ -695,6 +696,7 @@ namespace QueryOptimizerTests {
|
|||||||
virtual QueryOp *clone() const {
|
virtual QueryOp *clone() const {
|
||||||
return new TestOp();
|
return new TestOp();
|
||||||
}
|
}
|
||||||
|
virtual bool mayRecordPlan() const { return true; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -744,6 +746,7 @@ namespace QueryOptimizerTests {
|
|||||||
virtual QueryOp *clone() const {
|
virtual QueryOp *clone() const {
|
||||||
return new TestOp();
|
return new TestOp();
|
||||||
}
|
}
|
||||||
|
virtual bool mayRecordPlan() const { return true; }
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user