Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SERVER-4150 MultiPlanScanner keeps copy of ns string

  • Loading branch information...
commit 6988da36137c72bc3f3a07e7c0c30f2b9bf24bab 1 parent 5808f6c
@astaple astaple authored
View
2  src/mongo/db/clientcursor.h
@@ -422,6 +422,8 @@ namespace mongo {
public:
shared_ptr<ParsedQuery> pq;
shared_ptr<Projection> fields; // which fields query wants returned
+ // TODO Maybe helper objects should manage their own memory rather than rely on the
+ // original message being valid.
Message originalMessage; // this is effectively an auto ptr for data the matcher points to
View
19 src/mongo/db/queryoptimizer.cpp
@@ -873,7 +873,7 @@ namespace mongo {
}
if ( _or ) {
// Only construct an OrRangeGenerator if we may handle $or clauses.
- _org.reset( new OrRangeGenerator( ns, _query ) );
+ _org.reset( new OrRangeGenerator( _ns.c_str(), _query ) );
if ( !_org->getSpecial().empty() ) {
_or = false;
}
@@ -883,8 +883,10 @@ namespace mongo {
}
// if _or == false, don't use or clauses for index selection
if ( !_or ) {
- auto_ptr<FieldRangeSetPair> frsp( new FieldRangeSetPair( ns, _query, true ) );
- _currentQps.reset( new QueryPlanSet( ns, frsp, auto_ptr<FieldRangeSetPair>(), _query, order, false, hint, honorRecordedPlan, min, max, _bestGuessOnly, _mayYield ) );
+ auto_ptr<FieldRangeSetPair> frsp( new FieldRangeSetPair( _ns.c_str(), _query, true ) );
+ _currentQps.reset( new QueryPlanSet( _ns.c_str(), frsp, auto_ptr<FieldRangeSetPair>(),
+ _query, order, false, hint, honorRecordedPlan, min,
+ max, _bestGuessOnly, _mayYield ) );
}
else {
BSONElement e = _query.getField( "$or" );
@@ -902,7 +904,9 @@ namespace mongo {
auto_ptr<FieldRangeSetPair> frsp( _org->topFrsp() );
auto_ptr<FieldRangeSetPair> originalFrsp( _org->topFrspOriginal() );
BSONElement hintElt = _hint.firstElement();
- _currentQps.reset( new QueryPlanSet( _ns, frsp, originalFrsp, _query, BSONObj(), true, &hintElt, _honorRecordedPlan, BSONObj(), BSONObj(), _bestGuessOnly, _mayYield ) );
+ _currentQps.reset( new QueryPlanSet( _ns.c_str(), frsp, originalFrsp, _query, BSONObj(),
+ true, &hintElt, _honorRecordedPlan, BSONObj(),
+ BSONObj(), _bestGuessOnly, _mayYield ) );
shared_ptr<QueryOp> ret( _currentQps->runOp( op ) );
if ( ! ret->complete() )
throw MsgAssertionException( ret->exception() );
@@ -944,7 +948,10 @@ namespace mongo {
auto_ptr<FieldRangeSetPair> frsp( _org->topFrsp() );
auto_ptr<FieldRangeSetPair> originalFrsp( _org->topFrspOriginal() );
BSONElement hintElt = _hint.firstElement();
- _currentQps.reset( new QueryPlanSet( _ns, frsp, originalFrsp, _query, BSONObj(), true, &hintElt, _honorRecordedPlan, BSONObj(), BSONObj(), _bestGuessOnly, _mayYield ) );
+ _currentQps.reset( new QueryPlanSet( _ns.c_str(), frsp, originalFrsp, _query,
+ BSONObj(), true, &hintElt, _honorRecordedPlan,
+ BSONObj(), BSONObj(), _bestGuessOnly,
+ _mayYield ) );
op = nextOpHandleEndOfClause();
if ( !op->complete() ) {
return op;
@@ -1017,7 +1024,7 @@ namespace mongo {
}
bool MultiPlanScanner::uselessOr( const BSONElement &hint ) const {
- NamespaceDetails *nsd = nsdetails( _ns );
+ NamespaceDetails *nsd = nsdetails( _ns.c_str() );
if ( !nsd ) {
return true;
}
View
2  src/mongo/db/queryoptimizer.h
@@ -471,7 +471,7 @@ namespace mongo {
shared_ptr<QueryOp> nextOpBeginningClause();
shared_ptr<QueryOp> nextOpHandleEndOfClause();
bool uselessOr( const BSONElement &hint ) const;
- const char * _ns;
+ const string _ns;
bool _or;
BSONObj _query;
shared_ptr<OrRangeGenerator> _org; // May be null in certain non $or query cases.
Please sign in to comment.
Something went wrong with that request. Please try again.