Permalink
Browse files

SERVER-6053 - query pieces need to not rely on the original message b…

…uffer having the same scope they do
  • Loading branch information...
1 parent 587e650 commit 60feb24defa2cc85d82ac5e80be6bdf13521ef0b @erh erh committed Jun 10, 2012
Showing with 14 additions and 17 deletions.
  1. +0 −5 src/mongo/db/clientcursor.h
  2. +11 −11 src/mongo/db/ops/query.cpp
  3. +3 −1 src/mongo/db/queryutil.h
View
5 src/mongo/db/clientcursor.h
@@ -419,11 +419,6 @@ 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
-
-
private: // static members
View
22 src/mongo/db/ops/query.cpp
@@ -626,13 +626,13 @@ namespace mongo {
* Run a query with a cursor provided by the query optimizer, or FindingStartCursor.
* @yields the db lock.
*/
- const char *queryWithQueryOptimizer( Message &m, int queryOptions, const char *ns,
- const BSONObj &jsobj, CurOp& curop,
- const BSONObj &query, const BSONObj &order,
- const shared_ptr<ParsedQuery> &pq_shared,
- const BSONObj &oldPlan,
- const ConfigVersion &shardingVersionAtStart,
- Message &result ) {
+ const char *queryWithQueryOptimizer( const Message &m, int queryOptions, const char *ns,
+ const BSONObj &jsobj, CurOp& curop,
+ const BSONObj &query, const BSONObj &order,
+ const shared_ptr<ParsedQuery> &pq_shared,
+ const BSONObj &oldPlan,
+ const ConfigVersion &shardingVersionAtStart,
+ Message &result ) {
const ParsedQuery &pq( *pq_shared );
shared_ptr<Cursor> cursor;
@@ -749,9 +749,6 @@ namespace mongo {
ccPointer->c()->noteLocation();
}
- // !!! Save the original message buffer, so it can be referenced in getMore.
- ccPointer->originalMessage = m;
-
// Save slave's position in the oplog.
if ( pq.hasOption( QueryOption_OplogReplay ) && !slaveReadTill.isNull() ) {
ccPointer->slaveReadTill( slaveReadTill );
@@ -949,7 +946,10 @@ namespace mongo {
scoped_ptr<MultiPlanScanner> mps( MultiPlanScanner::make( ns, query, order ) );
oldPlan = mps->cachedPlanExplainSummary();
}
-
+
+ jsobj = jsobj.getOwned();
+ order = order.getOwned();
+
return queryWithQueryOptimizer( m, queryOptions, ns, jsobj, curop, query, order,
pq_shared, oldPlan, shardingVersionAtStart, result );
}
View
4 src/mongo/db/queryutil.h
@@ -149,6 +149,8 @@ namespace mongo {
else {
_filter = q;
}
+
+ _filter = _filter.getOwned();
}
void _reset() {
@@ -215,7 +217,7 @@ namespace mongo {
if ( fields.isEmpty() )
return;
_fields.reset( new Projection() );
- _fields->init( fields );
+ _fields->init( fields.getOwned() );
}
const char * const _ns;

0 comments on commit 60feb24

Please sign in to comment.