diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-05-07 17:25:57 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-05-07 17:25:57 -0400 |
commit | 740cc1308e2e672d346e44d4b989c57c12a5bcd5 (patch) | |
tree | 2f66f4bba01c1bee63d5aa80739dd1afa9bce078 /db | |
parent | 8717179475a98d264770a70c5582bd9023271cbd (diff) | |
download | mongo-740cc1308e2e672d346e44d4b989c57c12a5bcd5.tar.gz |
auto_ptr -> shared_ptr for Cursor objects
Diffstat (limited to 'db')
-rw-r--r-- | db/clientcursor.h | 4 | ||||
-rw-r--r-- | db/dbcommands.cpp | 10 | ||||
-rw-r--r-- | db/dbcommands_admin.cpp | 2 | ||||
-rw-r--r-- | db/dbhelpers.cpp | 8 | ||||
-rw-r--r-- | db/dbhelpers.h | 4 | ||||
-rw-r--r-- | db/index_geo2d.cpp | 10 | ||||
-rw-r--r-- | db/indexkey.h | 2 | ||||
-rw-r--r-- | db/mr.cpp | 4 | ||||
-rw-r--r-- | db/oplog.h | 8 | ||||
-rw-r--r-- | db/pdfile.cpp | 24 | ||||
-rw-r--r-- | db/pdfile.h | 4 | ||||
-rw-r--r-- | db/query.cpp | 14 | ||||
-rw-r--r-- | db/queryoptimizer.cpp | 16 | ||||
-rw-r--r-- | db/queryoptimizer.h | 4 | ||||
-rw-r--r-- | db/repl.cpp | 12 | ||||
-rw-r--r-- | db/update.cpp | 2 |
16 files changed, 64 insertions, 64 deletions
diff --git a/db/clientcursor.h b/db/clientcursor.h index a7f2654abe6..a3a41530ae0 100644 --- a/db/clientcursor.h +++ b/db/clientcursor.h @@ -103,13 +103,13 @@ namespace mongo { /*const*/ CursorId cursorid; string ns; auto_ptr<CoveredIndexMatcher> matcher; - auto_ptr<Cursor> c; + shared_ptr<Cursor> c; int pos; // # objects into the cursor so far BSONObj query; int _queryOptions; OpTime _slaveReadTill; - ClientCursor(int queryOptions, auto_ptr<Cursor>& _c, const char *_ns) : + ClientCursor(int queryOptions, shared_ptr<Cursor>& _c, const char *_ns) : _idleAgeMillis(0), _pinValue(0), _doingDeletes(false), ns(_ns), c(_c), diff --git a/db/dbcommands.cpp b/db/dbcommands.cpp index 52e01395294..96844eeb7eb 100644 --- a/db/dbcommands.cpp +++ b/db/dbcommands.cpp @@ -982,7 +982,7 @@ namespace mongo { Client::Context ctx( ns ); - auto_ptr< Cursor > c; + shared_ptr<Cursor> c; if ( min.isEmpty() && max.isEmpty() ) { c = theDataFileMgr.findAll( ns.c_str() ); } @@ -1195,7 +1195,7 @@ namespace mongo { CursorId id; { - auto_ptr< Cursor > c = theDataFileMgr.findAll( fromNs.c_str(), startLoc ); + shared_ptr<Cursor> c = theDataFileMgr.findAll( fromNs.c_str(), startLoc ); ClientCursor *cc = new ClientCursor(0, c, fromNs.c_str()); cc->matcher.reset( new CoveredIndexMatcher( BSONObj(), fromjson( "{$natural:1}" ) ) ); id = cc->cursorid; @@ -1333,7 +1333,7 @@ namespace mongo { map<BSONObj,int,BSONObjCmp> map; list<BSONObj> blah; - auto_ptr<Cursor> cursor = QueryPlanSet(ns.c_str() , query , BSONObj() ).getBestGuess()->newCursor(); + shared_ptr<Cursor> cursor = QueryPlanSet(ns.c_str() , query , BSONObj() ).getBestGuess()->newCursor(); auto_ptr<CoveredIndexMatcher> matcher; if ( ! query.isEmpty() ) matcher.reset( new CoveredIndexMatcher( query , cursor->indexKeyPattern() ) ); @@ -1468,7 +1468,7 @@ namespace mongo { BSONObj query = getQuery( cmdObj ); BSONElementSet values; - auto_ptr<Cursor> cursor = QueryPlanSet(ns.c_str() , query , BSONObj() ).getBestGuess()->newCursor(); + shared_ptr<Cursor> cursor = QueryPlanSet(ns.c_str() , query , BSONObj() ).getBestGuess()->newCursor(); auto_ptr<CoveredIndexMatcher> matcher; if ( ! query.isEmpty() ) matcher.reset( new CoveredIndexMatcher( query , cursor->indexKeyPattern() ) ); @@ -1631,7 +1631,7 @@ namespace mongo { if ( c.find( ".system.profil" ) != string::npos ) continue; - auto_ptr<Cursor> cursor; + shared_ptr<Cursor> cursor; NamespaceDetails * nsd = nsdetails( c.c_str() ); diff --git a/db/dbcommands_admin.cpp b/db/dbcommands_admin.cpp index f166c8e80bc..faa9acd6d2d 100644 --- a/db/dbcommands_admin.cpp +++ b/db/dbcommands_admin.cpp @@ -143,7 +143,7 @@ namespace mongo { set<DiskLoc> recs; if( scanData ) { - auto_ptr<Cursor> c = theDataFileMgr.findAll(ns); + shared_ptr<Cursor> c = theDataFileMgr.findAll(ns); int n = 0; long long len = 0; long long nlen = 0; diff --git a/db/dbhelpers.cpp b/db/dbhelpers.cpp index d496c64b596..a0e6d4c3881 100644 --- a/db/dbhelpers.cpp +++ b/db/dbhelpers.cpp @@ -27,7 +27,7 @@ namespace mongo { - CursorIterator::CursorIterator( auto_ptr<Cursor> c , BSONObj filter ) + CursorIterator::CursorIterator( shared_ptr<Cursor> c , BSONObj filter ) : _cursor( c ){ if ( ! filter.isEmpty() ) _matcher.reset( new CoveredIndexMatcher( filter , BSONObj() ) ); @@ -119,7 +119,7 @@ namespace mongo { BSONObj one() const { return one_; } private: bool requireIndex_; - auto_ptr< Cursor > c_; + shared_ptr<Cursor> c_; auto_ptr< CoveredIndexMatcher > matcher_; BSONObj one_; }; @@ -175,7 +175,7 @@ namespace mongo { bool Helpers::isEmpty(const char *ns) { Client::Context context(ns); - auto_ptr<Cursor> c = DataFileMgr::findAll(ns); + shared_ptr<Cursor> c = DataFileMgr::findAll(ns); return !c->ok(); } @@ -187,7 +187,7 @@ namespace mongo { bool Helpers::getSingleton(const char *ns, BSONObj& result) { Client::Context context(ns); - auto_ptr<Cursor> c = DataFileMgr::findAll(ns); + shared_ptr<Cursor> c = DataFileMgr::findAll(ns); if ( !c->ok() ) return false; diff --git a/db/dbhelpers.h b/db/dbhelpers.h index 57a5a6e1659..08b88dc4e50 100644 --- a/db/dbhelpers.h +++ b/db/dbhelpers.h @@ -33,14 +33,14 @@ namespace mongo { class CursorIterator { public: - CursorIterator( auto_ptr<Cursor> c , BSONObj filter = BSONObj() ); + CursorIterator( shared_ptr<Cursor> c , BSONObj filter = BSONObj() ); BSONObj next(); bool hasNext(); private: void _advance(); - auto_ptr<Cursor> _cursor; + shared_ptr<Cursor> _cursor; auto_ptr<CoveredIndexMatcher> _matcher; BSONObj _o; }; diff --git a/db/index_geo2d.cpp b/db/index_geo2d.cpp index 74e88660878..4450eaf84d5 100644 --- a/db/index_geo2d.cpp +++ b/db/index_geo2d.cpp @@ -477,7 +477,7 @@ namespace mongo { return _spec->getDetails(); } - virtual auto_ptr<Cursor> newCursor( const BSONObj& query , const BSONObj& order , int numWanted ) const; + virtual shared_ptr<Cursor> newCursor( const BSONObj& query , const BSONObj& order , int numWanted ) const; virtual IndexSuitability suitability( const BSONObj& query , const BSONObj& order ) const { BSONElement e = query.getFieldDotted(_geo.c_str()); @@ -1468,7 +1468,7 @@ namespace mongo { }; - auto_ptr<Cursor> Geo2dType::newCursor( const BSONObj& query , const BSONObj& order , int numWanted ) const { + shared_ptr<Cursor> Geo2dType::newCursor( const BSONObj& query , const BSONObj& order , int numWanted ) const { if ( numWanted < 0 ) numWanted = numWanted * -1; else if ( numWanted == 0 ) @@ -1504,7 +1504,7 @@ namespace mongo { } shared_ptr<GeoSearch> s( new GeoSearch( this , _tohash(e) , numWanted , query , maxDistance ) ); s->exec(); - auto_ptr<Cursor> c; + shared_ptr<Cursor> c; c.reset( new GeoSearchCursor( s ) ); return c; } @@ -1515,13 +1515,13 @@ namespace mongo { string type = e.fieldName(); if ( type == "$center" ){ uassert( 13059 , "$center has to take an object or array" , e.isABSONObj() ); - auto_ptr<Cursor> c; + shared_ptr<Cursor> c; c.reset( new GeoCircleBrowse( this , e.embeddedObjectUserCheck() , query ) ); return c; } else if ( type == "$box" ){ uassert( 13065 , "$box has to take an object or array" , e.isABSONObj() ); - auto_ptr<Cursor> c; + shared_ptr<Cursor> c; c.reset( new GeoBoxBrowse( this , e.embeddedObjectUserCheck() , query ) ); return c; } diff --git a/db/indexkey.h b/db/indexkey.h index 47f4a65d94d..4f40aac55b3 100644 --- a/db/indexkey.h +++ b/db/indexkey.h @@ -44,7 +44,7 @@ namespace mongo { virtual ~IndexType(); virtual void getKeys( const BSONObj &obj, BSONObjSetDefaultOrder &keys ) const = 0; - virtual auto_ptr<Cursor> newCursor( const BSONObj& query , const BSONObj& order , int numWanted ) const = 0; + virtual shared_ptr<Cursor> newCursor( const BSONObj& query , const BSONObj& order , int numWanted ) const = 0; /** optional op : changes query to match what's in the index */ virtual BSONObj fixKey( const BSONObj& in ) { return in; } diff --git a/db/mr.cpp b/db/mr.cpp index 001daceffcf..efe764be9ca 100644 --- a/db/mr.cpp +++ b/db/mr.cpp @@ -452,7 +452,7 @@ namespace mongo { readlock lock( mr.ns ); Client::Context ctx( mr.ns ); - auto_ptr<Cursor> temp = QueryPlanSet(mr.ns.c_str() , mr.filter , BSONObj() ).getBestGuess()->newCursor(); + shared_ptr<Cursor> temp = QueryPlanSet(mr.ns.c_str() , mr.filter , BSONObj() ).getBestGuess()->newCursor(); auto_ptr<ClientCursor> cursor( new ClientCursor( QueryOption_NoCursorTimeout , temp , mr.ns.c_str() ) ); if ( ! mr.filter.isEmpty() ) @@ -533,7 +533,7 @@ namespace mongo { assert( pm == op->setMessage( "m/r: (3/3) final reduce to collection" , db.count( mr.incLong ) ) ); - auto_ptr<Cursor> temp = QueryPlanSet(mr.incLong.c_str() , BSONObj() , sortKey ).getBestGuess()->newCursor(); + shared_ptr<Cursor> temp = QueryPlanSet(mr.incLong.c_str() , BSONObj() , sortKey ).getBestGuess()->newCursor(); auto_ptr<ClientCursor> cursor( new ClientCursor( QueryOption_NoCursorTimeout , temp , mr.incLong.c_str() ) ); while ( cursor->ok() ){ diff --git a/db/oplog.h b/db/oplog.h index a0181805c35..b9d6b533e38 100644 --- a/db/oplog.h +++ b/db/oplog.h @@ -62,7 +62,7 @@ namespace mongo { _findingStartCursor( 0 ) { init(); } bool done() const { return !_findingStart; } - auto_ptr< Cursor > cRelease() { return _c; } + shared_ptr<Cursor> cRelease() { return _c; } void next() { if ( !_findingStartCursor || !_findingStartCursor->c->ok() ) { _findingStart = false; @@ -130,7 +130,7 @@ namespace mongo { auto_ptr< CoveredIndexMatcher > _matcher; Timer _findingStartTimer; ClientCursor * _findingStartCursor; - auto_ptr< Cursor > _c; + shared_ptr<Cursor> _c; DiskLoc startLoc( const DiskLoc &rec ) { Extent *e = rec.rec()->myExtent( rec ); if ( e->myLoc != _qp.nsd()->capExtent ) @@ -152,7 +152,7 @@ namespace mongo { return DiskLoc(); // reached beginning of collection } void createClientCursor( const DiskLoc &startLoc = DiskLoc() ) { - auto_ptr<Cursor> c = _qp.newCursor( startLoc ); + shared_ptr<Cursor> c = _qp.newCursor( startLoc ); _findingStartCursor = new ClientCursor(QueryOption_NoCursorTimeout, c, _qp.ns()); } void destroyClientCursor() { @@ -174,7 +174,7 @@ namespace mongo { void init() { // Use a ClientCursor here so we can release db mutex while scanning // oplog (can take quite a while with large oplogs). - auto_ptr<Cursor> c = _qp.newReverseCursor(); + shared_ptr<Cursor> c = _qp.newReverseCursor(); _findingStartCursor = new ClientCursor(QueryOption_NoCursorTimeout, c, _qp.ns()); _findingStartTimer.reset(); _findingStartMode = Initial; diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 0e5054f138a..6e544467020 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -562,10 +562,10 @@ namespace mongo { /*---------------------------------------------------------------------*/ - auto_ptr<Cursor> DataFileMgr::findAll(const char *ns, const DiskLoc &startLoc) { + shared_ptr<Cursor> DataFileMgr::findAll(const char *ns, const DiskLoc &startLoc) { NamespaceDetails * d = nsdetails( ns ); if ( ! d ) - return auto_ptr<Cursor>(new BasicCursor(DiskLoc())); + return shared_ptr<Cursor>(new BasicCursor(DiskLoc())); DiskLoc loc = d->firstExtent; Extent *e = getExtent(loc); @@ -590,10 +590,10 @@ namespace mongo { } if ( d->capped ) - return auto_ptr< Cursor >( new ForwardCappedCursor( d , startLoc ) ); + return shared_ptr<Cursor>( new ForwardCappedCursor( d , startLoc ) ); if ( !startLoc.isNull() ) - return auto_ptr<Cursor>(new BasicCursor( startLoc )); + return shared_ptr<Cursor>(new BasicCursor( startLoc )); while ( e->firstRecord.isNull() && !e->xnext.isNull() ) { /* todo: if extent is empty, free it for reuse elsewhere. @@ -604,13 +604,13 @@ namespace mongo { // it might be nice to free the whole extent here! but have to clean up free recs then. e = e->getNextExtent(); } - return auto_ptr<Cursor>(new BasicCursor( e->firstRecord )); + return shared_ptr<Cursor>(new BasicCursor( e->firstRecord )); } /* get a table scan cursor, but can be forward or reverse direction. order.$natural - if set, > 0 means forward (asc), < 0 backward (desc). */ - auto_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc) { + shared_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc) { BSONElement el = order.getField("$natural"); // e.g., { $natural : -1 } if ( el.number() >= 0 ) @@ -620,19 +620,19 @@ namespace mongo { NamespaceDetails *d = nsdetails(ns); if ( !d ) - return auto_ptr<Cursor>(new BasicCursor(DiskLoc())); + return shared_ptr<Cursor>(new BasicCursor(DiskLoc())); if ( !d->capped ) { if ( !startLoc.isNull() ) - return auto_ptr<Cursor>(new ReverseCursor( startLoc )); + return shared_ptr<Cursor>(new ReverseCursor( startLoc )); Extent *e = d->lastExtent.ext(); while ( e->lastRecord.isNull() && !e->xprev.isNull() ) { OCCASIONALLY out() << " findTableScan: extent empty, skipping ahead" << endl; e = e->getPrevExtent(); } - return auto_ptr<Cursor>(new ReverseCursor( e->lastRecord )); + return shared_ptr<Cursor>(new ReverseCursor( e->lastRecord )); } else { - return auto_ptr< Cursor >( new ReverseCappedCursor( d, startLoc ) ); + return shared_ptr<Cursor>( new ReverseCappedCursor( d, startLoc ) ); } } @@ -1029,7 +1029,7 @@ namespace mongo { /* get and sort all the keys ----- */ unsigned long long n = 0; - auto_ptr<Cursor> c = theDataFileMgr.findAll(ns); + shared_ptr<Cursor> c = theDataFileMgr.findAll(ns); BSONObjExternalSorter sorter(order); sorter.hintNumObjects( d->nrecords ); unsigned long long nkeys = 0; @@ -1126,7 +1126,7 @@ namespace mongo { unsigned long long n = 0; auto_ptr<ClientCursor> cc; { - auto_ptr<Cursor> c = theDataFileMgr.findAll(ns); + shared_ptr<Cursor> c = theDataFileMgr.findAll(ns); cc.reset( new ClientCursor(QueryOption_NoCursorTimeout, c, ns) ); } CursorId id = cc->cursorid; diff --git a/db/pdfile.h b/db/pdfile.h index 09c83c4297f..dd8f04997f6 100644 --- a/db/pdfile.h +++ b/db/pdfile.h @@ -49,7 +49,7 @@ namespace mongo { /* deletes this ns, indexes and cursors */ void dropCollection( const string &name, string &errmsg, BSONObjBuilder &result ); bool userCreateNS(const char *ns, BSONObj j, string& err, bool logForReplication); - auto_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc=DiskLoc()); + shared_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc=DiskLoc()); // -1 if library unavailable. boost::intmax_t freeSpace(); @@ -118,7 +118,7 @@ namespace mongo { DiskLoc insert(const char *ns, const void *buf, int len, bool god = false, const BSONElement &writeId = BSONElement(), bool mayAddIndex = true); void deleteRecord(const char *ns, Record *todelete, const DiskLoc& dl, bool cappedOK = false, bool noWarn = false); - static auto_ptr<Cursor> findAll(const char *ns, const DiskLoc &startLoc = DiskLoc()); + static shared_ptr<Cursor> findAll(const char *ns, const DiskLoc &startLoc = DiskLoc()); /* special version of insert for transaction logging -- streamlined a bit. assumes ns is capped and no indexes diff --git a/db/query.cpp b/db/query.cpp index dc396d3cbd9..42c1b9345bb 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -90,13 +90,13 @@ namespace mongo { virtual QueryOp *clone() const { return new DeleteOp( justOne_, bestCount_ ); } - auto_ptr< Cursor > newCursor() const { return qp().newCursor(); } + shared_ptr<Cursor> newCursor() const { return qp().newCursor(); } private: bool justOne_; int count_; int &bestCount_; long long _nscanned; - auto_ptr< Cursor > c_; + shared_ptr<Cursor> c_; auto_ptr< CoveredIndexMatcher > _matcher; }; @@ -130,7 +130,7 @@ namespace mongo { int best = 0; DeleteOp original( justOne, best ); shared_ptr< DeleteOp > bestOp = s.runOp( original ); - auto_ptr< Cursor > creal = bestOp->newCursor(); + shared_ptr<Cursor> creal = bestOp->newCursor(); if( !creal->ok() ) return nDeleted; @@ -428,7 +428,7 @@ namespace mongo { long long count_; long long skip_; long long limit_; - auto_ptr< Cursor > c_; + shared_ptr<Cursor> c_; BSONObj query_; BtreeCursor *bc_; auto_ptr< CoveredIndexMatcher > _matcher; @@ -624,7 +624,7 @@ namespace mongo { BufBuilder &builder() { return _buf; } bool scanAndOrderRequired() const { return _inMemSort; } - auto_ptr< Cursor > cursor() { return _c; } + shared_ptr<Cursor> cursor() { return _c; } auto_ptr< CoveredIndexMatcher > matcher() { return _matcher; } int n() const { return _n; } long long nscanned() const { return _nscanned; } @@ -645,7 +645,7 @@ namespace mongo { bool _inMemSort; auto_ptr< ScanAndOrder > _so; - auto_ptr< Cursor > _c; + shared_ptr<Cursor> _c; auto_ptr< CoveredIndexMatcher > _matcher; @@ -810,7 +810,7 @@ namespace mongo { nscanned = dqo.nscanned(); if ( dqo.scanAndOrderRequired() ) ss << " scanAndOrder "; - auto_ptr<Cursor> cursor = dqo.cursor(); + shared_ptr<Cursor> cursor = dqo.cursor(); log( 5 ) << " used cursor: " << cursor.get() << endl; if ( dqo.saveClientCursor() ) { // the clientcursor now owns the Cursor* and 'c' is released: diff --git a/db/queryoptimizer.cpp b/db/queryoptimizer.cpp index a2fac28a23f..e10a184603a 100644 --- a/db/queryoptimizer.cpp +++ b/db/queryoptimizer.cpp @@ -176,7 +176,7 @@ namespace mongo { unhelpful_ = true; } - auto_ptr< Cursor > QueryPlan::newCursor( const DiskLoc &startLoc , int numWanted ) const { + shared_ptr<Cursor> QueryPlan::newCursor( const DiskLoc &startLoc , int numWanted ) const { if ( _type ) return _type->newCursor( fbs_.query() , order_ , numWanted ); @@ -184,7 +184,7 @@ namespace mongo { if ( !fbs_.matchPossible() ){ if ( fbs_.nNontrivialRanges() ) checkTableScanAllowed( fbs_.ns() ); - return auto_ptr< Cursor >( new BasicCursor( DiskLoc() ) ); + return shared_ptr<Cursor>( new BasicCursor( DiskLoc() ) ); } if ( !index_ ){ if ( fbs_.nNontrivialRanges() ) @@ -196,15 +196,15 @@ namespace mongo { if ( indexBounds_.size() < 2 ) { // we are sure to spec endKeyInclusive_ - return auto_ptr< Cursor >( new BtreeCursor( d, idxNo, *index_, indexBounds_[ 0 ].first, indexBounds_[ 0 ].second, endKeyInclusive_, direction_ >= 0 ? 1 : -1 ) ); + return shared_ptr<Cursor>( new BtreeCursor( d, idxNo, *index_, indexBounds_[ 0 ].first, indexBounds_[ 0 ].second, endKeyInclusive_, direction_ >= 0 ? 1 : -1 ) ); } else { - return auto_ptr< Cursor >( new BtreeCursor( d, idxNo, *index_, indexBounds_, direction_ >= 0 ? 1 : -1 ) ); + return shared_ptr<Cursor>( new BtreeCursor( d, idxNo, *index_, indexBounds_, direction_ >= 0 ? 1 : -1 ) ); } } - auto_ptr< Cursor > QueryPlan::newReverseCursor() const { + shared_ptr<Cursor> QueryPlan::newReverseCursor() const { if ( !fbs_.matchPossible() ) - return auto_ptr< Cursor >( new BasicCursor( DiskLoc() ) ); + return shared_ptr<Cursor>( new BasicCursor( DiskLoc() ) ); if ( !index_ ) { int orderSpec = order_.getIntField( "$natural" ); if ( orderSpec == INT_MIN ) @@ -212,7 +212,7 @@ namespace mongo { return findTableScan( fbs_.ns(), BSON( "$natural" << -orderSpec ) ); } massert( 10364 , "newReverseCursor() not implemented for indexed plans", false ); - return auto_ptr< Cursor >( 0 ); + return shared_ptr<Cursor>(); } BSONObj QueryPlan::indexKey() const { @@ -441,7 +441,7 @@ namespace mongo { BSONObj QueryPlanSet::explain() const { vector< BSONObj > arr; for( PlanSet::const_iterator i = plans_.begin(); i != plans_.end(); ++i ) { - auto_ptr< Cursor > c = (*i)->newCursor(); + shared_ptr<Cursor> c = (*i)->newCursor(); BSONObjBuilder explain; explain.append( "cursor", c->toString() ); explain.appendArray( "indexBounds", c->prettyIndexBounds() ); diff --git a/db/queryoptimizer.h b/db/queryoptimizer.h index 1d00f8a0b8e..33662b2be7d 100644 --- a/db/queryoptimizer.h +++ b/db/queryoptimizer.h @@ -49,8 +49,8 @@ namespace mongo { requested sort order */ bool unhelpful() const { return unhelpful_; } int direction() const { return direction_; } - auto_ptr< Cursor > newCursor( const DiskLoc &startLoc = DiskLoc() , int numWanted=0 ) const; - auto_ptr< Cursor > newReverseCursor() const; + shared_ptr<Cursor> newCursor( const DiskLoc &startLoc = DiskLoc() , int numWanted=0 ) const; + shared_ptr<Cursor> newReverseCursor() const; BSONObj indexKey() const; const char *ns() const { return fbs_.ns(); } NamespaceDetails *nsd() const { return d; } diff --git a/db/repl.cpp b/db/repl.cpp index 62c90bd61fe..eb0d56bf2ab 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -301,7 +301,7 @@ namespace mongo { readlock lk( "local.sources" ); Client::Context ctx( "local.sources" ); - auto_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); + shared_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); int n = 0; while ( c->ok() ){ BSONObj s = c->current(); @@ -659,7 +659,7 @@ namespace mongo { // --source <host> specified. // check that no items are in sources other than that // add if missing - auto_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); + shared_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); int n = 0; while ( c->ok() ) { n++; @@ -703,7 +703,7 @@ namespace mongo { } // check that no items are in sources other than that // add if missing - auto_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); + shared_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); int n = 0; while ( c->ok() ) { n++; @@ -725,7 +725,7 @@ namespace mongo { } } - auto_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); + shared_ptr<Cursor> c = findTableScan("local.sources", BSONObj()); while ( c->ok() ) { ReplSource tmp(c->current()); if ( replPair && tmp.hostName == replPair->remote && tmp.sourceName() == "main" ) { @@ -1072,7 +1072,7 @@ namespace mongo { OpTime ReplSource::nextLastSavedLocalTs() const { Client::Context ctx( "local.oplog.$main" ); - auto_ptr< Cursor > c = findTableScan( "local.oplog.$main", BSON( "$natural" << -1 ) ); + shared_ptr<Cursor> c = findTableScan( "local.oplog.$main", BSON( "$natural" << -1 ) ); if ( c->ok() ) return OpTime( c->current().getField( "ts" ).date() ); return OpTime(); @@ -1100,7 +1100,7 @@ namespace mongo { bool ReplSource::updateSetsWithLocalOps( OpTime &localLogTail, bool mayUnlock ) { Client::Context ctx( "local.oplog.$main" ); - auto_ptr< Cursor > localLog = findTableScan( "local.oplog.$main", BSON( "$natural" << -1 ) ); + shared_ptr<Cursor> localLog = findTableScan( "local.oplog.$main", BSON( "$natural" << -1 ) ); OpTime newTail; for( ; localLog->ok(); localLog->advance() ) { BSONObj op = localLog->current(); diff --git a/db/update.cpp b/db/update.cpp index 95da84f2d6f..c248a513335 100644 --- a/db/update.cpp +++ b/db/update.cpp @@ -682,7 +682,7 @@ namespace mongo { UpdateOp() : _nscanned() {} virtual void init() { BSONObj pattern = qp().query(); - _c.reset( qp().newCursor().release() ); + _c = qp().newCursor(); if ( ! _c->ok() ) setComplete(); else |